@veevarts/design-system 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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"),Ee=require("framer-motion"),cs=require("@tiptap/react"),Qs=require("@tiptap/core"),go=require("@tiptap/extension-bold"),bo=require("@tiptap/extension-italic"),yo=require("@tiptap/extension-strike"),vo=require("@tiptap/extension-underline"),jo=require("@tiptap/extension-code"),wo=require("@tiptap/extension-color"),No=require("@tiptap/extension-highlight"),Co=require("@tiptap/extension-link"),ko=require("@tiptap/extension-text-style"),So=require("@tiptap/extension-heading"),$o=require("@tiptap/extension-paragraph"),Ao=require("@tiptap/extension-bullet-list"),Do=require("@tiptap/extension-ordered-list"),Eo=require("@tiptap/extension-task-list"),Fo=require("@tiptap/extension-task-item"),Lo=require("@tiptap/extension-list-item"),Mo=require("@tiptap/extension-code-block"),Ro=require("@tiptap/extension-blockquote"),_o=require("@tiptap/extension-horizontal-rule"),Po=require("@tiptap/extension-hard-break"),Zs=require("@tiptap/extension-history"),To=require("@tiptap/extension-text-align"),Io=require("@tiptap/extension-document"),Oo=require("@tiptap/extension-text"),zo=require("@tiptap/extension-dropcursor"),Bo=require("@tiptap/extension-gapcursor"),Ne={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"}}},ue={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},fe={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:Wt}=Ne.neutral,Vo=Ne.palettes.warning[700],Uo=Ne.palettes.warning[100],st={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},ds={"--rust":Ne.brand.primary[500],"--rust-fill":st.rustFill,"--rust-border":st.rustBorder,"--page":st.page,"--surface":Ne.neutral.white,"--border":st.border,"--hair":st.hair,"--ink":Wt[900],"--ink2":Wt[700],"--sub":Wt[500],"--muted":Wt[400],"--ok":Ne.semantic.success,"--ok-fill":st.okFill,"--warn":Vo,"--warn-fill":Uo,"--danger":Ne.semantic.danger,"--danger-fill":st.dangerFill,"--info":Ne.semantic.info,"--info-fill":st.infoFill};Object.fromEntries(Object.entries(ds).map(([e,n])=>[e.replace(/^--/,""),n]));function Ho({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(ds).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"),Fe=require("framer-motion"),ps=require("@tiptap/react"),sa=require("@tiptap/core"),Fo=require("@tiptap/extension-bold"),Lo=require("@tiptap/extension-italic"),Ro=require("@tiptap/extension-strike"),Mo=require("@tiptap/extension-underline"),_o=require("@tiptap/extension-code"),Po=require("@tiptap/extension-color"),To=require("@tiptap/extension-highlight"),Io=require("@tiptap/extension-link"),Oo=require("@tiptap/extension-text-style"),zo=require("@tiptap/extension-heading"),Bo=require("@tiptap/extension-paragraph"),Vo=require("@tiptap/extension-bullet-list"),Uo=require("@tiptap/extension-ordered-list"),Ho=require("@tiptap/extension-task-list"),qo=require("@tiptap/extension-task-item"),Wo=require("@tiptap/extension-list-item"),Go=require("@tiptap/extension-code-block"),Yo=require("@tiptap/extension-blockquote"),Ko=require("@tiptap/extension-horizontal-rule"),Qo=require("@tiptap/extension-hard-break"),aa=require("@tiptap/extension-history"),Zo=require("@tiptap/extension-text-align"),Xo=require("@tiptap/extension-document"),Jo=require("@tiptap/extension-text"),ec=require("@tiptap/extension-dropcursor"),tc=require("@tiptap/extension-gapcursor"),Ce={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"}}},fe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},pe={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:Kt}=Ce.neutral,nc=Ce.palettes.warning[700],sc=Ce.palettes.warning[100],rt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},gs={"--rust":Ce.brand.primary[500],"--rust-fill":rt.rustFill,"--rust-border":rt.rustBorder,"--page":rt.page,"--surface":Ce.neutral.white,"--border":rt.border,"--hair":rt.hair,"--ink":Kt[900],"--ink2":Kt[700],"--sub":Kt[500],"--muted":Kt[400],"--ok":Ce.semantic.success,"--ok-fill":rt.okFill,"--warn":nc,"--warn-fill":sc,"--danger":Ce.semantic.danger,"--danger-fill":rt.dangerFill,"--info":Ce.semantic.info,"--info-fill":rt.infoFill};Object.fromEntries(Object.entries(gs).map(([e,n])=>[e.replace(/^--/,""),n]));function ac({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(gs).map(([r,i])=>` ${r}: ${i};`).join(`
2
2
  `),a=n?`
3
3
  font-family: ${n};
4
4
  color: var(--ink);`:"";return`${e} {
5
5
  ${s}${a}
6
6
  }
7
- `}const je={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ne.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...je});function Wo({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}const sr=h.createContext("default");function xn(){return h.useContext(sr)}function qo(e){return xn()==="touch"?"lg":e}function Go({density:e,children:n}){return t.jsx(sr.Provider,{value:e,children:n})}function Ko(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(s[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=a[l]&&a[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const ar=Object.freeze({left:0,top:0,width:16,height:16}),sn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),us=Object.freeze({...ar,...sn}),qn=Object.freeze({...us,body:"",hidden:!1});function Yo(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function Xs(e,n){const s=Yo(e,n);for(const a in qn)a in sn?a in e&&!(a in s)&&(s[a]=sn[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function Qo(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=Xs(a[o]||r[o],i)}return l(n),s.forEach(l),Xs(e,i)}function rr(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=Ko(e);for(const r in a){const i=a[r];i&&(n(r,Qo(e,r,i)),s.push(r))}return s}const Zo={provider:"",aliases:{},not_found:{},...ar};function kn(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function ir(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!kn(e,Zo))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!kn(i,qn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],l=i.parent;if(!r||typeof l!="string"||!s[l]&&!a[l]||!kn(i,qn))return null}return n}const Js=Object.create(null);function Xo(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function jt(e,n){const s=Js[e]||(Js[e]=Object.create(null));return s[n]||(s[n]=Xo(e,n))}function lr(e,n){return ir(n)?rr(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Jo(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const or=/^[a-z0-9]+(-[a-z0-9]+)*$/,hn=(e,n,s,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 o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:o};return n&&!Xt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:a,prefix:l.shift(),name:l.join("-")};return n&&!Xt(o)?null:o}if(s&&a===""){const o={provider:a,prefix:"",name:i};return n&&!Xt(o,s)?null:o}return null},Xt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let Tt=!1;function cr(e){return typeof e=="boolean"&&(Tt=e),Tt}function ea(e){const n=typeof e=="string"?hn(e,!0,Tt):e;if(n){const s=jt(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function ec(e,n){const s=hn(e,!0,Tt);if(!s)return!1;const a=jt(s.provider,s.prefix);return n?Jo(a,s.name,n):(a.missing.add(s.name),!0)}function tc(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),Tt&&!n&&!e.prefix){let r=!1;return ir(e)&&(e.prefix="",rr(e,(i,l)=>{ec(i,l)&&(r=!0)})),r}const s=e.prefix;if(!Xt({prefix:s,name:"a"}))return!1;const a=jt(n,s);return!!lr(a,e)}const dr=Object.freeze({width:null,height:null}),ur=Object.freeze({...dr,...sn}),nc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,sc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ta(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(nc);if(a===null||!a.length)return e;const r=[];let i=a.shift(),l=sc.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");l=!l}}function ac(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(l+1)}return{defs:s,content:e}}function rc(e,n){return e?"<defs>"+e+"</defs>"+n:n}function ic(e,n,s){const a=ac(e);return rc(a.defs,n+a.content+s)}const lc=e=>e==="unset"||e==="undefined"||e==="none";function oc(e,n){const s={...us,...e},a={...ur,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const g=[],w=y.hFlip,N=y.vFlip;let D=y.rotate;w?N?D+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):N&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let j;switch(D<0&&(D-=Math.floor(D/4)*4),D=D%4,D){case 1:j=r.height/2+r.top,g.unshift("rotate(90 "+j.toString()+" "+j.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:j=r.width/2+r.left,g.unshift("rotate(-90 "+j.toString()+" "+j.toString()+")");break}D%2===1&&(r.left!==r.top&&(j=r.left,r.left=r.top,r.top=j),r.width!==r.height&&(j=r.width,r.width=r.height,r.height=j)),g.length&&(i=ic(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const l=a.width,o=a.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=ta(m,d/u)):(f=l==="auto"?d:l,m=o===null?ta(f,u/d):o==="auto"?u:o);const p={},x=(y,g)=>{lc(g)||(p[y]=g.toString())};x("width",f),x("height",m);const b=[r.left,r.top,d,u];return p.viewBox=b.join(" "),{attributes:p,viewBox:b,body:i}}const cc=/\sid="(\S+)"/g,dc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let uc=0;function mc(e,n=dc){const s=[];let a;for(;a=cc.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const l=typeof n=="function"?n(i):n+(uc++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const Gn=Object.create(null);function fc(e,n){Gn[e]=n}function Kn(e){return Gn[e]||Gn[""]}function ms(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,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 fs=Object.create(null),kt=["https://api.simplesvg.com","https://api.unisvg.com"],Jt=[];for(;kt.length>0;)kt.length===1||Math.random()>.5?Jt.push(kt.shift()):Jt.push(kt.pop());fs[""]=ms({resources:["https://api.iconify.design"].concat(Jt)});function xc(e,n){const s=ms(n);return s===null?!1:(fs[e]=s,!0)}function xs(e){return fs[e]}const hc=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let na=hc();function pc(e,n){const s=xs(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function gc(e){return e===404}const bc=(e,n,s)=>{const a=[],r=pc(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return s.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(a.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),a.push(l),a};function yc(e){if(typeof e=="string"){const n=xs(e);if(n)return n.path}return"/"}const vc=(e,n,s)=>{if(!na){s("abort",424);return}let a=yc(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;na(e+a).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{s(gc(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},jc={prepare:bc,send:vc};function mr(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function wc(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),l.pending.length!==o&&(s||mr([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Nc=0;function Cc(e,n,s){const a=Nc++,r=mr.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function kc(e){const n={loaded:[],missing:[],pending:[]},s=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,l=r.prefix,o=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[l]||(d[l]=jt(i,l));let f;o in u.icons?f=n.loaded:l===""||u.missing.has(o)?f=n.missing:f=n.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),n}function Sc(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?hn(r,n,s):r;i&&a.push(i)}),a}const $c={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ac(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let L=e.resources.slice(0);for(l=[];L.length>1;){const C=Math.floor(Math.random()*L.length);l.push(L[C]),L=L.slice(0,C).concat(L.slice(C+1))}l=l.concat(L)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,p=[],x=[];typeof a=="function"&&x.push(a);function b(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),b(),p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function g(L,C){C&&(x=[]),typeof L=="function"&&x.push(L)}function w(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:p.length,subscribe:g,abort:y}}function N(){d="failed",x.forEach(L=>{L(void 0,f)})}function D(){p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function j(L,C,$){const k=C!=="success";switch(p=p.filter(R=>R!==L),d){case"pending":break;case"failed":if(k||!e.dataAfterTimeout)return;break;default:return}if(C==="abort"){f=$,N();return}if(k){f=$,p.length||(l.length?S():N());return}if(b(),D(),!e.random){const R=e.resources.indexOf(L.resource);R!==-1&&R!==e.index&&(e.index=R)}d="completed",x.forEach(R=>{R($)})}function S(){if(d!=="pending")return;b();const L=l.shift();if(L===void 0){if(p.length){m=setTimeout(()=>{b(),d==="pending"&&(D(),N())},e.timeout);return}N();return}const C={status:"pending",resource:L,callback:($,k)=>{j(C,$,k)}};p.push(C),u++,m=setTimeout(S,e.rotate),s(L,n,C.callback)}return setTimeout(S),w}function fr(e){const n={...$c,...e};let s=[];function a(){s=s.filter(o=>o().status==="pending")}function r(o,d,u){const f=Ac(n,o,d,(m,p)=>{a(),u&&u(m,p)});return s.push(f),f}function i(o){return s.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:a}}function sa(){}const Sn=Object.create(null);function Dc(e){if(!Sn[e]){const n=xs(e);if(!n)return;const s=fr(n),a={config:n,redundancy:s};Sn[e]=a}return Sn[e]}function Ec(e,n,s){let a,r;if(typeof e=="string"){const i=Kn(e);if(!i)return s(void 0,424),sa;r=i.send;const l=Dc(e);l&&(a=l.redundancy)}else{const i=ms(e);if(i){a=fr(i);const l=e.resources?e.resources[0]:"",o=Kn(l);o&&(r=o.send)}}return!a||!r?(s(void 0,424),sa):a.query(n,r,s)().abort}function aa(){}function Fc(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,wc(e)}))}function Lc(e){const n=[],s=[];return e.forEach(a=>{(a.match(or)?n:s).push(a)}),{valid:n,invalid:s}}function St(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!lr(e,s).length){a();return}}catch(r){console.error(r)}a(),Fc(e)}function ra(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Mc(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,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,s),f=>{St(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);ra(m,p=>{const x=p?{prefix:a,icons:{[f]:p}}:null;St(e,[f],x)})});return}const{valid:l,invalid:o}=Lc(r);if(o.length&&St(e,o,null),!l.length)return;const d=a.match(or)?Kn(s):null;if(!d){St(e,l,null);return}d.prepare(s,a,l).forEach(f=>{Ec(s,f,m=>{St(e,f.icons,m)})})}))}const Rc=(e,n)=>{const s=Sc(e,!0,cr()),a=kc(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,aa)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(jt(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,p=jt(u,f),x=p.pendingIcons||(p.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Mc(d,u)}),n?Cc(n,a,i):aa};function _c(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in dr?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Pc=/[\s,]+/;function Tc(e,n){n.split(Pc).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Ic(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function Oc(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function zc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Bc(e){return"data:image/svg+xml,"+zc(e)}function Vc(e){return'url("'+Bc(e)+'")'}let Rt;function Uc(){try{Rt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Rt=null}}function Hc(e){return Rt===void 0&&Uc(),Rt?Rt.createHTML(e):e}const xr={...ur,inline:!1},Wc={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},qc={display:"inline-block"},Yn={backgroundColor:"currentColor"},hr={backgroundColor:"transparent"},ia={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},la={WebkitMask:Yn,mask:Yn,background:hr};for(const e in la){const n=la[e];for(const s in ia)n[e+s]=ia[s]}const Gc={...xr,inline:!0};function oa(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Kc=(e,n,s)=>{const a=n.inline?Gc:xr,r=_c(a,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?Wc:{}};if(s){const g=hn(s,!1,!0);if(g){const w=["iconify"],N=["provider","prefix"];for(const D of N)g[D]&&w.push("iconify--"+g[D]);d.className=w.join(" ")}}for(let g in n){const w=n[g];if(w!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[g]=(d[g]?d[g]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[g]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&Tc(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[g]=Ic(w):typeof w=="number"&&(r[g]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:a[g]===void 0&&(d[g]=w)}}const u=oc(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let g=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Hc(mc(u.body,w?()=>w+"ID"+g++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:x}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=Oc(m,{...f,width:p+"",height:x+""});return d.style={...l,"--svg":Vc(y),width:oa(f.width),height:oa(f.height),...qc,...b?Yn:hr,...o},h.createElement("span",d)};cr(!0);fc("",jc);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!tc(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;xc(s,r)||console.error(a)}catch{console.error(a)}}}}function pr(e){const[n,s]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(x){if(x){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const y=ea(b);if(y)return{name:b,data:y}}return{name:""}}const[l,o]=h.useState(i(!!e.ssr));function d(){const x=a.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(l)!==JSON.stringify(x))return d(),o(x),!0}function f(){var x;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const y=ea(b);if(u({name:b,data:y}))if(y===void 0){const g=Rc([b],f);r({callback:g})}else y&&((x=e.onLoad)===null||x===void 0||x.call(e,b))}h.useEffect(()=>(s(!0),d),[]),h.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:p}=l;return p?Kc({...us,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const I=h.forwardRef((e,n)=>pr({...e,_ref:n}));h.forwardRef((e,n)=>pr({inline:!0,...e,_ref:n}));const O=h.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));O.displayName="Button";function gr({code:e,amount:n,onRemove:s,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:n})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(I,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function $n(e,n){return e-n*Math.floor(e/n)}const br=1721426;function qt(e,n,s,a){n=hs(e,n);let r=n-1,i=-2;return s<=2?i=0:en(n)&&(i=-1),br-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function en(e){return e%4===0&&(e%100!==0||e%400===0)}function hs(e,n){return e==="BC"?1-n:n}function Yc(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const Qc={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 pn{fromJulianDay(n){let s=n,a=s-br,r=Math.floor(a/146097),i=$n(a,146097),l=Math.floor(i/36524),o=$n(i,36524),d=Math.floor(o/1461),u=$n(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[p,x]=Yc(m),b=s-qt(p,x,1,1),y=2;s<qt(p,x,3,1)?y=0:en(x)&&(y=1);let g=Math.floor(((b+y)*12+373)/367),w=s-qt(p,x,g,1)+1;return new It(p,x,g,w)}toJulianDay(n){return qt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return Qc[en(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return en(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function Zc(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function yr(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function vr(e,n){return ca(e)-ca(n)}function ca(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let An=null;function jr(){return An==null&&(An=new Intl.DateTimeFormat().resolvedOptions().timeZone),An}function da(e){e=ps(e,new pn);let n=hs(e.era,e.year);return wr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function wr(e,n,s,a,r,i,l){let o=new Date;return o.setUTCHours(a,r,i,l),o.setUTCFullYear(e,n-1,s),o.getTime()}function ua(e,n){if(n==="UTC")return 0;if(e>0&&n===jr())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:l,second:o}=Nr(e,n);return wr(s,a,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const ma=new Map;function Nr(e,n){let s=ma.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ma.set(n,s));let a=s.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 fa=864e5;function Xc(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>Jc(e,n,i))}function Jc(e,n,s){let a=Nr(s,n);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 ed(e,n,s="compatible"){let a=kr(e);if(n==="UTC")return da(a);if(n===jr()&&s==="compatible"){a=ps(a,new pn);let d=new Date,u=hs(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=da(a),i=ua(r-fa,n),l=ua(r+fa,n),o=Xc(a,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(s){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function Cr(e,n,s="compatible"){return new Date(ed(e,n,s))}function kr(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new an(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function ps(e,n){if(Zc(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,wt(a),a}function gs(e,n){let s=e.copy(),a="hour"in s?Lr(s,n):0;Qn(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,Zn(s),Sr(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,td(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,l;let d=(i=(l=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let o=s.calendar.getMonthsInYear(s);return s.month>o&&(s.month=o,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function Qn(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function Zn(e){for(;e.month<1;)Qn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,Qn(e,1)}function td(e){for(;e.day<1;)e.month--,Zn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Zn(e)}function Sr(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 wt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Sr(e)}function $r(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function Ar(e,n){return gs(e,$r(n))}function Dr(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),wt(s),s}function Er(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),Fr(s),s}function nd(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Gt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Gt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Gt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=Gt(e.hour,24),n}function Fr(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 Gt(e,n){let s=e%n;return s<0&&(s+=n),s}function Lr(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,nd(e)}function Mr(e,n){let s=e.copy();return Lr(s,n),s}function sd(e,n){return Mr(e,$r(n))}function Rr(e,n,s,a){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=rt(d,s,0,o.length-1,a?.round),r.era=o[d],wt(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(s=-s),r.year=rt(e.year,s,-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=rt(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=rt(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),wt(r),r}function _r(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(a?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=rt(i,s,l,o,a?.round);break}case"minute":r.minute=rt(e.minute,s,0,59,a?.round);break;case"second":r.second=rt(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=rt(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function rt(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const ad=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,rd=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function id(e){let n=e.match(ad);if(!n)throw rd.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new It(Dn(n[1],0,9999),Dn(n[2],1,12),1);return s.day=Dn(n[3],1,s.calendar.getDaysInMonth(s)),s}function Dn(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function Pr(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 Tr(e){let n=ps(e,new pn),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function ld(e){return`${Tr(e)}T${Pr(e)}`}function od(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function bs(e,n,s){od(e,n),n.set(e,s)}function Ir(e){let n=typeof e[0]=="object"?e.shift():new pn,s;if(typeof e[0]=="string")s=e.shift();else{let l=n.getEras();s=l[l.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var cd=new WeakMap;class It{copy(){return this.era?new It(this.calendar,this.era,this.year,this.month,this.day):new It(this.calendar,this.year,this.month,this.day)}add(n){return gs(this,n)}subtract(n){return Ar(this,n)}set(n){return Dr(this,n)}cycle(n,s,a){return Rr(this,n,s,a)}toDate(n){return Cr(this,n)}toString(){return Tr(this)}compare(n){return yr(this,n)}constructor(...n){bs(this,cd,{writable:!0,value:void 0});let[s,a,r,i,l]=Ir(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,wt(this)}}var dd=new WeakMap;class gn{copy(){return new gn(this.hour,this.minute,this.second,this.millisecond)}add(n){return Mr(this,n)}subtract(n){return sd(this,n)}set(n){return Er(this,n)}cycle(n,s,a){return _r(this,n,s,a)}toString(){return Pr(this)}compare(n){return vr(this,n)}constructor(n=0,s=0,a=0,r=0){bs(this,dd,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,Fr(this)}}var ud=new WeakMap;class an{copy(){return this.era?new an(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new an(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return gs(this,n)}subtract(n){return Ar(this,n)}set(n){return Dr(Er(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Rr(this,n,s,a);default:return _r(this,n,s,a)}}toDate(n,s){return Cr(this,n,s)}toString(){return ld(this)}compare(n){let s=yr(this,n);return s===0?vr(this,kr(n)):s}constructor(...n){bs(this,ud,{writable:!0,value:void 0});let[s,a,r,i,l]=Ir(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,wt(this)}}const md="Open time options",fd=320;function xa(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function En(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new gn(n,s,a)}function xd(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function hd(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new gn(s,a));return n}function pd(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=md,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[p,x]=h.useState(()=>En(d)),b=m?En(o):p,y=h.useMemo(()=>hd(n),[n]),g=N=>{m||x(N),l?.(N)},w=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:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(N=>{const D=b?.hour===N.hour&&b?.minute===N.minute;return t.jsx(c.Button,{variant:D?"flat":"light",color:D?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(N),children:xd(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>g(En(N))})}function ys(e){if(e.mode==="time")return t.jsx(pd,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=fd,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:xa("min-w-[20rem]",u?.popoverContent),calendarContent:xa("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function gd(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const He=h.forwardRef(({popoverProps:e,...n},s)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":l,...o}=e??{},d=l==="true"||l===void 0&&r!==void 0,u={...o,disableDialogFocus:o.disableDialogFocus??(r?!0:void 0),portalContainer:o.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(gd(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:u})})});He.displayName="Select";function bd({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=h.useState(""),p=h.useId(),[x,b]=h.useState(e);e!==x&&(b(e),e==="applied"&&m(""));const y=()=>{const N=f.trim();N&&n(N)},g=N=>{N.key==="Enter"&&(N.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(gr,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const w=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:l,value:f,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?p:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:o})]}),w&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const yd={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function vd({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(He,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},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(He,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},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 jd({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(O,{"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:s,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(O,{"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:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function wd({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...yd,...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",f),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:[(o||n.length>0)&&t.jsx(vd,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(jd,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Nd(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 Fn;const Cd=typeof document<"u"?(Fn=h.useInsertionEffect)!==null&&Fn!==void 0?Fn:h.useLayoutEffect:()=>{};function bn(e,n,s){let[a,r]=h.useState(e||n),i=h.useRef(a),l=h.useRef(e!==void 0),o=e!==void 0;h.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:a;Cd(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),f=h.useCallback((m,...p)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),s?.(x,...p))},[s]);return[d,f]}function Or(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ee.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 zr=h.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:p,currentStep:x,hideProgressBars:b=!1,stepClassName:y,className:g,isDisabled:w=!1,...N},D)=>{const[j,S]=bn(x,a,p),L=h.useMemo(()=>{let C,$;const k=["[--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":C="[--step-color:var(--heroui-primary)]",$="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":C="[--step-color:var(--heroui-secondary)]",$="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":C="[--step-color:var(--heroui-success)]",$="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":C="[--step-color:var(--heroui-warning)]",$="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":C="[--step-color:var(--heroui-danger)]",$="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":C="[--step-color:var(--heroui-default)]",$="[--step-fg-color:var(--heroui-default-foreground)]";break;default:C="[--step-color:var(--heroui-primary)]",$="[--step-fg-color:var(--heroui-primary-foreground)]";break}return k.unshift($),k.unshift(C),k},[e]);return t.jsxs("nav",{ref:D,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"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(j+1,s):`Step ${j+1} of ${s}`}):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",L,g),"data-testid":"stepper-list",children:Array.from({length:s})?.map((C,$)=>{const k=j===$?"active":j<$?"inactive":"complete",R=n==="activeLabel"&&k==="active"&&!!i?.[$],F=l&&k!=="active"&&!!i?.[$];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${$}`,children:[t.jsx(c.Tooltip,{content:F?i?.[$]:void 0,isDisabled:!F,offset:12,placement:o,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":k==="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":R},{"cursor-not-allowed opacity-50":w},y),onClick:()=>!w&&S($),disabled:w,"data-testid":`stepper-step-btn-${$}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ee.LazyMotion,{features:Ee.domAnimation,children:t.jsx(Ee.m.div,{animate:k,className:"relative z-10",children:t.jsx(Ee.m.div,{animate:k,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)":R,"bg-(--complete-background-color)":k==="complete","shadow-lg":k==="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:k==="complete"&&n==="default"?t.jsx(Or,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${$}`}):t.jsx("span",{children:$+1})})})})})}),R?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${$}`,children:i[$]}):null]},$)}),$<s-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":$},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":$<j})})})]},$)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(j+1,s):`Step ${j+1} of ${s}`}):null]})});zr.displayName="Stepper";function kd(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 he(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function zt(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function vs(e,n,s="en-US"){const a=zt(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function Xn(e,n,s,a){return vs(e-n,s,a)}const ha={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))"}},Sd="rgb(156 163 175)",$d="rgb(107 114 128)",Br=h.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Sd,inactiveLabelColor:f=$d,activeStepVariant:m="bordered",stepClassName:p,circleClassName:x,progressBarClassName:b,labelsClassName:y,labelSlotClassName:g,activeLabelClassName:w,inactiveLabelClassName:N,className:D,ariaLabel:j="Progress",invalidLabelSuffix:S=", has errors",testId:L,isStepReachable:C,...$},k){const[R,F]=bn(i,a,r),E=ha[n]??ha.primary,_=o??E.active,T=d??E.fg,q=(Y,z)=>{const G=Y.ariaLabel??(typeof Y.title=="string"?Y.title:null)??`${z+1}`;return Y.invalid?`${G}${S}`:G};return t.jsxs("nav",{...$,"aria-label":j,...L?{"data-testid":L}:{},children:[t.jsx("div",{className:c.cn("flex items-center",D),children:s?.map((Y,z)=>{const ne=z===R?"active":z<R?"complete":"inactive",G=C?C(z):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:k,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${L??"horizontal-steps"}-step-${z}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":Y.describedBy,"aria-label":q(Y,z),"data-invalid":Y.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",Y.className,p),onPress:()=>{if(i===void 0){F(z);return}r?.(z)},children:t.jsx(Ee.LazyMotion,{features:Ee.domAnimation,children:t.jsx(Ee.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?_:"transparent",borderColor:_,borderWidth:"1.5px",color:m==="solid"?T:_},complete:{backgroundColor:_,borderColor:_,borderWidth:"1.5px",color:_}},children:ne==="complete"?t.jsx(Or,{className:"size-4",style:{color:T}}):t.jsx("span",{children:z+1})})})}),z<s.length-1&&!l&&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",b),style:{backgroundColor:z<R?_:u}})]},z)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((Y,z)=>{const ne=z<=R;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",g),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?w:N),style:{color:ne?_:f},children:Y.title})}),z<s.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},z)})})]})});Br.displayName="HorizontalSteps";function Ad(){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 Dd=e=>{const n=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Ed,{...e},n)},Ed=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,l]=h.useState([]),[o,d]=h.useState([]),[u,f]=h.useState(null),[m,p]=h.useState(null),x=h.useMemo(()=>new Set(n),[n]),b=h.useMemo(()=>new Set(e),[e]),y=h.useMemo(()=>e.filter(F=>!x.has(F)),[e,x]),g=F=>{if(F.length===0)return;const E=Array.from(new Set([...n,...F]));s(E)},w=F=>{if(F.length===0)return;const E=new Set(F);s(n.filter(_=>!E.has(_)))},N=()=>{i.length!==0&&(g(i),l([]))},D=()=>{o.length!==0&&(w(o),d([]))},j=()=>{y.length!==0&&(g(y),l([]))},S=()=>{n.length!==0&&(s([]),d([]))},L=(F,E,_)=>{const T=Math.min(E,_),q=Math.max(E,_);return F.slice(T,q+1)},C=(F,E,_)=>{if(_&&u!==null){l(L(y,u,E)),d([]),f(E);return}const T=i.includes(F);l(T?i.filter(q=>q!==F):[...i,F]),d([]),f(E)},$=(F,E,_)=>{if(_&&m!==null){d(L(n,m,E)),l([]),p(E);return}const T=o.includes(F);d(T?o.filter(q=>q!==F):[...o,F]),l([]),p(E)},k=(F,E,_)=>{const T=_==="available"?i.includes(E)?i:[E]:o.includes(E)?o:[E];F.dataTransfer.setData("text/plain",JSON.stringify({source:_,items:T})),F.dataTransfer.effectAllowed="move"},R=(F,E)=>{F.preventDefault();const _=F.dataTransfer.getData("text/plain");if(_)try{const T=JSON.parse(_),q=(T.items||[]).filter(Y=>b.has(Y));if(q.length===0||T.source===E)return;E==="selected"?(g(q),l([])):(w(q),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=>R(F,"available"),children:y.map((F,E)=>{const _=i.includes(F);return t.jsx("button",{type:"button",onClick:T=>{C(F,E,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>k(T,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"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(O,{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(O,{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:D,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(O,{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:j,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:S,"data-testid":"move-all-to-available",isDisabled:n.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=>R(F,"selected"),children:n.map((F,E)=>{const _=o.includes(F);return t.jsx("button",{type:"button",onClick:T=>{$(F,E,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>k(T,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function Ot(e){return typeof e=="string"?e:e.type}function ot({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function dt({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const et={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:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,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:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.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:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.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"}},Fd={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Ld({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=et.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:n.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(X.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Fd[l]},l))})]})}const Ln={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function Md({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Ln[r].icon:X.List,l=o=>{const u=et[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:l,children:n.map(o=>{const d=Ln[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ln[o].label},o)})})]})}function Rd({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
7
+ `}const re={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ce.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...re});function rc({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}const mr=h.createContext("default");function bn(){return h.useContext(mr)}function ic(e){return bn()==="touch"?"lg":e}function lc({density:e,children:n}){return t.jsx(mr.Provider,{value:e,children:n})}function oc(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[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(s).concat(Object.keys(a)).forEach(i),r}const fr=Object.freeze({left:0,top:0,width:16,height:16}),on=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),bs=Object.freeze({...fr,...on}),Jn=Object.freeze({...bs,body:"",hidden:!1});function cc(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function ra(e,n){const s=cc(e,n);for(const a in Jn)a in on?a in e&&!(a in s)&&(s[a]=on[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function dc(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=ra(a[l]||r[l],i)}return o(n),s.forEach(o),ra(e,i)}function xr(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=oc(e);for(const r in a){const i=a[r];i&&(n(r,dc(e,r,i)),s.push(r))}return s}const uc={provider:"",aliases:{},not_found:{},...fr};function Fn(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function hr(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Fn(e,uc))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Fn(i,Jn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!Fn(i,Jn))return null}return n}const ia=Object.create(null);function mc(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Ct(e,n){const s=ia[e]||(ia[e]=Object.create(null));return s[n]||(s[n]=mc(e,n))}function pr(e,n){return hr(n)?xr(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function fc(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const gr=/^[a-z0-9]+(-[a-z0-9]+)*$/,yn=(e,n,s,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 n&&!nn(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 n&&!nn(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return n&&!nn(l,s)?null:l}return null},nn=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let Bt=!1;function br(e){return typeof e=="boolean"&&(Bt=e),Bt}function la(e){const n=typeof e=="string"?yn(e,!0,Bt):e;if(n){const s=Ct(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function xc(e,n){const s=yn(e,!0,Bt);if(!s)return!1;const a=Ct(s.provider,s.prefix);return n?fc(a,s.name,n):(a.missing.add(s.name),!0)}function hc(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),Bt&&!n&&!e.prefix){let r=!1;return hr(e)&&(e.prefix="",xr(e,(i,o)=>{xc(i,o)&&(r=!0)})),r}const s=e.prefix;if(!nn({prefix:s,name:"a"}))return!1;const a=Ct(n,s);return!!pr(a,e)}const yr=Object.freeze({width:null,height:null}),vr=Object.freeze({...yr,...on}),pc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,gc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function oa(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(pc);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=gc.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function bc(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function yc(e,n){return e?"<defs>"+e+"</defs>"+n:n}function vc(e,n,s){const a=bc(e);return yc(a.defs,n+a.content+s)}const jc=e=>e==="unset"||e==="undefined"||e==="none";function wc(e,n){const s={...bs,...e},a={...vr,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const b=[],w=y.hFlip,C=y.vFlip;let A=y.rotate;w?C?A+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):C&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let v;switch(A<0&&(A-=Math.floor(A/4)*4),A=A%4,A){case 1:v=r.height/2+r.top,b.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,b.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}A%2===1&&(r.left!==r.top&&(v=r.left,r.left=r.top,r.top=v),r.width!==r.height&&(v=r.width,r.width=r.height,r.height=v)),b.length&&(i=vc(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let f,m;o===null?(m=l===null?"1em":l==="auto"?u:l,f=oa(m,d/u)):(f=o==="auto"?d:o,m=l===null?oa(f,u/d):l==="auto"?u:l);const p={},x=(y,b)=>{jc(b)||(p[y]=b.toString())};x("width",f),x("height",m);const g=[r.left,r.top,d,u];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:i}}const Nc=/\sid="(\S+)"/g,Cc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let kc=0;function Sc(e,n=Cc){const s=[];let a;for(;a=Nc.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof n=="function"?n(i):n+(kc++).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 es=Object.create(null);function $c(e,n){es[e]=n}function ts(e){return es[e]||es[""]}function ys(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,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 vs=Object.create(null),Dt=["https://api.simplesvg.com","https://api.unisvg.com"],sn=[];for(;Dt.length>0;)Dt.length===1||Math.random()>.5?sn.push(Dt.shift()):sn.push(Dt.pop());vs[""]=ys({resources:["https://api.iconify.design"].concat(sn)});function Ac(e,n){const s=ys(n);return s===null?!1:(vs[e]=s,!0)}function js(e){return vs[e]}const Dc=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ca=Dc();function Ec(e,n){const s=js(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function Fc(e){return e===404}const Lc=(e,n,s)=>{const a=[],r=Ec(e,n),i="icons";let o={type:i,provider:e,prefix:n,icons:[]},l=0;return s.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:n,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Rc(e){if(typeof e=="string"){const n=js(e);if(n)return n.path}return"/"}const Mc=(e,n,s)=>{if(!ca){s("abort",424);return}let a=Rc(n.provider);switch(n.type){case"icons":{const i=n.prefix,l=n.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ca(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(Fc(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},_c={prepare:Lc,send:Mc};function jr(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Pc(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.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 s=!0,!0;return!1}),o.pending.length!==l&&(s||jr([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Tc=0;function Ic(e,n,s){const a=Tc++,r=jr.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Oc(e){const n={loaded:[],missing:[],pending:[]},s=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=s[i]||(s[i]=Object.create(null)),u=d[o]||(d[o]=Ct(i,o));let f;l in u.icons?f=n.loaded:o===""||u.missing.has(l)?f=n.missing:f=n.pending;const m={provider:i,prefix:o,name:l};f.push(m)}),n}function zc(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?yn(r,n,s):r;i&&a.push(i)}),a}const Bc={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Vc(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let L=e.resources.slice(0);for(o=[];L.length>1;){const N=Math.floor(Math.random()*L.length);o.push(L[N]),L=L.slice(0,N).concat(L.slice(N+1))}o=o.concat(L)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,f,m=null,p=[],x=[];typeof a=="function"&&x.push(a);function g(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),g(),p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function b(L,N){N&&(x=[]),typeof L=="function"&&x.push(L)}function w(){return{startTime:l,payload:n,status:d,queriesSent:u,queriesPending:p.length,subscribe:b,abort:y}}function C(){d="failed",x.forEach(L=>{L(void 0,f)})}function A(){p.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),p=[]}function v(L,N,$){const k=N!=="success";switch(p=p.filter(M=>M!==L),d){case"pending":break;case"failed":if(k||!e.dataAfterTimeout)return;break;default:return}if(N==="abort"){f=$,C();return}if(k){f=$,p.length||(o.length?S():C());return}if(g(),A(),!e.random){const M=e.resources.indexOf(L.resource);M!==-1&&M!==e.index&&(e.index=M)}d="completed",x.forEach(M=>{M($)})}function S(){if(d!=="pending")return;g();const L=o.shift();if(L===void 0){if(p.length){m=setTimeout(()=>{g(),d==="pending"&&(A(),C())},e.timeout);return}C();return}const N={status:"pending",resource:L,callback:($,k)=>{v(N,$,k)}};p.push(N),u++,m=setTimeout(S,e.rotate),s(L,n,N.callback)}return setTimeout(S),w}function wr(e){const n={...Bc,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,d,u){const f=Vc(n,l,d,(m,p)=>{a(),u&&u(m,p)});return s.push(f),f}function i(l){return s.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{n.index=l},getIndex:()=>n.index,cleanup:a}}function da(){}const Ln=Object.create(null);function Uc(e){if(!Ln[e]){const n=js(e);if(!n)return;const s=wr(n),a={config:n,redundancy:s};Ln[e]=a}return Ln[e]}function Hc(e,n,s){let a,r;if(typeof e=="string"){const i=ts(e);if(!i)return s(void 0,424),da;r=i.send;const o=Uc(e);o&&(a=o.redundancy)}else{const i=ys(e);if(i){a=wr(i);const o=e.resources?e.resources[0]:"",l=ts(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),da):a.query(n,r,s)().abort}function ua(){}function qc(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Pc(e)}))}function Wc(e){const n=[],s=[];return e.forEach(a=>{(a.match(gr)?n:s).push(a)}),{valid:n,invalid:s}}function Et(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!pr(e,s).length){a();return}}catch(r){console.error(r)}a(),qc(e)}function ma(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Gc(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,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)){ma(e.loadIcons(r,a,s),f=>{Et(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);ma(m,p=>{const x=p?{prefix:a,icons:{[f]:p}}:null;Et(e,[f],x)})});return}const{valid:o,invalid:l}=Wc(r);if(l.length&&Et(e,l,null),!o.length)return;const d=a.match(gr)?ts(s):null;if(!d){Et(e,o,null);return}d.prepare(s,a,o).forEach(f=>{Hc(s,f,m=>{Et(e,f.icons,m)})})}))}const Yc=(e,n)=>{const s=zc(e,!0,br()),a=Oc(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ua)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===l&&u===o)return;o=u,l=f,i.push(Ct(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,p=Ct(u,f),x=p.pendingIcons||(p.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Gc(d,u)}),n?Ic(n,a,i):ua};function Kc(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in yr?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Qc=/[\s,]+/;function Zc(e,n){n.split(Qc).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Xc(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function Jc(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function ed(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function td(e){return"data:image/svg+xml,"+ed(e)}function nd(e){return'url("'+td(e)+'")'}let It;function sd(){try{It=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{It=null}}function ad(e){return It===void 0&&sd(),It?It.createHTML(e):e}const Nr={...vr,inline:!1},rd={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},id={display:"inline-block"},ns={backgroundColor:"currentColor"},Cr={backgroundColor:"transparent"},fa={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},xa={WebkitMask:ns,mask:ns,background:Cr};for(const e in xa){const n=xa[e];for(const s in fa)n[e+s]=fa[s]}const ld={...Nr,inline:!0};function ha(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const od=(e,n,s)=>{const a=n.inline?ld:Nr,r=Kc(a,n),i=n.mode||"svg",o={},l=n.style||{},d={...i==="svg"?rd:{}};if(s){const b=yn(s,!1,!0);if(b){const w=["iconify"],C=["provider","prefix"];for(const A of C)b[A]&&w.push("iconify--"+b[A]);d.className=w.join(" ")}}for(let b in n){const w=n[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[b]=(d[b]?d[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&Zc(r,w);break;case"color":o.color=w;break;case"rotate":typeof w=="string"?r[b]=Xc(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=w)}}const u=wc(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,f);let b=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:ad(Sc(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:x}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=Jc(m,{...f,width:p+"",height:x+""});return d.style={...o,"--svg":nd(y),width:ha(f.width),height:ha(f.height),...id,...g?ns:Cr,...l},h.createElement("span",d)};br(!0);$c("",_c);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!hc(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;Ac(s,r)||console.error(a)}catch{console.error(a)}}}}function kr(e){const[n,s]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(x){if(x){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const y=la(g);if(y)return{name:g,data:y}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const x=a.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(o)!==JSON.stringify(x))return d(),l(x),!0}function f(){var x;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const y=la(g);if(u({name:g,data:y}))if(y===void 0){const b=Yc([g],f);r({callback:b})}else y&&((x=e.onLoad)===null||x===void 0||x.call(e,g))}h.useEffect(()=>(s(!0),d),[]),h.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:p}=o;return p?od({...bs,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const T=h.forwardRef((e,n)=>kr({...e,_ref:n}));h.forwardRef((e,n)=>kr({inline:!0,...e,_ref:n}));const O=h.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));O.displayName="Button";function Sr({code:e,amount:n,onRemove:s,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:n})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(T,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Rn(e,n){return e-n*Math.floor(e/n)}const $r=1721426;function Qt(e,n,s,a){n=ws(e,n);let r=n-1,i=-2;return s<=2?i=0:an(n)&&(i=-1),$r-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function an(e){return e%4===0&&(e%100!==0||e%400===0)}function ws(e,n){return e==="BC"?1-n:n}function cd(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const dd={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 vn{fromJulianDay(n){let s=n,a=s-$r,r=Math.floor(a/146097),i=Rn(a,146097),o=Math.floor(i/36524),l=Rn(i,36524),d=Math.floor(l/1461),u=Rn(l,1461),f=Math.floor(u/365),m=r*400+o*100+d*4+f+(o!==4&&f!==4?1:0),[p,x]=cd(m),g=s-Qt(p,x,1,1),y=2;s<Qt(p,x,3,1)?y=0:an(x)&&(y=1);let b=Math.floor(((g+y)*12+373)/367),w=s-Qt(p,x,b,1)+1;return new Vt(p,x,b,w)}toJulianDay(n){return Qt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return dd[an(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return an(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function ud(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function Ar(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function Dr(e,n){return pa(e)-pa(n)}function pa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Mn=null;function Er(){return Mn==null&&(Mn=new Intl.DateTimeFormat().resolvedOptions().timeZone),Mn}function ga(e){e=Ns(e,new vn);let n=ws(e.era,e.year);return Fr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Fr(e,n,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,n-1,s),l.getTime()}function ba(e,n){if(n==="UTC")return 0;if(e>0&&n===Er())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=Lr(e,n);return Fr(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const ya=new Map;function Lr(e,n){let s=ya.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ya.set(n,s));let a=s.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 va=864e5;function md(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>fd(e,n,i))}function fd(e,n,s){let a=Lr(s,n);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 xd(e,n,s="compatible"){let a=Mr(e);if(n==="UTC")return ga(a);if(n===Er()&&s==="compatible"){a=Ns(a,new vn);let d=new Date,u=ws(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=ga(a),i=ba(r-va,n),o=ba(r+va,n),l=md(a,n,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){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(s){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 Rr(e,n,s="compatible"){return new Date(xd(e,n,s))}function Mr(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new cn(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function Ns(e,n){if(ud(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,kt(a),a}function Cs(e,n){let s=e.copy(),a="hour"in s?Br(s,n):0;ss(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,as(s),_r(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,hd(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let d=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function ss(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function as(e){for(;e.month<1;)ss(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,ss(e,1)}function hd(e){for(;e.day<1;)e.month--,as(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,as(e)}function _r(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 kt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),_r(e)}function Pr(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function Tr(e,n){return Cs(e,Pr(n))}function Ir(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),kt(s),s}function Or(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),zr(s),s}function pd(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Zt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Zt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Zt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=Zt(e.hour,24),n}function zr(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 Zt(e,n){let s=e%n;return s<0&&(s+=n),s}function Br(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,pd(e)}function Vr(e,n){let s=e.copy();return Br(s,n),s}function gd(e,n){return Vr(e,Pr(n))}function Ur(e,n,s,a){let r=e.copy();switch(n){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=lt(d,s,0,l.length-1,a?.round),r.era=l[d],kt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(s=-s),r.year=lt(e.year,s,-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=lt(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=lt(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),kt(r),r}function Hr(e,n,s,a){let r=e.copy();switch(n){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=lt(i,s,o,l,a?.round);break}case"minute":r.minute=lt(e.minute,s,0,59,a?.round);break;case"second":r.second=lt(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=lt(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function lt(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const bd=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,yd=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function vd(e){let n=e.match(bd);if(!n)throw yd.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new Vt(_n(n[1],0,9999),_n(n[2],1,12),1);return s.day=_n(n[3],1,s.calendar.getDaysInMonth(s)),s}function _n(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function qr(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 Wr(e){let n=Ns(e,new vn),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function jd(e){return`${Wr(e)}T${qr(e)}`}function wd(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ks(e,n,s){wd(e,n),n.set(e,s)}function Gr(e){let n=typeof e[0]=="object"?e.shift():new vn,s;if(typeof e[0]=="string")s=e.shift();else{let o=n.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var Nd=new WeakMap;class Vt{copy(){return this.era?new Vt(this.calendar,this.era,this.year,this.month,this.day):new Vt(this.calendar,this.year,this.month,this.day)}add(n){return Cs(this,n)}subtract(n){return Tr(this,n)}set(n){return Ir(this,n)}cycle(n,s,a){return Ur(this,n,s,a)}toDate(n){return Rr(this,n)}toString(){return Wr(this)}compare(n){return Ar(this,n)}constructor(...n){ks(this,Nd,{writable:!0,value:void 0});let[s,a,r,i,o]=Gr(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,kt(this)}}var Cd=new WeakMap;class jn{copy(){return new jn(this.hour,this.minute,this.second,this.millisecond)}add(n){return Vr(this,n)}subtract(n){return gd(this,n)}set(n){return Or(this,n)}cycle(n,s,a){return Hr(this,n,s,a)}toString(){return qr(this)}compare(n){return Dr(this,n)}constructor(n=0,s=0,a=0,r=0){ks(this,Cd,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,zr(this)}}var kd=new WeakMap;class cn{copy(){return this.era?new cn(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new cn(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return Cs(this,n)}subtract(n){return Tr(this,n)}set(n){return Ir(Or(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Ur(this,n,s,a);default:return Hr(this,n,s,a)}}toDate(n,s){return Rr(this,n,s)}toString(){return jd(this)}compare(n){let s=Ar(this,n);return s===0?Dr(this,Mr(n)):s}constructor(...n){ks(this,kd,{writable:!0,value:void 0});let[s,a,r,i,o]=Gr(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,kt(this)}}const Sd="Open time options",$d=320;function ja(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Pn(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new jn(n,s,a)}function Ad(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function Dd(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new jn(s,a));return n}function Ed(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=Sd,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...f}=e,m=l!==void 0,[p,x]=h.useState(()=>Pn(d)),g=m?Pn(l):p,y=h.useMemo(()=>Dd(n),[n]),b=C=>{m||x(C),o?.(C)},w=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:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(C=>{const A=g?.hour===C.hour&&g?.minute===C.minute;return t.jsx(c.Button,{variant:A?"flat":"light",color:A?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(C),children:Ad(C,u)},`${C.hour}:${C.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:C=>b(Pn(C))})}function Ss(e){if(e.mode==="time")return t.jsx(Ed,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=$d,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:ja("min-w-[20rem]",u?.popoverContent),calendarContent:ja("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function Fd(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Ge=h.forwardRef(({popoverProps:e,...n},s)=>{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(Fd(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:u})})});Ge.displayName="Select";function Ld({state:e,onSubmit:n,onRemove:s,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[f,m]=h.useState(""),p=h.useId(),[x,g]=h.useState(e);e!==x&&(g(e),e==="applied"&&m(""));const y=()=>{const C=f.trim();C&&n(C)},b=C=>{C.key==="Enter"&&(C.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(Sr,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const w=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:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?p:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:l})]}),w&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Rd={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Md({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Ge,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(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(Ge,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(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 _d({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(O,{"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:s,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(O,{"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:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Pd({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:f}){const m={...Rd,...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",f),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||n.length>0)&&t.jsx(Md,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(_d,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function Td(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 Tn;const Id=typeof document<"u"?(Tn=h.useInsertionEffect)!==null&&Tn!==void 0?Tn:h.useLayoutEffect:()=>{};function wn(e,n,s){let[a,r]=h.useState(e||n),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;Id(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),f=h.useCallback((m,...p)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),s?.(x,...p))},[s]);return[d,f]}function Yr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Fe.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 Kr=h.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:p,currentStep:x,hideProgressBars:g=!1,stepClassName:y,className:b,isDisabled:w=!1,...C},A)=>{const[v,S]=wn(x,a,p),L=h.useMemo(()=>{let N,$;const k=["[--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":N="[--step-color:var(--heroui-primary)]",$="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":N="[--step-color:var(--heroui-secondary)]",$="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":N="[--step-color:var(--heroui-success)]",$="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":N="[--step-color:var(--heroui-warning)]",$="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":N="[--step-color:var(--heroui-danger)]",$="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":N="[--step-color:var(--heroui-default)]",$="[--step-fg-color:var(--heroui-default-foreground)]";break;default:N="[--step-color:var(--heroui-primary)]",$="[--step-fg-color:var(--heroui-primary-foreground)]";break}return k.unshift($),k.unshift(N),k},[e]);return t.jsxs("nav",{ref:A,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...C,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,s):`Step ${v+1} of ${s}`}):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",L,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((N,$)=>{const k=v===$?"active":v<$?"inactive":"complete",M=n==="activeLabel"&&k==="active"&&!!i?.[$],F=o&&k!=="active"&&!!i?.[$];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${$}`,children:[t.jsx(c.Tooltip,{content:F?i?.[$]: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":k==="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":M},{"cursor-not-allowed opacity-50":w},y),onClick:()=>!w&&S($),disabled:w,"data-testid":`stepper-step-btn-${$}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Fe.LazyMotion,{features:Fe.domAnimation,children:t.jsx(Fe.m.div,{animate:k,className:"relative z-10",children:t.jsx(Fe.m.div,{animate:k,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)":M,"bg-(--complete-background-color)":k==="complete","shadow-lg":k==="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:k==="complete"&&n==="default"?t.jsx(Yr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${$}`}):t.jsx("span",{children:$+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${$}`,children:i[$]}):null]},$)}),$<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":$},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":$<v})})})]},$)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,s):`Step ${v+1} of ${s}`}):null]})});Kr.displayName="Stepper";function Od(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,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function St(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function $s(e,n,s="en-US"){const a=St(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function rs(e,n,s,a){return $s(e-n,s,a)}const wa={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))"}},zd="rgb(156 163 175)",Bd="rgb(107 114 128)",Qr=h.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=zd,inactiveLabelColor:f=Bd,activeStepVariant:m="bordered",stepClassName:p,circleClassName:x,progressBarClassName:g,labelsClassName:y,labelSlotClassName:b,activeLabelClassName:w,inactiveLabelClassName:C,className:A,ariaLabel:v="Progress",invalidLabelSuffix:S=", has errors",testId:L,isStepReachable:N,...$},k){const[M,F]=wn(i,a,r),E=wa[n]??wa.primary,_=l??E.active,I=d??E.fg,W=(K,z)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${z+1}`;return K.invalid?`${G}${S}`:G};return t.jsxs("nav",{...$,"aria-label":v,...L?{"data-testid":L}:{},children:[t.jsx("div",{className:c.cn("flex items-center",A),children:s?.map((K,z)=>{const ne=z===M?"active":z<M?"complete":"inactive",G=N?N(z):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:k,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${L??"horizontal-steps"}-step-${z}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":W(K,z),"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(z);return}r?.(z)},children:t.jsx(Fe.LazyMotion,{features:Fe.domAnimation,children:t.jsx(Fe.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?_:"transparent",borderColor:_,borderWidth:"1.5px",color:m==="solid"?I:_},complete:{backgroundColor:_,borderColor:_,borderWidth:"1.5px",color:_}},children:ne==="complete"?t.jsx(Yr,{className:"size-4",style:{color:I}}):t.jsx("span",{children:z+1})})})}),z<s.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:z<M?_:u}})]},z)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((K,z)=>{const ne=z<=M;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?w:C),style:{color:ne?_:f},children:K.title})}),z<s.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)})]},z)})})]})});Qr.displayName="HorizontalSteps";function Vd(){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 Ud=e=>{const n=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Hd,{...e},n)},Hd=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,f]=h.useState(null),[m,p]=h.useState(null),x=h.useMemo(()=>new Set(n),[n]),g=h.useMemo(()=>new Set(e),[e]),y=h.useMemo(()=>e.filter(F=>!x.has(F)),[e,x]),b=F=>{if(F.length===0)return;const E=Array.from(new Set([...n,...F]));s(E)},w=F=>{if(F.length===0)return;const E=new Set(F);s(n.filter(_=>!E.has(_)))},C=()=>{i.length!==0&&(b(i),o([]))},A=()=>{l.length!==0&&(w(l),d([]))},v=()=>{y.length!==0&&(b(y),o([]))},S=()=>{n.length!==0&&(s([]),d([]))},L=(F,E,_)=>{const I=Math.min(E,_),W=Math.max(E,_);return F.slice(I,W+1)},N=(F,E,_)=>{if(_&&u!==null){o(L(y,u,E)),d([]),f(E);return}const I=i.includes(F);o(I?i.filter(W=>W!==F):[...i,F]),d([]),f(E)},$=(F,E,_)=>{if(_&&m!==null){d(L(n,m,E)),o([]),p(E);return}const I=l.includes(F);d(I?l.filter(W=>W!==F):[...l,F]),o([]),p(E)},k=(F,E,_)=>{const I=_==="available"?i.includes(E)?i:[E]:l.includes(E)?l:[E];F.dataTransfer.setData("text/plain",JSON.stringify({source:_,items:I})),F.dataTransfer.effectAllowed="move"},M=(F,E)=>{F.preventDefault();const _=F.dataTransfer.getData("text/plain");if(_)try{const I=JSON.parse(_),W=(I.items||[]).filter(K=>g.has(K));if(W.length===0||I.source===E)return;E==="selected"?(b(W),o([])):(w(W),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=>M(F,"available"),children:y.map((F,E)=>{const _=i.includes(F);return t.jsx("button",{type:"button",onClick:I=>{N(F,E,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>k(I,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"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(O,{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:C,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(O,{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:A,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(O,{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:v,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:S,"data-testid":"move-all-to-available",isDisabled:n.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=>M(F,"selected"),children:n.map((F,E)=>{const _=l.includes(F);return t.jsx("button",{type:"button",onClick:I=>{$(F,E,I.shiftKey)},onMouseDown:I=>{I.shiftKey&&I.preventDefault()},draggable:!0,onDragStart:I=>k(I,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function Ut(e){return typeof e=="string"?e:e.type}function dt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function mt({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:l,children:t.jsx(e,{size:o})})})}const nt={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:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,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:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.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:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.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"}},qd={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Wd({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!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=n.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=nt.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(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:n.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:qd[o]},o))})]})}const In={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function Gd({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!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=n.find(l=>e.isActive(l)),i=r?In[r].icon:X.List,o=l=>{const u=nt[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:n.map(l=>{const d=In[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:In[l].label},l)})})]})}function Yd({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(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 _d=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Pd=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Mn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ke={min:50,max:200,step:10,default:100},pa={lineHeight:24,toolbarHeight:60},Td={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},Id={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function yt(e){return Td[e]}function Od({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=h.useState(""),l=u=>{const f=u.target.value;n(f),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Mn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};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:l,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:Mn(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Mn(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 ga({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,l]=h.useState(!1),[o,d]=h.useState(""),u=n==="textColor"?_d:Pd,f=y=>{const g=et[n];g&&g.execute({editor:e,config:{type:n,color:y}}),l(!1),d("")},m=y=>{f(y)},p=()=>{const y=et[n];y&&y.execute({editor:e,config:{type:n,color:""}}),l(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=n==="textColor"?X.Palette:X.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{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(O,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(Rd,{colors:u,onColorSelect:f}),s&&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(Od,{value:o,onChange:d,onApply:m})]})]})]})})]})}function zd({zoom:e,onZoomChange:n,min:s=ke.min,max:a=ke.max,step:r=ke.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},l=()=>{const m=Math.min(a,e+r);n(m)},o=()=>{n(ke.default)},d=e<=s,u=e>=a,f=e===ke.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(O,{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:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Kd=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Qd=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function On(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Se={min:50,max:200,step:10,default:100},Na={lineHeight:24,toolbarHeight:60},Zd={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},Xd={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function wt(e){return Zd[e]}function Jd({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const f=u.target.value;n(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!On(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(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:On(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!On(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 Ca({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=n==="textColor"?Kd:Qd,f=y=>{const b=nt[n];b&&b.execute({editor:e,config:{type:n,color:y}}),o(!1),d("")},m=y=>{f(y)},p=()=>{const y=nt[n];y&&y.execute({editor:e,config:{type:n,color:""}}),o(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=n==="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(O,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"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(O,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(Yd,{colors:u,onColorSelect:f}),s&&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(Jd,{value:l,onChange:d,onApply:m})]})]})]})})]})}function eu({zoom:e,onZoomChange:n,min:s=Se.min,max:a=Se.max,step:r=Se.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},o=()=>{const m=Math.min(a,e+r);n(m)},l=()=>{n(Se.default)},d=e<=s,u=e>=a,f=e===Se.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(O,{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:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
15
  ${f?"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(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(X.ZoomIn,{size:16})})})]})}function Bd({editor:e,isDisabled:n=!1}){const[s,a]=h.useState(!1),[r,i]=h.useState(""),[l,o]=h.useState(""),[d,u]=h.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:b,to:y}=e.state.selection,g=e.isActive("link");let w="";if(g){const D=e.schema.marks.link,j=e.state.doc.resolve(b),S=Qs.getMarkRange(j,D);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(b,y,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(g)}a(x)},p=()=>{if(l.trim()){const{from:x,to:b}=e.state.selection,y=e.schema.marks.link,g=e.state.doc.resolve(x),w=Qs.getMarkRange(g,y),N=w?.from??x,D=w?.to??b,j=e.state.doc.textBetween(N,D,"");r.trim()&&r!==j?e.chain().focus().setTextSelection({from:N,to:D}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"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:x=>i(x.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:l,onChange:x=>o(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:p,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function Vd({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function Vr(e,n){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>Ot(o)))).forEach(o=>{const d=et[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>Ot(d)))).forEach(d=>{const u=et[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function Ur(e,n){const s=h.useCallback((l,o)=>{if(!e)return;const d=et[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),a=h.useCallback(l=>{s(l)},[s]),r=h.useCallback((l,o)=>{if(!e)return!1;const d=et[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=h.useCallback((l,o)=>{if(!e)return!1;const d=et[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Ud(e=ke.default){const[n,s]=h.useState(e),a=h.useCallback((o=ke.step)=>{s(d=>Math.min(ke.max,d+o))},[]),r=h.useCallback((o=ke.step)=>{s(d=>Math.max(ke.min,d-o))},[]),i=h.useCallback(()=>{s(ke.default)},[]),l=h.useCallback(o=>{const d=Math.max(ke.min,Math.min(ke.max,o));s(d)},[]);return{zoom:n,setZoom:l,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ke.min,isMaxZoom:n>=ke.max,isDefaultZoom:n===ke.default}}const Hd=["bold","italic","strike","underline","code"];function Wd({editor:e,modifiers:n,onToolbarAction:s}){const a=Vr(e,n),{toggleModifier:r}=Ur(e,s);if(!e)return null;const i=n.map(l=>Ot(l)).filter(l=>Hd.includes(l));return i.length===0?null:t.jsx(Vd,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=a[l],d=yt(l);return t.jsx(dt,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function qd({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:l}){const o=Vr(e,n),{toggleModifier:d,executeCommand:u}=Ur(e,l);if(!e)return null;const f=n.map(C=>Ot(C)),m=f.some(C=>["bold","italic","strike","underline","code"].includes(C)),p=f.some(C=>["textColor","highlight"].includes(C)),x=f.includes("heading"),b=f.includes("textAlign"),y=f.some(C=>["bulletList","orderedList","taskList"].includes(C)),g=f.includes("blockquote"),w=f.includes("codeBlock"),N=f.includes("link"),D=f.includes("horizontalRule"),j=f.some(C=>["undo","redo"].includes(C)),S=s!==void 0&&a!==void 0,L=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${L} ${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(Wd,{editor:e,modifiers:n,onToolbarAction:l}),(p||x||b||y||g||w||N||D||j||S)&&t.jsx(ot,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(ga,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(ga,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(x||b||y||g||w||N||D||j||S)&&t.jsx(ot,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(Ld,{editor:e}),(b||y||g||w||N||D||j||S)&&t.jsx(ot,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const $=Id[C],k=e.isActive({textAlign:C});return t.jsx(dt,{icon:$,label:`Align ${C}`,isActive:k,onClick:()=>u("textAlign",{type:"textAlign",alignment:C})},C)})}),(y||g||w||N||D||j||S)&&t.jsx(ot,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(Md,{editor:e,types:f.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(g||w||N||D||j||S)&&t.jsx(ot,{})]}),(g||w||N||D)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(dt,{icon:yt("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(dt,{icon:yt("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(Bd,{editor:e,isDisabled:o.link?.isDisabled}),D&&t.jsx(dt,{icon:yt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(j||S)&&t.jsx(ot,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(dt,{icon:yt("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(dt,{icon:yt("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(ot,{})]}),S&&t.jsx(zd,{zoom:s,onZoomChange:C=>{a?.(C),l?.({type:"zoom",modifier:`${C}%`})}})]})})}const $t={bold:{category:"mark",extension:go.Bold,priority:100},italic:{category:"mark",extension:bo.Italic,priority:100},strike:{category:"mark",extension:yo.Strike,priority:100},underline:{category:"mark",extension:vo.Underline,priority:100},code:{category:"mark",extension:jo.Code,priority:100},textColor:{category:"mark",extension:wo.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:No.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Co.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:So.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ao.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Do.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Eo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Mo.CodeBlock,priority:100},blockquote:{category:"node",extension:Ro.Blockquote,priority:100},horizontalRule:{category:"node",extension:_o.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Po.HardBreak,priority:100},undo:{category:"extension",extension:Zs.History,priority:50},redo:{category:"extension",extension:Zs.History,priority:50},textAlign:{category:"extension",extension:To.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}},Gd=[Io.Document,Oo.Text,$o.Paragraph,ko.TextStyle.configure({HTMLAttributes:{}}),Lo.ListItem.configure({HTMLAttributes:{}}),Fo.TaskItem.configure({nested:!0}),zo.Dropcursor,Bo.Gapcursor];function Kd(e){const n=[],s=new Set,a=new Set;Gd.forEach(o=>{o&&(n.push(o),a.add(o.name))});const r=e.map(o=>Ot(o)),i=new Set;return r.forEach(o=>{const d=$t[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(s.has(o))return;const d=$t[o];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),r.forEach(o=>{if(s.has(o))return;const d=$t[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){s.add(o);return}const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),n.sort((o,d)=>{const u=Object.values($t).find(x=>x?.extension?.name===o.name),f=Object.values($t).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Hr={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"]},Yd={h1:`font-size: ${fe.fontSize["4xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h2:`font-size: ${fe.fontSize["2xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h3:`font-size: ${fe.fontSize.xl}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h4:`font-size: ${fe.fontSize.lg}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h5:`font-size: ${fe.fontSize.base}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,h6:`font-size: ${fe.fontSize.sm}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${ue.md} 0 ${ue.sm} 0;`,p:`min-height: ${fe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${ue.xl}; margin: ${ue.md} 0;`,li:`display: list-item; margin: ${ue.xs} 0;`,strong:`font-weight: ${fe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ne.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${fe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${fe.fontFamily.mono};`,pre:`background: ${Ne.neutral.gray[800]}; border-radius: ${ue.sm}; color: ${Ne.neutral.gray[100]}; font-family: ${fe.fontFamily.mono}; margin: ${ue.lg} 0; padding: 0.75rem ${ue.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ne.neutral.gray[300]}; margin: ${ue.lg} 0; padding-left: ${ue.md}; color: ${Ne.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ne.neutral.gray[200]}; margin: ${ue.xl} 0;`,a:`color: ${Ne.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ne.palettes.warning[200]}; border-radius: ${ue.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${ue.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Qd={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 Zd(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(Qd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${l} style="${a}">`)}for(const[s,a]of Object.entries(Yd)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.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 l=i.indexOf(">");return`${i.slice(0,l)} style="${a}"${i.slice(l)}`}})}return n}const Xd=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=cs.useCurrentEditor();return t.jsx(qd,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},Jd=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=cs.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(l=>l.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"]}),n&&t.jsxs("span",{children:[i," words"]})]})},Jn=h.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=Hr.full,variant:u="bordered",initialContent:f,content:m,onContentChange:p,onUpdate:x,onToolbarAction:b,isReadOnly:y=!1,isDisabled:g=!1,includeInlineStyles:w=!0,...N}=e,{zoom:D,setZoom:j}=Ud(),S=pa.lineHeight,L=s*S,C=r?void 0:a*S,$=h.useMemo(()=>Kd(d),[d]),{Component:k,label:R,shouldLabelBeOutside:F,getBaseProps:E,getLabelProps:_,getInputWrapperProps:T}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),q=R?t.jsx("label",{..._(),children:R}):null,Y=h.useCallback(({editor:z})=>{const ne=z.getHTML(),G=w?Zd(ne):ne,se=z.getJSON(),K=z.getText(),J=K.length,Q=K.split(/\s+/).filter(ie=>ie.length>0).length,W={html:G,json:se,text:K,characters:J,words:Q};if(p?.(W),x?.(W),"onChange"in N&&typeof N.onChange=="function"){const ie={target:{value:G},currentTarget:{value:G}};N.onChange(ie)}},[p,x,N,w]);return t.jsxs(k,{...E(),children:[F?q:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:C?`${C+pa.toolbarHeight}px`:void 0,overflow:C?"auto":void 0},children:t.jsx(cs.EditorProvider,{editable:!y&&!g,slotBefore:o?t.jsx(Xd,{modifiers:d,zoom:D,onZoomChange:j,onToolbarAction:b}):void 0,slotAfter:t.jsx(Jd,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${L}px`,fontSize:`${D}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:$,content:m||f||e.defaultValue||"",onUpdate:Y})})]})});Jn.displayName="TipTapEditor";const Wr=h.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(Jn,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(Jn,{...r,variant:a,ref:n}))});Wr.displayName="RichTextArea";function eu(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const ba=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],tu={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},qr=({presetAmounts:e=ba,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:p=3,isDisabled:x=!1,buttonVariant:b="bordered",buttonColor:y="default",inputVariant:g="bordered",size:w="md",className:N="",showCard:D=!0})=>{const j={...tu,...f},S=Array.isArray(e)?e:ba,L={2:"grid-cols-2",3:"grid-cols-3"},C={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},$=`${L[m]} ${C[p]}`,[k,R]=bn(n,s,a),[F,E]=h.useState(""),[_,T]=h.useState(!1),[q,Y]=h.useState(0),z=h.useCallback(J=>{if(x)return;const Q={amount:J.amount,isCustom:!1,presetId:J.id};R(Q),E(""),T(!1),Y(W=>W+1),r?.(Q)},[x,R,r]),ne=h.useCallback(J=>{if(x)return;if(E(J!==void 0?String(J):""),r){R(null);return}if(J===void 0||isNaN(J)){R(null);return}R({amount:J,isCustom:!0})},[x,R,r]),G=h.useCallback(()=>{if(x)return;const J=F!==""?parseFloat(F):void 0;J===void 0||isNaN(J)||r?.({amount:J,isCustom:!0})},[x,F,r]),se=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),K=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",$),"data-testid":"donation-amounts-presets",children:S.map(J=>{const Q=k!==null&&!k.isCustom&&k.presetId===J.id;return t.jsx(O,{color:Q?"primary":y,variant:Q?"solid":b,className:"w-full",onPress:()=>z(J),isDisabled:x,"data-testid":`donation-amounts-preset-${J.id}`,children:J.label||eu(J.amount,l,i)},J.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{R(null),T(!0)}:void 0,variant:g,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:se,value:F!==""?parseFloat(F):void 0,onValueChange:ne,isDisabled:x,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-${q}`:k?.isCustom===!1?k.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:G,isDisabled:x||!_,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]});return D?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:K})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:K})};qr.displayName="DonationAmounts";const nu=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},su=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},au=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"}},Gr=h.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=nu,className:p,...x},b)=>{const[y,g]=bn(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),w=h.useRef(null),N=h.useRef(!1);h.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),h.useEffect(()=>{if(!f||y<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{g(L=>L<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,a?.()),0):L-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,y,g,a]),h.useEffect(()=>{y>0&&(N.current=!1)},[y]);const D=d||su(r),j=au(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${l} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",j,S[u],p),...x,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:[o&&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(D,{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:l})]}),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(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Gr.displayName="ExpireCartTimer";const ht=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(I,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),ru=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:p})=>{const[x,b]=h.useState(!1),[y,g]=h.useState(!1),w=h.useRef(null);return h.useEffect(()=>{const N=()=>{if(w.current){const D=w.current.scrollHeight>w.current.clientHeight;g(D)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[l]),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:[o&&s&&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:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"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:n}),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(ht,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(ht,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ht,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!x&&y&&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"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(I,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?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:[o&&s&&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:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"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:n})]}),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(ht,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(ht,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(ht,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!x&&y&&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"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(I,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function es(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function iu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const lu={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"},pt=e=>typeof e=="number"&&!isNaN(e),rn=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:x=!0,showPrice:b=!0,priceDisplay:y,classNames:g={},"data-testid":w,selectedColor:N="default",selectionMode:D="stepper",compact:j=!1,isSoldOut:S,isMaxReached:L,isRuleBlocked:C,statusTone:$="default",statusLabel:k,disabledReason:R,disabled:F})=>{const E=h.useMemo(()=>({...lu,...l}),[l]),[_,T]=h.useState(s),q=n!==void 0?n:_,Y=!!(d||F),z=j||!!e.compact,ne=D==="press-to-add",G=h.useMemo(()=>typeof S=="boolean"?S:typeof e.isSoldOut=="boolean"?e.isSoldOut:!pt(e.totalTicketsSold)||!pt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[S,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=h.useMemo(()=>typeof L=="boolean"?L:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!pt(e.ticketsAllowed)?!1:q>=e.ticketsAllowed-(e.totalTicketsSold??0),[L,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,q]),K=h.useMemo(()=>typeof C=="boolean"?C:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[C,e.isRuleBlocked]),J=R||e.disabledReason,Q=Y||G||K,W=ce=>{if(Q||ce>0&&se)return;const ve=Math.max(0,q+ce);n===void 0&&T(ve),a?.(e.id,ve)},ie=h.useMemo(()=>{if(G)return"soldOut";if(K)return"ruleBlocked";if(Y)return"disabled"},[G,K,Y]),V=h.useMemo(()=>$||(G||K?"danger":se?"warning":"default"),[$,G,K,se]),ee=h.useMemo(()=>{if(ie)return ie==="ruleBlocked"?k||J||E.ruleBlocked:ie==="soldOut"?k||J||E.soldOut:ie==="disabled"?k||J||E.disabled:k||E.maxReached},[ie,k,J,E]),te={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},Ie={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Fe=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",g.name),children:e.name}),Me=()=>{if(!b)return null;const ce=y?.price??e.price,ve=y?.originalPrice,Ge=es(ce,i,r);if(o?.renderPrice)return o.renderPrice(ce,Ge,e);if(pt(ve)&&pt(ce)&&ve>ce){const A=es(ve,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",A,", discounted price ",Ge]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",g.originalPrice),children:A}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",g.discountedPrice),children:Ge})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",g.price),children:Ge})},xt=()=>!p||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",z&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),Ye=()=>{if(!x||!pt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ce=e.numberOfPeople===1?E.person:E.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,ce,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",z&&"mt-1 text-xs",g.peopleCount),children:[t.jsx(I,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",ce]})},qe=()=>{const ce=q===0||Q,ve=se||Q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:q,onIncrement:()=>W(1),onDecrement:()=>W(-1),isDecrementDisabled:ce,isIncrementDisabled:ve,isDisabled:Q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>W(-1),isDisabled:ce,variant:u,color:q>0?N:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(I,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:q}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>W(1),isDisabled:ve,variant:u,color:q>0?N:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(I,{icon:"gravity-ui:plus",width:16})})]})},it=(ce,ve)=>o?.renderDisabledState?o.renderDisabledState(ce,ve):ce==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(ve):ce==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(ve):t.jsx(c.Chip,{"data-testid":Ie[ce],color:te[ce],variant:ce==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ce==="maxReached"?"h-8":"h-10",ce==="soldOut"&&g.soldOut,ce==="maxReached"&&g.maxReachedAlert,z&&"h-8"),startContent:t.jsx(I,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ve})}),tt=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",Q||se?"opacity-50 pointer-events-none select-none":""),children:[Fe(),Me(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[Ye(),xt()]})]}),!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",z&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:ie&&ee?it(ie,ee):qe()})]}),Oe=se&&!G&&!K&&!Y?t.jsx(Ee.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",g.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:it("maxReached",ee||E.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!Q&&!se&&"cursor-pointer",z&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,isPressable:ne&&!Q&&!se,onPress:ne&&!Q&&!se?()=>W(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:tt}),t.jsx(Ee.AnimatePresence,{children:Oe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Oe})})]}):t.jsxs("div",{className:c.cn("w-full",z&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:tt}),t.jsx(Ee.AnimatePresence,{children:Oe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Oe})})]})};rn.displayName="OfferCard";const Kr=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=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:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=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(I,{"data-testid":"offer-card-empty-icon",icon:n,width:s,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:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Kr.displayName="OfferCardEmpty";const ou={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Yr=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...ou,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?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:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Yr.displayName="OfferCardError";const cu={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Qr=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=cu[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.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))})};Qr.displayName="OfferCardSkeleton";const Zr={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Xr={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"}}},du={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Jr=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:x=!0,animated:b=!0,gap:y=2,compact:g=!1,classNames:w={}})=>{const[N,D]=h.useState(a),j=s!==void 0?s:N,S=h.useCallback((F,E)=>{const _={...j,[F]:Math.max(0,E)};s===void 0&&D(_),r?.(_),i?.(F,_[F])},[j,s,r,i]),L=[...e].sort((F,E)=>(F.position??0)-(E.position??0)),C=F=>{const E=n?n(F):F,_=(j??{})[E.id]||0;return{offer:E,quantity:_,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:g}},$=du[y],k=c.cn("grid mx-auto pt-2",$,w.base),R=F=>{const E=C(F);return t.jsx(rn,{offer:E.offer,quantity:E.quantity,onQuantityChange:E.onQuantityChange,currency:E.currency,locale:E.locale,labels:E.labels,slots:E.slots,isDisabled:E.isDisabled,buttonVariant:E.buttonVariant,buttonColor:E.buttonColor,showCard:E.showCard,compact:E.compact,classNames:w.card},E.offer.id)};return b?t.jsx(Ee.motion.div,{"data-testid":"offer-card-list",className:k,variants:Zr,initial:"hidden",animate:"show",children:t.jsx(Ee.AnimatePresence,{children:L.map(F=>{const E=C(F);return t.jsx(Ee.motion.div,{"data-testid":`offer-card-list-item-${E.offer.id}`,className:w.cardWrapper,variants:Xr,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(rn,{offer:E.offer,quantity:E.quantity,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:g||E.offer.compact,classNames:w.card})},E.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:k,children:L.map(R)})};Jr.displayName="OfferCardList";var Bt=e=>e.type==="checkbox",ut=e=>e instanceof Date,Le=e=>e==null;const ei=e=>typeof e=="object";var ye=e=>!Le(e)&&!Array.isArray(e)&&ei(e)&&!ut(e),ti=e=>ye(e)&&e.target?Bt(e.target)?e.target.checked:e.target.value:e,uu=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ni=(e,n)=>e.has(uu(n)),mu=e=>{const n=e.constructor&&e.constructor.prototype;return ye(n)&&n.hasOwnProperty("isPrototypeOf")},js=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function pe(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(js&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(ye(e)&&mu(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=pe(e[r]));return a}var yn=e=>/^\w*$/.test(e),me=e=>e===void 0,ws=e=>Array.isArray(e)?e.filter(Boolean):[],Ns=e=>ws(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,s)=>{if(!n||!ye(e))return s;const a=(yn(n)?[n]:Ns(n)).reduce((r,i)=>Le(r)?r:r[i],e);return me(a)||a===e?me(e[n])?s:e[n]:a},Pe=e=>typeof e=="boolean",De=e=>typeof e=="function",de=(e,n,s)=>{let a=-1;const r=yn(n)?[n]:Ns(n),i=r.length,l=i-1;for(;++a<i;){const o=r[a];let d=s;if(a!==l){const u=e[o];d=ye(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const ln={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ve={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Qe={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},si=h.createContext(null);si.displayName="HookFormControlContext";const Cs=()=>h.useContext(si);var ai=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==Ve.all&&(n._proxyFormState[l]=!a||Ve.all),s&&(s[l]=!0),e[l]}});return r};const ks=typeof window<"u"?h.useLayoutEffect:h.useEffect;function fu(e){const n=Cs(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[l,o]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ks(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&o({...s._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>ai(l,s,d.current,!1),[l,s])}var Te=e=>typeof e=="string",ts=(e,n,s,a,r)=>Te(e)?(a&&n.watch.add(e),H(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),H(s,i))):(a&&(n.watchAll=!0),s),ns=e=>Le(e)||!ei(e);function Ue(e,n,s=new WeakSet){if(ns(e)||ns(n))return Object.is(e,n);if(ut(e)&&ut(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(ut(l)&&ut(o)||ye(l)&&ye(o)||Array.isArray(l)&&Array.isArray(o)?!Ue(l,o,s):!Object.is(l,o))return!1}}return!0}function xu(e){const n=Cs(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=h.useRef(r),u=h.useRef(o),f=h.useRef(void 0),m=h.useRef(s),p=h.useRef(a);u.current=o;const[x,b]=h.useState(()=>{const j=s._getWatch(a,d.current);return u.current?u.current(j):j}),y=h.useCallback(j=>{const S=ts(a,s._names,j||s._formValues,!1,d.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),g=h.useCallback(j=>{if(!i){const S=ts(a,s._names,j||s._formValues,!1,d.current);if(u.current){const L=u.current(S);Ue(L,f.current)||(b(L),f.current=L)}else b(S)}},[s._formValues,s._names,i,a]);ks(()=>((m.current!==s||!Ue(p.current,a))&&(m.current=s,p.current=a,g()),s._subscribe({name:a,formState:{values:!0},exact:l,callback:j=>{g(j.values)}})),[s,l,a,g]),h.useEffect(()=>s._removeUnmounted());const w=m.current!==s,N=p.current,D=h.useMemo(()=>{if(i)return null;const j=!w&&!Ue(N,a);return w||j?y():null},[i,w,a,N,y]);return D!==null?D:x}function hu(e){const n=Cs(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=ni(r._names.array,s),u=h.useMemo(()=>H(r._formValues,s,H(r._defaultValues,s,l)),[r,s,l]),f=xu({control:r,name:s,defaultValue:u,exact:o}),m=fu({control:r,name:s,exact:o}),p=h.useRef(e),x=h.useRef(void 0),b=h.useRef(r.register(s,{...e.rules,value:f,...Pe(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const y=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,s)},error:{enumerable:!0,get:()=>H(m.errors,s)}}),[m,s]),g=h.useCallback(j=>b.current.onChange({target:{value:ti(j),name:s},type:ln.CHANGE}),[s]),w=h.useCallback(()=>b.current.onBlur({target:{value:H(r._formValues,s),name:s},type:ln.BLUR}),[s,r._formValues]),N=h.useCallback(j=>{const S=H(r._fields,s);S&&S._f&&j&&(S._f.ref={focus:()=>De(j.focus)&&j.focus(),select:()=>De(j.select)&&j.select(),setCustomValidity:L=>De(j.setCustomValidity)&&j.setCustomValidity(L),reportValidity:()=>De(j.reportValidity)&&j.reportValidity()})},[r._fields,s]),D=h.useMemo(()=>({name:s,value:f,...Pe(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:g,onBlur:w,ref:N}),[s,a,m.disabled,g,w,N,f]);return h.useEffect(()=>{const j=r._options.shouldUnregister||i,S=x.current;S&&S!==s&&!d&&r.unregister(S),r.register(s,{...p.current.rules,...Pe(p.current.disabled)?{disabled:p.current.disabled}:{}});const L=(C,$)=>{const k=H(r._fields,C);k&&k._f&&(k._f.mount=$)};if(L(s,!0),j){const C=pe(H(r._options.defaultValues,s,p.current.defaultValue));de(r._defaultValues,s,C),me(H(r._formValues,s))&&de(r._formValues,s,C)}return!d&&r.register(s),x.current=s,()=>{(d?j&&!r._state.action:j)?r.unregister(s):L(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),h.useMemo(()=>({field:D,formState:m,fieldState:y}),[D,m,y])}const pu=h.createContext(null);pu.displayName="HookFormContext";var gu=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},_t=e=>Array.isArray(e)?e:[e],ya=()=>{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 ri(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&ye(r)&&i){const l=ri(r,i);ye(l)&&(s[a]=l)}else e[a]&&(s[a]=i)}return s}var Ae=e=>ye(e)&&!Object.keys(e).length,Ss=e=>e.type==="file",on=e=>{if(!js)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},ii=e=>e.type==="select-multiple",$s=e=>e.type==="radio",bu=e=>$s(e)||Bt(e),Rn=e=>on(e)&&e.isConnected;function yu(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=me(e)?a++:e[n[a++]];return e}function vu(e){for(const n in e)if(e.hasOwnProperty(n)&&!me(e[n]))return!1;return!0}function ge(e,n){const s=Array.isArray(n)?n:yn(n)?[n]:Ns(n),a=s.length===1?e:yu(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(ye(a)&&Ae(a)||Array.isArray(a)&&vu(a))&&ge(e,s.slice(0,-1)),e}var ju=e=>{for(const n in e)if(De(e[n]))return!0;return!1};function li(e){return Array.isArray(e)||ye(e)&&!ju(e)}function ss(e,n={}){for(const s in e){const a=e[s];li(a)?(n[s]=Array.isArray(a)?[]:{},ss(a,n[s])):me(a)||(n[s]=!0)}return n}function vt(e,n,s){s||(s=ss(n));for(const a in e){const r=e[a];if(li(r))me(n)||ns(s[a])?s[a]=ss(r,Array.isArray(r)?[]:{}):vt(r,Le(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Ue(r,i)}}return s}const va={value:!1,isValid:!1},ja={value:!0,isValid:!0};var oi=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!me(e[0].attributes.value)?me(e[0].value)||e[0].value===""?ja:{value:e[0].value,isValid:!0}:ja:va}return va},ci=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>me(e)?e:n?e===""?NaN:e&&+e:s&&Te(e)?new Date(e):a?a(e):e;const wa={isValid:!1,value:null};var di=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,wa):wa;function Na(e){const n=e.ref;return Ss(n)?n.files:$s(n)?di(e.refs).value:ii(n)?[...n.selectedOptions].map(({value:s})=>s):Bt(n)?oi(e.refs).value:ci(me(n.value)?e.ref.value:n.value,e)}var wu=(e,n,s,a)=>{const r={};for(const i of e){const l=H(n,i);l&&de(r,i,l._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},cn=e=>e instanceof RegExp,At=e=>me(e)?e:cn(e)?e.source:ye(e)?cn(e.value)?e.value.source:e.value:e,Ca=e=>({isOnSubmit:!e||e===Ve.onSubmit,isOnBlur:e===Ve.onBlur,isOnChange:e===Ve.onChange,isOnAll:e===Ve.all,isOnTouch:e===Ve.onTouched});const ka="AsyncFunction";var Nu=e=>!!e&&!!e.validate&&!!(De(e.validate)&&e.validate.constructor.name===ka||ye(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===ka)),Cu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Sa=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Pt=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=H(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!a)return!0;if(l.ref&&n(l.ref,l.name)&&!a)return!0;if(Pt(o,n))break}else if(ye(o)&&Pt(o,n))break}}};function $a(e,n,s){const a=H(e,s);if(a||yn(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),l=H(n,i),o=H(e,i);if(l&&!Array.isArray(l)&&s!==i)return{name:s};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:s}}var ku=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return Ae(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!a||Ve.all))},Su=(e,n,s)=>!e||!n||e===n||_t(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),$u=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,Au=(e,n)=>!ws(H(e,n)).length&&ge(e,n),Du=(e,n,s)=>{const a=_t(H(e,s));return de(a,"root",n[s]),de(e,s,a),e};function Aa(e,n,s="validate"){if(Te(e)||Array.isArray(e)&&e.every(Te)||Pe(e)&&!e)return{type:s,message:Te(e)?e:"",ref:n}}var gt=e=>ye(e)&&!cn(e)?e:{value:e,message:""},Da=async(e,n,s,a,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:p,pattern:x,validate:b,name:y,valueAsNumber:g,mount:w}=e._f,N=H(s,y);if(!w||n.has(y))return{};const D=o?o[0]:l,j=E=>{r&&D.reportValidity&&(D.setCustomValidity(Pe(E)?"":E||""),D.reportValidity())},S={},L=$s(l),C=Bt(l),$=L||C,k=(g||Ss(l))&&me(l.value)&&me(N)||on(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,R=gu.bind(null,y,a,S),F=(E,_,T,q=Qe.maxLength,Y=Qe.minLength)=>{const z=E?_:T;S[y]={type:E?q:Y,message:z,ref:l,...R(E?q:Y,z)}};if(i?!Array.isArray(N)||!N.length:d&&(!$&&(k||Le(N))||Pe(N)&&!N||C&&!oi(o).isValid||L&&!di(o).isValid)){const{value:E,message:_}=Te(d)?{value:!!d,message:d}:gt(d);if(E&&(S[y]={type:Qe.required,message:_,ref:D,...R(Qe.required,_)},!a))return j(_),S}if(!k&&(!Le(m)||!Le(p))){let E,_;const T=gt(p),q=gt(m);if(!Le(N)&&!isNaN(N)){const Y=l.valueAsNumber||N&&+N;Le(T.value)||(E=Y>T.value),Le(q.value)||(_=Y<q.value)}else{const Y=l.valueAsDate||new Date(N),z=se=>new Date(new Date().toDateString()+" "+se),ne=l.type=="time",G=l.type=="week";Te(T.value)&&N&&(E=ne?z(N)>z(T.value):G?N>T.value:Y>new Date(T.value)),Te(q.value)&&N&&(_=ne?z(N)<z(q.value):G?N<q.value:Y<new Date(q.value))}if((E||_)&&(F(!!E,T.message,q.message,Qe.max,Qe.min),!a))return j(S[y].message),S}if((u||f)&&!k&&(Te(N)||i&&Array.isArray(N))){const E=gt(u),_=gt(f),T=!Le(E.value)&&N.length>+E.value,q=!Le(_.value)&&N.length<+_.value;if((T||q)&&(F(T,E.message,_.message),!a))return j(S[y].message),S}if(x&&!k&&Te(N)){const{value:E,message:_}=gt(x);if(cn(E)&&!N.match(E)&&(S[y]={type:Qe.pattern,message:_,ref:l,...R(Qe.pattern,_)},!a))return j(_),S}if(b){if(De(b)){const E=await b(N,s),_=Aa(E,D);if(_&&(S[y]={..._,...R(Qe.validate,_.message)},!a))return j(_.message),S}else if(ye(b)){let E={};for(const _ in b){if(!Ae(E)&&!a)break;const T=Aa(await b[_](N,s),D,_);T&&(E={...T,...R(_,T.message)},j(T.message),a&&(S[y]=E))}if(!Ae(E)&&(S[y]={ref:D,...E},!a))return S}}return j(!0),S};const Eu={mode:Ve.onSubmit,reValidateMode:Ve.onChange,shouldFocusError:!0};function Fu(e={}){let n={...Eu,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:De(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=ye(n.defaultValues)||ye(n.values)?pe(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:pe(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let p={...m};const x={array:ya(),state:ya()},b=n.criteriaMode===Ve.all,y=v=>A=>{clearTimeout(u),u=setTimeout(v,A)},g=async v=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||p.isValid||v)){let A;n.resolver?(A=Ae((await $()).errors),w()):A=await R(a,!0),A!==s.isValid&&x.state.next({isValid:A})}},w=(v,A)=>{!n.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((v||Array.from(o.mount)).forEach(M=>{M&&(A?de(s.validatingFields,M,A):ge(s.validatingFields,M))}),x.state.next({validatingFields:s.validatingFields,isValidating:!Ae(s.validatingFields)}))},N=(v,A=[],M,U,B=!0,P=!0)=>{if(U&&M&&!n.disabled){if(l.action=!0,P&&Array.isArray(H(a,v))){const Z=M(H(a,v),U.argA,U.argB);B&&de(a,v,Z)}if(P&&Array.isArray(H(s.errors,v))){const Z=M(H(s.errors,v),U.argA,U.argB);B&&de(s.errors,v,Z),Au(s.errors,v)}if((m.touchedFields||p.touchedFields)&&P&&Array.isArray(H(s.touchedFields,v))){const Z=M(H(s.touchedFields,v),U.argA,U.argB);B&&de(s.touchedFields,v,Z)}(m.dirtyFields||p.dirtyFields)&&(s.dirtyFields=vt(r,i)),x.state.next({name:v,isDirty:E(v,A),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else de(i,v,A)},D=(v,A)=>{de(s.errors,v,A),x.state.next({errors:s.errors})},j=v=>{s.errors=v,x.state.next({errors:s.errors,isValid:!1})},S=(v,A,M,U)=>{const B=H(a,v);if(B){const P=H(i,v,me(M)?H(r,v):M);me(P)||U&&U.defaultChecked||A?de(i,v,A?P:Na(B._f)):q(v,P),l.mount&&!l.action&&g()}},L=(v,A,M,U,B)=>{let P=!1,Z=!1;const le={name:v};if(!n.disabled){if(!M||U){(m.isDirty||p.isDirty)&&(Z=s.isDirty,s.isDirty=le.isDirty=E(),P=Z!==le.isDirty);const oe=Ue(H(r,v),A);Z=!!H(s.dirtyFields,v),oe?ge(s.dirtyFields,v):de(s.dirtyFields,v,!0),le.dirtyFields=s.dirtyFields,P=P||(m.dirtyFields||p.dirtyFields)&&Z!==!oe}if(M){const oe=H(s.touchedFields,v);oe||(de(s.touchedFields,v,M),le.touchedFields=s.touchedFields,P=P||(m.touchedFields||p.touchedFields)&&oe!==M)}P&&B&&x.state.next(le)}return P?le:{}},C=(v,A,M,U)=>{const B=H(s.errors,v),P=(m.isValid||p.isValid)&&Pe(A)&&s.isValid!==A;if(n.delayError&&M?(d=y(()=>D(v,M)),d(n.delayError)):(clearTimeout(u),d=null,M?de(s.errors,v,M):ge(s.errors,v)),(M?!Ue(B,M):B)||!Ae(U)||P){const Z={...U,...P&&Pe(A)?{isValid:A}:{},errors:s.errors,name:v};s={...s,...Z},x.state.next(Z)}},$=async v=>(w(v,!0),await n.resolver(i,n.context,wu(v||o.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),k=async v=>{const{errors:A}=await $(v);if(w(v),v)for(const M of v){const U=H(A,M);U?de(s.errors,M,U):ge(s.errors,M)}else s.errors=A;return A},R=async(v,A,M={valid:!0})=>{for(const U in v){const B=v[U];if(B){const{_f:P,...Z}=B;if(P){const le=o.array.has(P.name),oe=B._f&&Nu(B._f);oe&&m.validatingFields&&w([P.name],!0);const Se=await Da(B,o.disabled,i,b,n.shouldUseNativeValidation&&!A,le);if(oe&&m.validatingFields&&w([P.name]),Se[P.name]&&(M.valid=!1,A||e.shouldUseNativeValidation))break;!A&&(H(Se,P.name)?le?Du(s.errors,Se,P.name):de(s.errors,P.name,Se[P.name]):ge(s.errors,P.name))}!Ae(Z)&&await R(Z,A,M)}}return M.valid},F=()=>{for(const v of o.unMount){const A=H(a,v);A&&(A._f.refs?A._f.refs.every(M=>!Rn(M)):!Rn(A._f.ref))&&te(v)}o.unMount=new Set},E=(v,A)=>!n.disabled&&(v&&A&&de(i,v,A),!Ue(K(),r)),_=(v,A,M)=>ts(v,o,{...l.mount?i:me(A)?r:Te(v)?{[v]:A}:A},M,A),T=v=>ws(H(l.mount?i:r,v,n.shouldUnregister?H(r,v,[]):[])),q=(v,A,M={})=>{const U=H(a,v);let B=A;if(U){const P=U._f;P&&(!P.disabled&&de(i,v,ci(A,P)),B=on(P.ref)&&Le(A)?"":A,ii(P.ref)?[...P.ref.options].forEach(Z=>Z.selected=B.includes(Z.value)):P.refs?Bt(P.ref)?P.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(B)?Z.checked=!!B.find(le=>le===Z.value):Z.checked=B===Z.value||!!B)}):P.refs.forEach(Z=>Z.checked=Z.value===B):Ss(P.ref)?P.ref.value="":(P.ref.value=B,P.ref.type||x.state.next({name:v,values:pe(i)})))}(M.shouldDirty||M.shouldTouch)&&L(v,B,M.shouldTouch,M.shouldDirty,!0),M.shouldValidate&&se(v)},Y=(v,A,M)=>{for(const U in A){if(!A.hasOwnProperty(U))return;const B=A[U],P=v+"."+U,Z=H(a,P);(o.array.has(v)||ye(B)||Z&&!Z._f)&&!ut(B)?Y(P,B,M):q(P,B,M)}},z=(v,A,M={})=>{const U=H(a,v),B=o.array.has(v),P=pe(A);de(i,v,P),B?(x.array.next({name:v,values:pe(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&M.shouldDirty&&x.state.next({name:v,dirtyFields:vt(r,i),isDirty:E(v,P)})):U&&!U._f&&!Le(P)?Y(v,P,M):q(v,P,M),Sa(v,o)?x.state.next({...s,name:v,values:pe(i)}):x.state.next({name:l.mount?v:void 0,values:pe(i)})},ne=async v=>{l.mount=!0;const A=v.target;let M=A.name,U=!0;const B=H(a,M),P=oe=>{U=Number.isNaN(oe)||ut(oe)&&isNaN(oe.getTime())||Ue(oe,H(i,M,oe))},Z=Ca(n.mode),le=Ca(n.reValidateMode);if(B){let oe,Se;const lt=A.type?Na(B._f):ti(v),nt=v.type===ln.BLUR||v.type===ln.FOCUS_OUT,xo=!Cu(B._f)&&!n.resolver&&!H(s.errors,M)&&!B._f.deps||$u(nt,H(s.touchedFields,M),s.isSubmitted,le,Z),Nn=Sa(M,o,nt);de(i,M,lt),nt?(!A||!A.readOnly)&&(B._f.onBlur&&B._f.onBlur(v),d&&d(0)):B._f.onChange&&B._f.onChange(v);const Cn=L(M,lt,nt),ho=!Ae(Cn)||Nn;if(!nt&&x.state.next({name:M,type:v.type,values:pe(i)}),xo)return(m.isValid||p.isValid)&&(n.mode==="onBlur"?nt&&g():nt||g()),ho&&x.state.next({name:M,...Nn?{}:Cn});if(!nt&&Nn&&x.state.next({...s}),n.resolver){const{errors:Ks}=await $([M]);if(w([M]),P(lt),U){const po=$a(s.errors,a,M),Ys=$a(Ks,a,po.name||M);oe=Ys.error,M=Ys.name,Se=Ae(Ks)}}else w([M],!0),oe=(await Da(B,o.disabled,i,b,n.shouldUseNativeValidation))[M],w([M]),P(lt),U&&(oe?Se=!1:(m.isValid||p.isValid)&&(Se=await R(a,!0)));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&se(B._f.deps),C(M,Se,oe,Cn))}},G=(v,A)=>{if(H(s.errors,A)&&v.focus)return v.focus(),1},se=async(v,A={})=>{let M,U;const B=_t(v);if(n.resolver){const P=await k(me(v)?v:B);M=Ae(P),U=v?!B.some(Z=>H(P,Z)):M}else v?(U=(await Promise.all(B.map(async P=>{const Z=H(a,P);return await R(Z&&Z._f?{[P]:Z}:Z)}))).every(Boolean),!(!U&&!s.isValid)&&g()):U=M=await R(a);return x.state.next({...!Te(v)||(m.isValid||p.isValid)&&M!==s.isValid?{}:{name:v},...n.resolver||!v?{isValid:M}:{},errors:s.errors}),A.shouldFocus&&!U&&Pt(a,G,v?B:o.mount),U},K=(v,A)=>{let M={...l.mount?i:r};return A&&(M=ri(A.dirtyFields?s.dirtyFields:s.touchedFields,M)),me(v)?M:Te(v)?H(M,v):v.map(U=>H(M,U))},J=(v,A)=>({invalid:!!H((A||s).errors,v),isDirty:!!H((A||s).dirtyFields,v),error:H((A||s).errors,v),isValidating:!!H(s.validatingFields,v),isTouched:!!H((A||s).touchedFields,v)}),Q=v=>{v&&_t(v).forEach(A=>ge(s.errors,A)),x.state.next({errors:v?s.errors:{}})},W=(v,A,M)=>{const U=(H(a,v,{_f:{}})._f||{}).ref,B=H(s.errors,v)||{},{ref:P,message:Z,type:le,...oe}=B;de(s.errors,v,{...oe,...A,ref:U}),x.state.next({name:v,errors:s.errors,isValid:!1}),M&&M.shouldFocus&&U&&U.focus&&U.focus()},ie=(v,A)=>De(v)?x.state.subscribe({next:M=>"values"in M&&v(_(void 0,A),M)}):_(v,A,!0),V=v=>x.state.subscribe({next:A=>{Su(v.name,A.name,v.exact)&&ku(A,v.formState||m,ce,v.reRenderRoot)&&v.callback({values:{...i},...s,...A,defaultValues:r})}}).unsubscribe,ee=v=>(l.mount=!0,p={...p,...v.formState},V({...v,formState:{...f,...v.formState}})),te=(v,A={})=>{for(const M of v?_t(v):o.mount)o.mount.delete(M),o.array.delete(M),A.keepValue||(ge(a,M),ge(i,M)),!A.keepError&&ge(s.errors,M),!A.keepDirty&&ge(s.dirtyFields,M),!A.keepTouched&&ge(s.touchedFields,M),!A.keepIsValidating&&ge(s.validatingFields,M),!n.shouldUnregister&&!A.keepDefaultValue&&ge(r,M);x.state.next({values:pe(i)}),x.state.next({...s,...A.keepDirty?{isDirty:E()}:{}}),!A.keepIsValid&&g()},Ie=({disabled:v,name:A})=>{if(Pe(v)&&l.mount||v||o.disabled.has(A)){const B=o.disabled.has(A)!==!!v;v?o.disabled.add(A):o.disabled.delete(A),B&&l.mount&&!l.action&&g()}},Fe=(v,A={})=>{let M=H(a,v);const U=Pe(A.disabled)||Pe(n.disabled);return de(a,v,{...M||{},_f:{...M&&M._f?M._f:{ref:{name:v}},name:v,mount:!0,...A}}),o.mount.add(v),M?Ie({disabled:Pe(A.disabled)?A.disabled:n.disabled,name:v}):S(v,!0,A.value),{...U?{disabled:A.disabled||n.disabled}:{},...n.progressive?{required:!!A.required,min:At(A.min),max:At(A.max),minLength:At(A.minLength),maxLength:At(A.maxLength),pattern:At(A.pattern)}:{},name:v,onChange:ne,onBlur:ne,ref:B=>{if(B){Fe(v,A),M=H(a,v);const P=me(B.value)&&B.querySelectorAll&&B.querySelectorAll("input,select,textarea")[0]||B,Z=bu(P),le=M._f.refs||[];if(Z?le.find(oe=>oe===P):P===M._f.ref)return;de(a,v,{_f:{...M._f,...Z?{refs:[...le.filter(Rn),P,...Array.isArray(H(r,v))?[{}]:[]],ref:{type:P.type,name:v}}:{ref:P}}}),S(v,!1,void 0,P)}else M=H(a,v,{}),M._f&&(M._f.mount=!1),(n.shouldUnregister||A.shouldUnregister)&&!(ni(o.array,v)&&l.action)&&o.unMount.add(v)}}},Me=()=>n.shouldFocusError&&Pt(a,G,o.mount),xt=v=>{Pe(v)&&(x.state.next({disabled:v}),Pt(a,(A,M)=>{const U=H(a,M);U&&(A.disabled=U._f.disabled||v,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||v}))},0,!1))},Ye=(v,A)=>async M=>{let U;M&&(M.preventDefault&&M.preventDefault(),M.persist&&M.persist());let B=pe(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Z}=await $();w(),s.errors=P,B=pe(Z)}else await R(a);if(o.disabled.size)for(const P of o.disabled)ge(B,P);if(ge(s.errors,"root"),Ae(s.errors)){x.state.next({errors:{}});try{await v(B,M)}catch(P){U=P}}else A&&await A({...s.errors},M),Me(),setTimeout(Me);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ae(s.errors)&&!U,submitCount:s.submitCount+1,errors:s.errors}),U)throw U},qe=(v,A={})=>{H(a,v)&&(me(A.defaultValue)?z(v,pe(H(r,v))):(z(v,A.defaultValue),de(r,v,pe(A.defaultValue))),A.keepTouched||ge(s.touchedFields,v),A.keepDirty||(ge(s.dirtyFields,v),s.isDirty=A.defaultValue?E(v,pe(H(r,v))):E()),A.keepError||(ge(s.errors,v),m.isValid&&g()),x.state.next({...s}))},it=(v,A={})=>{const M=v?pe(v):r,U=pe(M),B=Ae(v),P=B?r:U;if(A.keepDefaultValues||(r=M),!A.keepValues){if(A.keepDirtyValues){const Z=new Set([...o.mount,...Object.keys(vt(r,i))]);for(const le of Array.from(Z)){const oe=H(s.dirtyFields,le),Se=H(i,le),lt=H(P,le);oe&&!me(Se)?de(P,le,Se):!oe&&!me(lt)&&z(le,lt)}}else{if(js&&me(v))for(const Z of o.mount){const le=H(a,Z);if(le&&le._f){const oe=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(on(oe)){const Se=oe.closest("form");if(Se){Se.reset();break}}}}if(A.keepFieldsRef)for(const Z of o.mount)z(Z,H(P,Z));else a={}}i=n.shouldUnregister?A.keepDefaultValues?pe(r):{}:pe(P),x.array.next({values:{...P}}),x.state.next({values:{...P}})}o={mount:A.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!A.keepIsValid||!!A.keepDirtyValues||!n.shouldUnregister&&!Ae(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!A.keepIsValid,l.action=!1,A.keepErrors||(s.errors={}),x.state.next({submitCount:A.keepSubmitCount?s.submitCount:0,isDirty:B?!1:A.keepDirty?s.isDirty:!!(A.keepDefaultValues&&!Ue(v,r)),isSubmitted:A.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:B?{}:A.keepDirtyValues?A.keepDefaultValues&&i?vt(r,i):s.dirtyFields:A.keepDefaultValues&&v?vt(r,v):A.keepDirty?s.dirtyFields:{},touchedFields:A.keepTouched?s.touchedFields:{},errors:A.keepErrors?s.errors:{},isSubmitSuccessful:A.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},tt=(v,A)=>it(De(v)?v(i):v,{...n.resetOptions,...A}),Oe=(v,A={})=>{const M=H(a,v),U=M&&M._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),A.shouldSelect&&De(B.select)&&B.select()})}},ce=v=>{s={...s,...v}},Ge={control:{register:Fe,unregister:te,getFieldState:J,handleSubmit:Ye,setError:W,_subscribe:V,_runSchema:$,_updateIsValidating:w,_focusError:Me,_getWatch:_,_getDirty:E,_setValid:g,_setFieldArray:N,_setDisabledField:Ie,_setErrors:j,_getFieldArray:T,_reset:it,_resetDefaultValues:()=>De(n.defaultValues)&&n.defaultValues().then(v=>{tt(v,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:xt,_subjects:x,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(v){l=v},get _defaultValues(){return r},get _names(){return o},set _names(v){o=v},get _formState(){return s},get _options(){return n},set _options(v){n={...n,...v}}},subscribe:ee,trigger:se,register:Fe,handleSubmit:Ye,watch:ie,setValue:z,getValues:K,reset:tt,resetField:qe,clearErrors:Q,unregister:te,setError:W,setFocus:Oe,getFieldState:J};return{...Ge,formControl:Ge}}function Lu(e={}){const n=h.useRef(void 0),s=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:De(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:De(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!De(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Fu(e);n.current={...o,formState:a}}const i=n.current.control;return i._options=e,ks(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[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 l=i._getDirty();l!==a.isDirty&&i._subjects.state.next({isDirty:l})}},[i,a.isDirty]),h.useEffect(()=>{var l;e.values&&!Ue(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),s.current=e.values,r(o=>({...o}))):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()}),n.current.formState=h.useMemo(()=>ai(a,i),[i,a]),n.current}function Mu(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function Ru(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function _u(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Pu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Tu(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function As(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}As();const Iu={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:"$"},_n=()=>({id:As(),amount:0,glAccount:null,isTaxDeductible:!1}),ui=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:x,classNames:b={},"data-testid":y,control:g,name:w,rules:N})=>{const D={...Iu,...x},j=g!==void 0&&w!==void 0,S=Lu({defaultValues:{_internal:n||_n()}}),L=hu({control:j?g:S.control,name:j?w:"_internal",rules:j?N:void 0}),[C,$]=h.useState(n||_n()),k=j?L.field.value??_n():e??C,R=j&&!!L.fieldState?.error,F=j&&(L.fieldState?.isTouched??!1),E=R||F,_=E&&(!k.amount||k.amount<=0),T=E&&!k.glAccount,[q,Y]=h.useState(k.glAccount?.name||""),z=h.useCallback(W=>{const ie={...k,...W};j&&L.field.onChange(ie),!j&&e===void 0&&$(ie),i?.(ie)},[k,e,i,j,L]),ne=h.useCallback(W=>{const ie=W||0;z({amount:ie}),l?.(ie)},[z,l]),G=h.useCallback(W=>{Y(W),r?.(W)},[r]),se=h.useCallback(W=>{if(W===null){z({glAccount:null}),o?.(null);return}const V=s.find(ee=>String(ee.id)===String(W))||null;z({glAccount:V}),o?.(V)},[s,z,o]),K=h.useCallback(()=>{Y(""),z({glAccount:null}),o?.(null)},[z,o]),J=h.useCallback(W=>{z({isTaxDeductible:W}),d?.(W)},[z,d]),Q=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[D.amount,t.jsx(c.Tooltip,{content:D.amountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:k.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:D.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:_,errorMessage:_?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:D.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[D.glAccount,t.jsx(c.Tooltip,{content:D.glAccountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:k.glAccount?.name??q,selectedKey:k.glAccount?.id??null,isDisabled:p,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?D.searching:D.noGlAccountsFound},placeholder:D.glAccountPlaceholder,onInputChange:G,onSelectionChange:se,onClear:K,className:b.glAccountInput,children:W=>t.jsx(c.AutocompleteItem,{textValue:W.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:W.name}),W.code&&t.jsx("span",{className:"text-xs text-default-400",children:W.code})]})},W.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:k.isTaxDeductible,onValueChange:J,isDisabled:p||!m,className:b.taxDeductibleCheckbox,children:D.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(O,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!f,onPress:Q,startContent:t.jsx(I,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:D.deleteButton})})]})})};ui.displayName="RevenueDistributionCard";const mi=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(I,{icon:n,width:s,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:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};mi.displayName="RevenueDistributionEmpty";const Ou={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},fi=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Ou,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?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:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};fi.displayName="RevenueDistributionError";const xi=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.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 n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.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",s.base),children:a.map(i=>r(i))})};xi.displayName="RevenueDistributionSkeleton";function Ds({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,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:[s&&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:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.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:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(O,{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:n.cancel}),t.jsx(O,{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:f,children:n.confirm})]})]})})}const zu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Ea(e){return!e.fund&&Number(e.percentage||0)<=0}function Bu({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,l)=>i+Number(l.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const Vu={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"},hi={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"},Dt={...hi,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Uu={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"},Hu={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 Wu(){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 qu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Gu=e=>e.fund!==null;function Ku({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:p,onOpenFundPicker:x,onCloseFundPicker:b,onCollapseChange:y,onSave:g}){const[w,N]=h.useState(null),D=f??w??void 0,j={...Vu,...s},S=e.filter(V=>!Ea(V)),C=S.filter(Gu).length>0,$=h.useMemo(()=>e.filter(V=>!Ea(V)).reduce((V,ee)=>V+Number(ee.percentage||0),0),[e]),k=Math.round($*100)/100,R=S.some(V=>!V.fund||Number(V.percentage||0)<=0),F=C&&(k!==100||R),E=`${j.totalError} (${j.total} ${Number($.toFixed(2))}%)`,_=Bu({mode:"split",assignments:e}),T=C&&k>=100,[q,Y]=h.useState(!1),[z,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Wu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title}),l?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:j.saved}):null]}),se=(V,ee)=>{p(e.map(te=>te.id===V?{...te,...ee}:te))},K=()=>{T||p([...e,zu()])},J=V=>{e.length<=1||p(e.filter(ee=>ee.id!==V))},Q=()=>{if(!r){if(!_){ne(!0);return}if(!i){g();return}Y(!0)}},W=()=>{Y(!1),g()},ie=V=>{const ee=u??e.find(te=>!te.fund)?.id??e[0]?.id;ee&&(p(e.map(te=>te.id===ee?{...te,fund:V}:te)),b())};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&&!f&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["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:V=>y?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":j.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:[!C&&t.jsx(c.Alert,{icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:hi,color:"default",variant:"flat",title:j.emptySplit}),C&&t.jsx(Yu,{assignments:e,labels:j,total:$,hasTotalError:z&&!_||F,validationMessage:E,onSelectFund:V=>x(V),onRemoveFund:J,onPercentageChange:(V,ee)=>se(V,{percentage:qu(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(O,{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:T,onPress:()=>C?K():x(),children:j.assignSpecificFund}),t.jsx(O,{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(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!_||r,onPress:Q,children:j.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Qu,{funds:n,labels:j,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:D,onSelect:ie,onClose:b}),t.jsx(Ds,{isOpen:q,labels:{title:j.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:j.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:j.modifyAssignedFundsWarning})]}),cancel:j.modifyAssignedFundsCancel,confirm:j.modifyAssignedFundsConfirm},icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:D,shouldBlockScroll:!1,classNames:Hu,onClose:()=>Y(!1),onConfirm:W})]})}function Yu({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){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(O,{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(O,{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:n.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:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Uu})}),e.length>1&&t.jsx(O,{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:()=>l(d.id),"aria-label":n.removeFund,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(I,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Dt,base:c.cn(Dt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Dt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Dt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Dt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function Qu({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[l,o]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{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:n.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":n.searchPlaceholder,value:l,placeholder:n.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(I,{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:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.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(O,{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:n.select})]},u.id))]})]})]})})}function Zu(){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 Xu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Ju({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:l}){const o={...Xu,...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",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Pn,{label:o.totalAmount,value:d.format(e)}),t.jsx(Pn,{label:o.remainingBalance,value:d.format(n)}),t.jsx(Pn,{label:o.amountReceived,value:d.format(s)})]})})}function Pn({label:e,value:n}){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:n})]})}const em={monthly:1,quarterly:3,annual:12},pi=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},tm=(e,n)=>new Date(e,n+1,0).getDate(),nm=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},sm=(e,n)=>{const{year:s,month:a,day:r}=pi(e),i=a-1+n,l=s+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,tm(l,o));return new Date(l,o,d)},am=(e,n)=>{const{year:s,month:a,day:r}=pi(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function gi(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,l=em[n.frequency];return Array.from({length:s},(o,d)=>{const u=n.frequency==="weekly"?am(n.firstInstallmentDate,d*7):sm(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:nm(u),amount:(r+(d===0?i:0))/100}})}function rm(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function im(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:rm(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function lm(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function om(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const cm=new Set(["paid","partially_refunded","refunded"]);function mt(e){return e!==void 0&&cm.has(e)}const dm={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."},um=["weekly","monthly","quarterly","annual"],mm=Array.from({length:31},(e,n)=>n+1),fm=["numberOfInstallments","frequency","firstInstallmentDate"],Fa=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),dn=e=>Math.round(e*100)/100,xm=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},vn=e=>{if(!e)return null;try{return id(e)}catch{return null}},hm=e=>vn(e)?.day??1,pm=(e,n)=>new Date(e,n,0).getDate(),gm=(e,n)=>{const s=vn(e);if(!s)return e;const a=Math.min(n,pm(s.year,s.month));return s.set({day:a}).toString()},La=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function bm({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=fm,startDate:p,firstInstallmentDateOverride:x,labels:b,classNames:y,isSaving:g=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:D,onAutomaticSettingsChange:j,onInstallmentsChange:S,onSave:L,onCancel:C}){const[$,k]=h.useState(l),R={...dm,...b},F=e??$,E=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),_=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),T=F==="automatic"?om(gi(n,_),m.includes("firstInstallmentDate")?void 0:x):r,q=h.useMemo(()=>dn(T.reduce((te,Ie)=>te+Number(Ie.amount||0),0)),[T]),Y=Math.abs(q-n)>.009,z=dn(n-q)<=0,ne=h.useMemo(()=>im(r),[r]),G=F==="manual"&&lm(ne),se=Y||G,K=o?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:R.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:R.saved}):null]}):void 0,J=te=>{te!==F&&(e||k(te),D?.(te),te==="manual"&&r.length===0&&S([Fa()]))},Q=(te,Ie)=>{const Fe=r.find(Me=>Me.id===te);mt(Fe?.status)||S(r.map(Me=>Me.id===te?{...Me,...Ie}:Me))},W=()=>{S([...r,Fa()])},ie=te=>{const Ie=r.find(Fe=>Fe.id===te);mt(Ie?.status)||S(r.filter(Fe=>Fe.id!==te))},V=()=>{g||se||L?.()},ee=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u||C?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(ym,{mode:F,labels:R,onModeChange:J,isDisabled:N,className:y?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[C?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:C,children:R.cancelEdit}):null,u?t.jsx(O,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:g?void 0:t.jsx(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||se,onPress:V,children:R.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[F==="automatic"&&t.jsx(vm,{settings:_,inputs:m,labels:R,className:y?.controls,onSettingsChange:j}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?R.emptyAutomatic:R.emptyManual}),T.length>0&&t.jsx(jm,{mode:F,installments:T,rowErrors:ne,labels:R,formatter:E,locale:a,onUpdateInstallment:Q,onRemoveInstallment:ie}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(O,{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:z,onPress:W,children:R.addInstallment})}),t.jsx(km,{total:q,donationAmount:n,hasTotalMismatch:Y,mode:F,installments:T,formatter:E,labels:R,className:y?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.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":R.title,title:K,children:ee},"installment-schedule")}):ee})}function ym({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function vm({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:um.map(o=>t.jsx(c.SelectItem,{textValue:s[o],children:s[o]},o))})},l);if(l==="dayOfMonth"){const o=String(hm(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:gm(e.firstInstallmentDate,u)})},children:mm.map(d=>t.jsx(c.SelectItem,{textValue:La(d),children:La(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ys,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:vn(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(I,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function jm({mode:e,installments:n,rowErrors:s,labels:a,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){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",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.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:xm(d.dueDate,i)}),u===0&&n.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:n.map((d,u)=>{const f=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),p=s.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(ys,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:mt(d.status),isInvalid:f||m,errorMessage:f?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:vn(d.dueDate),onChange:x=>l(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Nm,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:mt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:x=>l(d.id,{amount:x})})}),t.jsx(Cm,{isDisabled:n.length<=1,isPaid:mt(d.status),label:a.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const wm=/^\d*(?:[.,]\d{0,2})?$/;function Nm({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[l,o]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!wm.test(u))return;o(u);const f=Number(u.replace(",","."));i(dn(Number.isFinite(f)?f:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Cm({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(O,{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||n,onPress:a,"aria-label":s,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?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 km({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),p=dn(n-e),x=Math.max(p,0),b=Math.max(-p,0),y=s?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):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(f)})," 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(n)}),"."]}),g=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:y})}function Sm(){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,n)=>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"})]},n))})]})}const Ma={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"},bi={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"},$m={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:bi.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."},Am={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Dm=[];function Em({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Dm,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:x}){const[b,y]=h.useState(null),g={...$m,...u},[w,N]=h.useState(""),D=new Intl.NumberFormat(s,{style:"currency",currency:n}),j=e.some(k=>yi(k)!==null),S=e.some(k=>k.status==="partially_refunded"),L=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:g.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:g.saved}):null]}):void 0,C=h.useMemo(()=>{const k=w.trim().toLowerCase();if(!k)return e;const R=new Intl.NumberFormat(s,{style:"currency",currency:n});return e.filter(F=>{const E=F.status??"scheduled";return[Tn(F),F.id,F.amount,F.dueDate,tn(F.dueDate,s),In(F,g.paidOn,s),On(F,g.refundedAmount,R),E,zn(E,g.partiallyRefunded)].join(" ").toLowerCase().includes(k)})},[s,n,e,w,g.paidOn,g.refundedAmount,g.partiallyRefunded]),$=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:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:g.searchPlaceholder,onChange:k=>N(k.target.value),startContent:t.jsx(I,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(O,{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(I,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",C.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[C.map((k,R)=>{const F=k.status??"scheduled",E=Tn(k),_=In(k,g.paidOn,s),T=On(k,g.refundedAmount,D);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:["#",R+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E||`PMT-${R+1}`})]}),t.jsx(Ra,{status:F,label:zn(F,g.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:g.amount}),t.jsx("p",{className:"font-medium text-foreground",children:D.format(k.amount)}),T?t.jsx("p",{className:"text-xs text-default-500",children:T}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:g.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:tn(k.dueDate,s)}),_?t.jsx("p",{className:"text-xs text-default-500",children:_}):null]})]}),t.jsx(_a,{status:F,installment:k,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:p,onDeleteInstallment:x})]})},k.id)}),C.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",C.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:j?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:S?"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:g.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:g.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:g.actions})]})}),t.jsxs("tbody",{children:[C.map((k,R)=>{const F=k.status??"scheduled",E=Tn(k),_=In(k,g.paidOn,s),T=On(k,g.refundedAmount,D);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:R+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E||`PMT-${R+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[D.format(k.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[tn(k.dueDate,s),_?t.jsx("span",{className:"block text-xs",children:_}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ra,{status:F,label:zn(F,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(_a,{status:F,installment:k,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:p,onDeleteInstallment:x})})]},k.id)}),C.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:y,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":g.title,title:L,children:$},"installment-table")}):$})}function Tn(e){return e.name?.trim()||e.id}function In(e,n,s){return!mt(e.status)||!e.fulfilledAt?null:`${n} ${tn(e.fulfilledAt,s)}`}function yi(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function On(e,n,s){const a=yi(e);return a===null?null:`${n} ${s.format(a)}`}function zn(e,n){return e==="partially_refunded"?n:bi[e]??e}function Ra({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Ma[e]??Ma.scheduled),startContent:t.jsx(Lm,{status:e}),children:n})}function _a({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e),u=mt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(O,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(I,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:s.payNow}):null,t.jsx(Fm,{isFulfilled:u,showDelete:r,labels:s,portalContainer:a,onDelete:()=>o(n.id)})]})}function Fm({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,l]=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(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(I,{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:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(I,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Ds,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(I,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Am,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Lm({status:e}){return e==="paid"?t.jsx(I,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(I,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(I,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(I,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(I,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(I,{icon:"solar:calendar-outline",className:"size-3"})}const Mm=/^\d{4}-\d{2}-\d{2}$/;function tn(e,n){const s=Mm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Rm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},_m=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const p=Array.isArray(e)?e:[],[x,b]=h.useState(o),[y,g]=h.useState(l),w={...Rm,...r};h.useEffect(()=>{b(o)},[o]);const N=j=>{if(j===x){d&&f?.(j);return}b(j),f?.(j)},D=j=>{g(j),u?.(j)};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:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(Ci,{title:w.renewalTitle,description:w.renewalDescription,value:y,onValueChange:D}),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(j=>t.jsx(vi,{itemKey:j.id,name:j.name,type:j.type,price:j.price,locale:n,currency:s,isSelected:x===j.id,onSelect:N},j.id))})]})},vi=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:p,statusTone:x="default",className:b=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),g=!!d&&!f,w=m||p,N=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,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:n}),s&&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:s})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},Pa="w-full bg-gray-100",Ta={variant:"light",color:"default"},ji=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:p=!1,isDisabled:x=!1,compact:b=!1,className:y="",bodyClassName:g="",footerClassName:w="",dataTestId:N})=>{const D=!!(d&&d.value),j=!!u?.label,S=p&&!!m&&!j,L=!S,C=j?{variant:u?.variant??Ta.variant,color:u?.color??Ta.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(I,{icon:u.icon,width:16}):void 0}:null,$=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Pa,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Pa,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(I,{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",y),isPressable:S,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:$}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:n}),o.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:o.map((k,R)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(I,{icon:k.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:k.label})]},`${k.label}-${R}`))}):null,(D||j)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",w),children:[D?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",b?"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}),j&&L?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:C?.variant,color:C?.color,size:C?.size,startContent:C?.startContent,isDisabled:C?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};ji.displayName="CatalogItemCard";const Pm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function wi({title:e,subtitle:n,price:s,imageUrl:a,status:r,isDisabled:i=!1,onPress:l,className:o}){return t.jsx(c.Card,{isPressable:!!l,isDisabled:i,onPress:l,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",o),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(I,{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:n})]}),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:Pm[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}wi.displayName="ProgramListItem";const Tm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Im={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Om={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},zm={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Bm={card:"mt-1",panel:"mt-[22px]"},Vm="bg-acct-page border-acct-border text-acct-muted",Um={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Hm={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"},Wm={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"},qm={empty:"status",error:"alert",success:"status",loading:"status"},Gm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Km(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:Um[e];return r?t.jsx(I,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function Nt({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:l,role:o=qm[e],ariaLive:d=Gm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":p="feedback-state"}){const x=Km(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Tm[n],n==="card"?Hm[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",Im[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Vm:Wm[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(Om[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(zm[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Bm[n],m.actions),children:l}):null]})}function Es(e){return t.jsx(Nt,{...e,variant:"empty"})}function Fs(e){return t.jsx(Nt,{...e,variant:"error"})}function Ls(e){return t.jsx(Nt,{...e,variant:"loading"})}function Ni(e){return t.jsx(Nt,{...e,variant:"success"})}Nt.displayName="FeedbackState";Es.displayName="EmptyState";Fs.displayName="ErrorState";Ls.displayName="LoadingState";Ni.displayName="SuccessState";const Ci=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"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}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Ym={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"},Qm=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),ki=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),Zm=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Ms=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),Ia=(e,n,s)=>{const a={};let r=s?n??Zm(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Ms(e)){a[i.id]??={},a[i.id][l.id]??={};const d=s?Math.min(o.max,r):0;a[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return a},Oa=(e,n,s)=>`${e}::${n}::${s}`,Xm=(e,n,s)=>{const a=ki(n);for(const{exhibition:r,dateGroup:i,ticket:l}of Ms(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=s===void 0?l.max:Math.min(l.max,s-(a-o));if(d>0&&o<d)return!1}return!0},Jm=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[l,o]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?l:String(i),m=()=>{r||i>=s||a?.(i+1)},p=()=>{r||i<=n||a?.(i-1)},x=j=>{if(r)return;o(j.target.value);const S=parseInt(j.target.value,10);isNaN(S)||a?.(Math.max(n,Math.min(s,S)))},b=j=>{const S=parseInt(j.target.value,10);if(u(!1),isNaN(S)){a?.(n);return}const L=Math.max(n,Math.min(s,S));L!==S?a?.(L):o(String(L))},y=i<=n,g=i>=s,w="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",D="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||y,className:c.cn(w,r||y?D:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:s,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||g,className:c.cn(w,r||g?D:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},ef=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,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:n,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",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&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})]})},tf=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Qm(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:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.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:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Jm,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:s})]}),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]})},nf=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"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:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(tf,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),sf=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=n.dates.reduce((x,b)=>x+b.tickets.reduce((y,g)=>y+a(n.id,b.id,g.id),0),0),p=n.dates.some(x=>x.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:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.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," ",o.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(I,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.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?n.dates.map((x,b)=>t.jsx(nf,{exhibitionId:n.id,dateGroup:x,isLast:b===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},af=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=h.useMemo(()=>r??[],[r]),d={...Ym,...s},[u,f]=h.useState(()=>Ia(o,n,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const N=Ms(o).map(({exhibition:D,dateGroup:j,ticket:S})=>[Oa(D.id,j.id,S.id),S]);return new Map(N)},[o]),x=Xm(o,u,n),b=(N,D,j)=>u[N]?.[D]?.[j]?.selectedQuantity??0,y=()=>ki(u),g=(N,D,j,S)=>{const L=b(N,D,j),C=y()-L;if(n!==void 0&&C+S>n)return;const $=p.get(Oa(N,D,j));if(!$)return;const k={...u,[N]:{...u[N],[D]:{...u[N]?.[D],[j]:{id:j,selectedQuantity:S,originalPrice:$.originalPrice,discountedPrice:$.price}}}};f(k),l?.(k)},w=N=>{const D=Ia(o,n,N);f(D),l?.(D)};return h.useEffect(()=>{!m.current&&x&&(l?.(u),m.current=!0)},[x,u,l]),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(ef,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),o.map(N=>t.jsx(sf,{title:N.exhibitionName,exhibition:N,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},N.id))]})},Bn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Vn=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},rf=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},lf=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Si=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:p,countAriaLabel:x,countDisplay:b="badge",confirmLabel:y=Bn.confirm,clearLabel:g=Bn.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:D,isDisabled:j=!1,closeOnConfirm:S=!0,keepOpenAfterClear:L=!1})=>{const[C,$]=h.useState(N),[k,R]=h.useState(()=>Vn(u)),F=w??C,E=p??u.filter(K=>lf(K)).length,_=K=>{K&&R(Vn(u)),w||$(K),D?.(K)},T=(K,J)=>{R(Q=>({...Q,[K.id]:J}))},q=(K,J)=>{R(Q=>({...Q,[K.id]:J?[J]:[]}))},Y=async()=>{R(Vn(u.map(K=>K.type==="checkbox"?{...K,selectedValues:[]}:{...K,selectedValue:null}))),await m(),L||_(!1)},z=async()=>{const K=rf(k,u);await f(K),S&&_(!1)},ne=K=>{if(K.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:K.label,value:k[K.id]??[],onValueChange:Q=>T(K,Q),children:K.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},K.id);const J=k[K.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:K.label,value:J,onValueChange:Q=>q(K,Q||null),children:K.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},K.id)},G=h.useMemo(()=>E>0?x?.(E)||`${E} filters applied`:void 0,[x,E]),se=h.useMemo(()=>E===0?e||Bn.noLabel:x?x(E):`${e} (${E})`,[E,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:_,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:j,variant:a,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(I,{icon:s,width:16}),t.jsx("span",{children:e}),b==="badge"&&E>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:E}):b==="summary"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(K=>ne(K)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(O,{variant:"light",color:"default",size:"sm",onPress:Y,children:g}),t.jsx(O,{color:"primary",size:"sm",onPress:z,children:y})]})]})})]})})};Si.displayName="FilterPopover";const of="No sessions available for this date",cf=e=>e==="sold-out"||e==="closed"?"danger":"success",df=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},za=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",uf=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,$i=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=of,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:x,dayGroupAriaLabel:b,sessionGridAriaLabel:y,className:g,headingClassName:w,subheadingClassName:N})=>{const D=uf(s,a),j=s.find(k=>k.date===D),S=i??s.map(k=>({date:k.date,label:k.label})),L=j?.sessions??[],C=k=>k===D?"solid":"bordered",$=k=>{if(!za(k)){if(k.id===l){o(null);return}o(k.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",g),"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",w),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[S.map(k=>t.jsx(O,{size:"sm",variant:C(k.date),color:"default",className:c.cn("rounded-full",p),isDisabled:k.isDisabled,onPress:()=>{r(k.date)},children:t.jsx("span",{children:k.label})},k.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[L.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,L.map(k=>{const R=za(k),F=k.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!R,onPress:()=>{$(k)},"aria-disabled":R,"aria-pressed":R?void 0:F,className:c.cn("w-full",R?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(k,{isSelected:F,isUnavailable:R}):R?`${k.startTime} ${k.endTime} sold out`:`${k.startTime} ${k.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:[k.startTime," – ",k.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(k):cf(k.status),variant:"flat",children:u?u(k):df(k)})]})})},k.id)})]})]})};$i.displayName="SessionTimeline";const as=16,Je=e=>`${e/as}rem`;function mf(){if(typeof document>"u"||typeof getComputedStyle!="function")return as;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:as}const Vt=(e,n)=>e>=n*mf(),ff=1120;function Ct(){const e=h.useRef(null),[n,s]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{const o=l[l.length-1];o&&s(o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width)});return s(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:n}}const xf=48,ze={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"},hf=(e,n)=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,Ai=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:p})=>{const x=hf(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(ze.base,m?ze.baseNarrow:ze.baseWide):"flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:f?ze.identity:"flex items-center gap-4",children:[x?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:x}):null,t.jsxs("div",{className:f?ze.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn(f?m?ze.titleNarrow:ze.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?ze.subtitleNarrow:ze.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?ze.actionsNarrow:ze.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},pf=e=>{const{ref:n,width:s}=Ct(),a=s>0&&!Vt(s,xf);return t.jsx(Ai,{...e,list:!0,narrow:a,headerRef:n})},Di=e=>e.variant==="list"?t.jsx(pf,{...e}):t.jsx(Ai,{...e,list:!1,narrow:!1});Di.displayName="PageHeader";const We={ok:{fg:je.ok,bg:je["ok-fill"]},warn:{fg:je.warn,bg:je["warn-fill"]},danger:{fg:je.danger,bg:je["danger-fill"]},info:{fg:je.info,bg:je["info-fill"]},violet:{fg:je.violet,bg:je["violet-fill"]},neutral:{fg:je.neutral,bg:je["neutral-fill"]}};function Ut(e){if(e==="positive")return{color:je.ok};if(e==="negative")return{color:je.danger}}const gf={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},rs={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:We.info,violet:We.violet},bf={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},yf={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]"},vf={info:rs.info,violet:rs.violet},Ei=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(s==="plain"){const u=We[bf[e]];return t.jsxs("span",{"data-testid":o,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",yf[a],"leading-[1.35]",l),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(s==="dot"){const u=rs[e];return t.jsxs("span",{"data-testid":o,"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]",l),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"}}),n]})}const d=r?void 0:vf[e];return t.jsx(c.Chip,{color:r??gf[e],variant:s,size:a,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:n})};Ei.displayName="StatusChip";const jf={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"},Kt={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"},Rs=({label:e,value:n,size:s="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(Kt.base,Kt[s],r),children:[t.jsx("span",{className:Kt.label,children:e}),t.jsx("span",{className:Kt.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",jf[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Rs.displayName="KeyValueChip";const Fi="(prefers-reduced-motion: reduce)",Li="data-pos-reduce-motion",Ht="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",wf="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",nn=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${wf}`;function Nf(){return typeof document>"u"?!1:document.documentElement.getAttribute(Li)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Fi).matches}function Cf(){const[e,n]=h.useState(!1);return h.useEffect(()=>{const s=()=>n(Nf()),a=typeof window.matchMedia=="function"?window.matchMedia(Fi):null;a?.addEventListener?.("change",s);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Li]}),s(),()=>{a?.removeEventListener?.("change",s),r?.disconnect()}},[]),e}const Mi=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:l,classNames:o={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",l,o.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",o.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(nn,o.bar),style:{height:Je(a),width:m==="fill"?"60%":Je(m),maxWidth:"100%"}})},p)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,p)=>{const x=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},f))})]});Mi.displayName="TableSkeleton";const Ri="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",_i="px-4 text-[13.5px] text-acct-ink2 align-middle",Pi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Ti="w-full",Ii="border-t border-acct-border px-5 py-3.5",Yt={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 ${Ht}`,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"},Oi=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,variant:i="default",className:l,classNames:o={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&Yt.base,l,o.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Ti,o.table),th:c.cn(u?Yt.th:Ri,o.th),tr:c.cn(u?Yt.tr:Pi,o.tr),td:c.cn(u?Yt.td:_i,o.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Ii,o.footer),children:a}):null]})};Oi.displayName="AdminTable";const Et={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"},kf={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},Sf=48,Ke={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"},Ba={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},un={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Va={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Ua={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},zi=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:l,dataTestId:o,startContent:d,classNames:u})=>{const f=h.useRef(null),m=l==="lg",p=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{n(""),f.current?.focus()},className:c.cn(Va.button,Ua[l].button),testId:`${o}-search-clear`,children:t.jsx(I,{icon:"lucide:x","aria-hidden":"true",className:Ua[l].icon})}):void 0;return t.jsx(c.Input,{ref:f,type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:d,endContent:p,"data-testid":`${o}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&un.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&un.input,r&&Va.input)}})},$f=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:l,children:o,trailing:d,searchWidth:u="md",size:f,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:x,width:b}=Ct(),y=b>0&&!Vt(b,Sf),g=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":p,"data-variant":"framed","data-size":y?"narrow":"wide",className:c.cn(Ke.base,y&&Ke.narrow,m),children:[o,t.jsx("div",{"data-testid":`${p}-search-slot`,className:g?Ke.searchFill:y?Ke.searchNarrow:Ke.searchWide,children:t.jsx(zi,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:l,size:f,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(Ke.icon,f==="lg"&&un.icon),children:r??t.jsx(I,{icon:"lucide:search"})}),classNames:{base:g?Ba.fill:y?Ke.inputBaseNarrow:Ba[u],inputWrapper:Ke.inputWrapper,innerWrapper:Ke.innerWrapper,input:Ke.input}})}),d]})},Bi=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:l="Clear search",children:o,trailing:d,searchWidth:u="md",size:f="md",variant:m="default",className:p,"data-testid":x="admin-toolbar"})=>m==="framed"?t.jsx($f,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:l,trailing:d,searchWidth:u,size:f,className:p,"data-testid":x,children:o}):t.jsxs("div",{role:"search","data-testid":x,className:c.cn(Et.base,p),children:[t.jsx(zi,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:l,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Et.icon,f==="lg"&&un.icon),children:r}):void 0,classNames:{base:kf[u],inputWrapper:Et.inputWrapper,input:Et.input}}),o,d?t.jsx("div",{className:Et.trailing,children:d}):null]});Bi.displayName="AdminToolbar";const Af="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",Df="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",Ef="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",Vi=h.forwardRef(function({icon:n,children:s,count:a,appearance:r="pill",className:i,testId:l,...o},d){return r==="outline"?t.jsxs(O,{ref:d,"data-testid":l,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...o,children:[t.jsx(I,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:Df,children:a})]}):t.jsxs(O,{ref:d,"data-testid":l,variant:"light",size:"sm",className:c.cn(Ef,i),...o,children:[t.jsx(I,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:Af,children:a})]})});Vi.displayName="ToolbarButton";function Ui({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:l=>s(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),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",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Ui.displayName="UnderlineTabs";const _s="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Ps="font-normal normal-case tracking-normal",Hi=["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(" "),Wi="text-[13.5px] text-acct-ink",qi="bg-acct-page text-acct-muted cursor-default",Gi="mt-[5px] text-xs text-acct-sub",Ki="mt-[5px] text-xs text-acct-danger",Yi=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(_s,s),children:[e,n?t.jsxs("span",{className:Ps,children:[" ",n]}):null]});Yi.displayName="AdminFieldLabel";const Qi=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":p="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Ps,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":p,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:_s,inputWrapper:Hi,input:c.cn(Wi,(o||l)&&"font-mono",l&&qi),description:Gi,errorMessage:Ki}});Qi.displayName="AdminTextField";const Ff={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Zi=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(O,{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",Ff[n]),children:r.icon},r.key))});Zi.displayName="RowActions";const Xi=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,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(O,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-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:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Xi.displayName="PickerRow";const Re={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",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Lf={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Mf={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"}},Ji={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"}},Rf={md:void 0,lg:"min-h-12 text-base"},_f={none:"",sm:"gap-1",md:"gap-2"},el="m-0 flex list-none flex-col p-0",bt={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"]},tl=h.createContext(!1),Pf=()=>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"})}),Tf=()=>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 If(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return"—";const s=n[0]?.charAt(0)??"",a=n.length>1?n[n.length-1]?.charAt(0)??"":"";return`${s}${a}`.toUpperCase()}function re(e){return e!=null&&e!==!1&&e!==""}const nl=({title:e,subtitle:n,leading:s,tags:a,onPress:r,href:i,linkAs:l,"aria-haspopup":o,trailing:d,showChevron:u=!1,chevronIcon:f,actions:m,actionsLabel:p,actionsIcon:x,size:b,variant:y="plain",isDisabled:g=!1,as:w,className:N,"data-testid":D="entity-row"})=>{const j=h.useContext(tl),S=xn(),L=b??(S==="touch"?"lg":"md"),C=Ji[L],$=Mf[y],k=w??(j?"li":"div"),R=h.useId(),F=h.useId(),E=h.useId(),_=i!==void 0||r!==void 0,T=a!==void 0&&a.length>0,q=re(n),Y=m!==void 0&&m.length>0,z=typeof e=="string"?e:void 0,ne=s?t.jsx(c.Avatar,{"aria-hidden":"true",size:C.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??z,getInitials:s.initials!==void 0?W=>W:If,showFallback:s.src!==void 0,classNames:{base:Re.avatar},"data-testid":`${D}-leading`}):null,G=t.jsxs(t.Fragment,{children:[ne,t.jsxs("span",{className:Re.text,children:[t.jsxs("span",{className:Re.titleLine,children:[t.jsx("span",{id:R,className:c.cn(Re.title,C.title),title:z,children:e}),T&&t.jsx("span",{id:F,className:Re.tags,children:a.map(W=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:W.tone??"default",className:Lf[W.tone??"default"],"data-testid":`${D}-tag-${W.key}`,children:W.label},W.key))})]}),q&&t.jsx("span",{id:E,className:c.cn(Re.subtitle,C.subtitle),children:n})]})]}),se=[T?F:null,q?E:null].filter(Boolean).join(" "),K={"aria-labelledby":R,"aria-describedby":se===""?void 0:se,isDisabled:g,className:c.cn(Re.pressTarget,$.overlay,C.content)},J=`${D}-trigger`;let Q;return i!==void 0?Q=t.jsx(c.Link,{...K,"data-testid":J,as:l,href:i,color:"foreground",underline:"none",onPress:r,children:G}):r!==void 0?Q=t.jsx(O,{...K,testId:J,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":o,onPress:r,children:G}):Q=t.jsx("div",{className:c.cn(Re.content,C.content),children:G}),t.jsxs(k,{"data-testid":D,"data-size":L,"data-disabled":g||void 0,className:c.cn(Re.base,$.row,C.row,_&&!g&&$.hover,N),children:[Q,(re(d)||Y)&&t.jsxs("div",{className:Re.side,children:[d,Y&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:C.control,variant:"light",color:"default",radius:"full",isDisabled:g,"aria-label":p,testId:`${D}-menu-trigger`,className:Re.menuTrigger,children:x??t.jsx(Tf,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${D}-menu`,disabledKeys:m.filter(W=>W.isDisabled).map(W=>W.key),onAction:W=>{m.find(ie=>ie.key===W)?.onAction()},items:m,children:W=>t.jsx(c.DropdownItem,{textValue:W.label,color:W.tone==="danger"?"danger":"default",className:c.cn(W.tone==="danger"&&Re.dangerItem,Rf[L]),startContent:W.icon,"data-testid":W["data-testid"]??`${D}-menu-${W.key}`,children:W.label},W.key)})]})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Re.chevron,"data-testid":`${D}-chevron`,children:f??t.jsx(Pf,{})})]})};nl.displayName="EntityRow";const sl=({children:e,"aria-label":n,"aria-labelledby":s,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":n,"aria-labelledby":s,"data-testid":i,className:c.cn(el,_f[a],r),children:t.jsx(tl.Provider,{value:!0,children:e})});sl.displayName="EntityList";const al=({label:e,rows:n=6,size:s,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=xn(),l=s??(i==="touch"?"lg":"md"),{titleWidths:o}=bt;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:el,children:Array.from({length:n},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(bt.row,Ji[l].row),children:[t.jsx(c.Skeleton,{className:bt.avatar[l]}),t.jsxs("span",{className:bt.lines,children:[t.jsx(c.Skeleton,{className:c.cn(bt.title,o[u%o.length])}),t.jsx(c.Skeleton,{className:bt.subtitle})]})]},u))})]})};al.displayName="EntityListSkeleton";function rl(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const il=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,format:i,className:l,classNames:o={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=rl(e,n,s),m=c.cn("font-semibold text-default-700",o.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",l,o.base),children:i?i({from:u,to:f,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${f}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};il.displayName="PaginationSummary";const jn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Ze={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"},Of={card:jn,flat:""},zf={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]"},Bf={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:""}},ll=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:x,emptyActions:b,emptyContent:y,children:g,toolbar:w,variant:N="default",className:D,classNames:j={},"data-testid":S="list-panel"})=>{const L=N==="framed",C={base:c.cn("border-0 bg-transparent py-12",j.state)},$=L?{base:c.cn("px-6 py-[3.625rem]",j.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"}:C;let k;return e?k=r??t.jsx(Ls,{title:a,classNames:C,"data-testid":`${S}-loading`}):n?k=f??t.jsx(Fs,{title:i,description:l,classNames:C,"data-testid":`${S}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):s?k=y??t.jsx(Es,{surface:L?"panel":void 0,title:m,description:p,icon:x,actions:b,classNames:$,"data-testid":`${S}-empty`}):k=g,t.jsxs("section",{"data-testid":S,"data-variant":L?"framed":void 0,className:c.cn(L?`overflow-hidden rounded-2xl border border-pos-line bg-white ${jn}`:"rounded-xl bg-white p-2 shadow-sm",D,j.base),children:[w,k]})};ll.displayName="ListPanel";const ol=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),mn=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},cl=(e,n)=>{const[s,a]=h.useState(()=>n(e)),r=(mn(s)??0)===(e??0)?s:n(e),i=h.useCallback(()=>{a(l=>{const o=mn(l);return o===null?"":String(o)})},[]);return{draft:r,setDraft:a,normalize:i}},Vf=/^[\d.,]+$/,dl=(e,n=Object.is)=>{const s=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const o=a.current,d=s.current;return o===null||!(n(d,o.source)||n(d,o.emitted))},[n]),i=h.useCallback(o=>{a.current={source:s.current,emitted:o}},[]),l=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:l}),[r,i,l])},ul=(e,n)=>{const s=h.useRef(null),a=h.useRef(n);return h.useLayoutEffect(()=>{a.current=n},[n]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=o=>{e()&&(o.inputType==="insertText"&&o.data&&Vf.test(o.data)?(o.preventDefault(),a.current(o.data)):o.inputType.startsWith("delete")&&(o.preventDefault(),a.current("")))},l=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",l),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",l)}},[e]),s},Uf=350,Hf={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}"},Wf=7,qf=e=>[...new Set((e??[]).filter(n=>Number.isFinite(n)&&n>0))].sort((n,s)=>n-s).slice(0,Wf),Gf=(e,n,s)=>{if(!Number.isInteger(e))return he(e,n,s);try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return he(e,n,s)}},Kf=(e,n)=>(e??0)===(n??0),Ft=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),Yf=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,quickAmounts:d,showExactAmount:u=!0,autoFocus:f=!1,className:m,"data-testid":p="cash-tender-form"})=>{const x={...Hf,...i},b=zt(e.currency,r),y=n!==void 0,[g,w]=h.useState(s??null),N=y?n:g,{draft:D,setDraft:j,normalize:S}=cl(N,V=>V==null?"":String(V)),{isUntouched:L,markEdited:C,markUntouched:$}=dl(N,Kf),k=h.useMemo(()=>{const V=typeof N=="number"&&Number.isFinite(N)?N:0,ee=Xn(V,e.value,e.currency,r);return{received:V,change:ee>0?ee:0,isValid:V>=e.value&&V>0}},[N,e.value,e.currency,r]),R=h.useCallback(V=>{const ee=V.currentTarget;requestAnimationFrame(()=>{ee.isConnected&&ee.select()})},[]),F=h.useCallback(V=>{y||w(V);const ee=typeof V=="number"&&Number.isFinite(V)?V:0,te=Xn(ee,e.value,e.currency,r);a?.({received:ee,change:te>0?te:0,isValid:ee>=e.value&&ee>0})},[y,e.value,e.currency,r,a]),E=h.useCallback(V=>{if(l)return;const ee=V.replace(/[^\d.,]/g,"");if(!ol(ee,b))return;const te=mn(ee);te!==null&&o!==void 0&&te>o||(j(ee),C(te),F(te))},[l,o,j,C,b,F]),_=ul(L,E),T=h.useMemo(()=>qf(d),[d]),q=V=>o!==void 0&&V>o,Y=()=>{l||q(e.value)||(j(String(e.value)),$(),F(e.value))},z=V=>{if(l)return;const ee=L()||typeof N!="number"||!Number.isFinite(N)?0:N,te=vs(ee+V,e.currency,r);q(te)||(j(String(te)),C(te),F(te))},ne=k.isValid&&k.change>0,G=!k.isValid&&k.received>0,se=he(k.change,r,e.currency),K=he(e.value,r,e.currency),[J,Q]=h.useState(""),W=h.useRef(null);h.useEffect(()=>{W.current&&clearTimeout(W.current);const V=ne?Ft(x.changeMessageTemplate,{change:se}):"",ee=ne?Uf:0;return W.current=setTimeout(()=>Q(V),ee),()=>{W.current&&clearTimeout(W.current)}},[ne,se,x.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:_,id:ie,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:b===0?"numeric":"decimal",pattern:b===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:D,onChange:V=>E(V.target.value),onFocus:R,onBlur:S,placeholder:x.receivedPlaceholder,isDisabled:l,isInvalid:G,errorMessage:G?Ft(x.insufficientMessageTemplate,{due:K}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-received-input`}),T.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":x.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(O,{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:l,"aria-label":Ft(x.exactAmountAriaTemplate,{amount:K}),onPress:Y,"data-testid":`${p}-quick-amount-exact`,children:[x.exactAmountLabel," ",K]}),T.map(V=>{const ee=Gf(V,r,e.currency);return t.jsx(O,{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:l,"aria-label":Ft(x.quickAmountAriaTemplate,{amount:ee}),onPress:()=>z(V),"data-testid":`${p}-quick-amount-${V}`,children:ee},V)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:Ft(x.changeMessageTemplate,{change:se}),icon:t.jsx(I,{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:J})]})},Qf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Ha=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},ml=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":p="check-tender-form"})=>{const x={...Qf,...r},b=n!==void 0,[y,g]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Ha()}),[w,N]=h.useState(!!s?.checkNumber),D=h.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Ha()}:y,[b,n,y]),j=h.useCallback(F=>{b||g(F);const E=F.checkNumber.trim(),_={amount:e.value,checkNumber:E,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:E.length>0&&e.value>0};a?.(_)},[b,e.value,i,a]),S=h.useCallback(F=>E=>{o||(F==="checkNumber"&&E.length>0&&N(!0),j({...D,[F]:E}))},[D,j,o]),L=h.useCallback(()=>{o||N(!0)},[o]),C=w&&D.checkNumber.trim()==="",$=`${p}-check-number`,k=`${p}-bank-name`,R=`${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:$,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:D.checkNumber,onChange:F=>S("checkNumber")(F.target.value),onBlur:L,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:C,errorMessage:C?x.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-check-number-input`}),!l&&t.jsx(c.Input,{id:k,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:D.bankName,onChange:F=>S("bankName")(F.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:R,label:x.dateLabel,labelPlacement:"outside",type:"date",value:D.date,onChange:F=>S("date")(F.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};ml.displayName="CheckTenderForm";const Zf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Xf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],fl=({dueAmount:e,methodOptions:n=Xf,value:s,defaultValue:a,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Zf,...i},m=s!==void 0,[p,x]=h.useState({method:a?.method??"",reference:a?.reference??""}),b=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:p,[m,s,p]),y=h.useCallback(S=>n.find(L=>L.value===S)?.label??"",[n]),g=h.useCallback(S=>{m||x(S);const L=y(S.method),C={amount:e.value,method:S.method,description:L,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(C)},[m,e.value,r,y]),w=h.useCallback(S=>{if(o)return;const L=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";g({...b,method:L})},[b,g,o]),N=h.useCallback(S=>{o||g({...b,reference:S})},[b,g,o]),D=`${u}-method`,j=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(He,{id:D,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:w,isDisabled:o,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:n.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),l&&t.jsx(c.Input,{id:j,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:S=>N(S.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};fl.displayName="OtherTenderForm";const Jf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},ex={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},tx={pending:"warning",recorded:"success",failed:"danger"},nx=e=>e==="pending"||e==="recorded",sx=e=>`#${e+1}`,xl=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:l="banner",className:o,"data-testid":d="split-payment-summary"})=>{const u={...Jf,...r},{collected:f,remaining:m,isComplete:p}=h.useMemo(()=>{const b=n.reduce((g,w)=>nx(w.status)?g+w.amount:g,0),y=Math.max(e.value-b,0);return{collected:b,remaining:y,isComplete:b>=e.value&&e.value>0}},[n,e.value]),x=b=>b==="pending"?u.statusPending:b==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",o),"data-testid":d,children:[l==="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:he(p?f: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:he(p?f:m,a,e.currency)})]}),!i&&n.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}),n.map((b,y)=>t.jsx(ax,{index:y,tender:b,locale:a,currency:e.currency,removable:!!s&&b.status!=="recorded",onRemove:s?()=>s(b.id):void 0,statusLabel:x(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${y}`},b.id))]})]})};xl.displayName="SplitPaymentSummary";const ax=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(I,{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:sx(e)}),t.jsx(I,{icon:ex[n.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:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:he(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:tx[n.status],startContent:n.status==="recorded"?t.jsx(I,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(I,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},rx=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(O,{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 tu({editor:e,isDisabled:n=!1}){const[s,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:g,to:y}=e.state.selection,b=e.isActive("link");let w="";if(b){const A=e.schema.marks.link,v=e.state.doc.resolve(g),S=sa.getMarkRange(v,A);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(g,y,"");const C=e.getAttributes("link").href||"";i(w),l(C),u(b)}a(x)},p=()=>{if(o.trim()){const{from:x,to:g}=e.state.selection,y=e.schema.marks.link,b=e.state.doc.resolve(x),w=sa.getMarkRange(b,y),C=w?.from??x,A=w?.to??g,v=e.state.doc.textBetween(C,A,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:C,to:A}).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:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"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:x=>i(x.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:x=>l(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function nu({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function Zr(e,n){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(l=>Ut(l)))).forEach(l=>{const d=nt[l];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[l]={isActive:f,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,n]),[a,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(n.map(d=>Ut(d)))).forEach(d=>{const u=nt[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),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,n,s]),a}function Xr(e,n){const s=h.useCallback((o,l)=>{if(!e)return;const d=nt[o];if(d)try{d.execute({editor:e,config:l}),n?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,n]),a=h.useCallback(o=>{s(o)},[s]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=nt[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=nt[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:s,toggleModifier:a,canExecute:r,isActive:i}}function su(e=Se.default){const[n,s]=h.useState(e),a=h.useCallback((l=Se.step)=>{s(d=>Math.min(Se.max,d+l))},[]),r=h.useCallback((l=Se.step)=>{s(d=>Math.max(Se.min,d-l))},[]),i=h.useCallback(()=>{s(Se.default)},[]),o=h.useCallback(l=>{const d=Math.max(Se.min,Math.min(Se.max,l));s(d)},[]);return{zoom:n,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=Se.min,isMaxZoom:n>=Se.max,isDefaultZoom:n===Se.default}}const au=["bold","italic","strike","underline","code"];function ru({editor:e,modifiers:n,onToolbarAction:s}){const a=Zr(e,n),{toggleModifier:r}=Xr(e,s);if(!e)return null;const i=n.map(o=>Ut(o)).filter(o=>au.includes(o));return i.length===0?null:t.jsx(nu,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=wt(o);return t.jsx(mt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function iu({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Zr(e,n),{toggleModifier:d,executeCommand:u}=Xr(e,o);if(!e)return null;const f=n.map(N=>Ut(N)),m=f.some(N=>["bold","italic","strike","underline","code"].includes(N)),p=f.some(N=>["textColor","highlight"].includes(N)),x=f.includes("heading"),g=f.includes("textAlign"),y=f.some(N=>["bulletList","orderedList","taskList"].includes(N)),b=f.includes("blockquote"),w=f.includes("codeBlock"),C=f.includes("link"),A=f.includes("horizontalRule"),v=f.some(N=>["undo","redo"].includes(N)),S=s!==void 0&&a!==void 0,L=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${L} ${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(ru,{editor:e,modifiers:n,onToolbarAction:o}),(p||x||g||y||b||w||C||A||v||S)&&t.jsx(dt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(Ca,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(Ca,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(x||g||y||b||w||C||A||v||S)&&t.jsx(dt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(Wd,{editor:e}),(g||y||b||w||C||A||v||S)&&t.jsx(dt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(N=>{const $=Xd[N],k=e.isActive({textAlign:N});return t.jsx(mt,{icon:$,label:`Align ${N}`,isActive:k,onClick:()=>u("textAlign",{type:"textAlign",alignment:N})},N)})}),(y||b||w||C||A||v||S)&&t.jsx(dt,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(Gd,{editor:e,types:f.filter(N=>["bulletList","orderedList","taskList"].includes(N))}),(b||w||C||A||v||S)&&t.jsx(dt,{})]}),(b||w||C||A)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(mt,{icon:wt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(mt,{icon:wt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),C&&t.jsx(tu,{editor:e,isDisabled:l.link?.isDisabled}),A&&t.jsx(mt,{icon:wt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||S)&&t.jsx(dt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(mt,{icon:wt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(mt,{icon:wt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(dt,{})]}),S&&t.jsx(eu,{zoom:s,onZoomChange:N=>{a?.(N),o?.({type:"zoom",modifier:`${N}%`})}})]})})}const Ft={bold:{category:"mark",extension:Fo.Bold,priority:100},italic:{category:"mark",extension:Lo.Italic,priority:100},strike:{category:"mark",extension:Ro.Strike,priority:100},underline:{category:"mark",extension:Mo.Underline,priority:100},code:{category:"mark",extension:_o.Code,priority:100},textColor:{category:"mark",extension:Po.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:To.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Io.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:zo.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Vo.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Uo.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Ho.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Go.CodeBlock,priority:100},blockquote:{category:"node",extension:Yo.Blockquote,priority:100},horizontalRule:{category:"node",extension:Ko.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Qo.HardBreak,priority:100},undo:{category:"extension",extension:aa.History,priority:50},redo:{category:"extension",extension:aa.History,priority:50},textAlign:{category:"extension",extension:Zo.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}},lu=[Xo.Document,Jo.Text,Bo.Paragraph,Oo.TextStyle.configure({HTMLAttributes:{}}),Wo.ListItem.configure({HTMLAttributes:{}}),qo.TaskItem.configure({nested:!0}),ec.Dropcursor,tc.Gapcursor];function ou(e){const n=[],s=new Set,a=new Set;lu.forEach(l=>{l&&(n.push(l),a.add(l.name))});const r=e.map(l=>Ut(l)),i=new Set;return r.forEach(l=>{const d=Ft[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=Ft[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=Ft[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(a.has(u)){s.add(l);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(l),a.add(u)}),n.sort((l,d)=>{const u=Object.values(Ft).find(x=>x?.extension?.name===l.name),f=Object.values(Ft).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Jr={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"]},cu={h1:`font-size: ${pe.fontSize["4xl"]}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,h2:`font-size: ${pe.fontSize["2xl"]}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,h3:`font-size: ${pe.fontSize.xl}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,h4:`font-size: ${pe.fontSize.lg}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,h5:`font-size: ${pe.fontSize.base}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,h6:`font-size: ${pe.fontSize.sm}; font-weight: ${pe.fontWeight.semibold}; line-height: ${pe.lineHeight.tight}; margin: ${fe.md} 0 ${fe.sm} 0;`,p:`min-height: ${pe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${fe.xl}; margin: ${fe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${fe.xl}; margin: ${fe.md} 0;`,li:`display: list-item; margin: ${fe.xs} 0;`,strong:`font-weight: ${pe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ce.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${pe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${pe.fontFamily.mono};`,pre:`background: ${Ce.neutral.gray[800]}; border-radius: ${fe.sm}; color: ${Ce.neutral.gray[100]}; font-family: ${pe.fontFamily.mono}; margin: ${fe.lg} 0; padding: 0.75rem ${fe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ce.neutral.gray[300]}; margin: ${fe.lg} 0; padding-left: ${fe.md}; color: ${Ce.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ce.neutral.gray[200]}; margin: ${fe.xl} 0;`,a:`color: ${Ce.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ce.palettes.warning[200]}; border-radius: ${fe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${fe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},du={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 uu(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(du)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(cu)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.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 n}const mu=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=ps.useCurrentEditor();return t.jsx(iu,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},fu=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=ps.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.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"]}),n&&t.jsxs("span",{children:[i," words"]})]})},is=h.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Jr.full,variant:u="bordered",initialContent:f,content:m,onContentChange:p,onUpdate:x,onToolbarAction:g,isReadOnly:y=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...C}=e,{zoom:A,setZoom:v}=su(),S=Na.lineHeight,L=s*S,N=r?void 0:a*S,$=h.useMemo(()=>ou(d),[d]),{Component:k,label:M,shouldLabelBeOutside:F,getBaseProps:E,getLabelProps:_,getInputWrapperProps:I}=c.useInput({...C,variant:u,ref:n,isMultiline:!0}),W=M?t.jsx("label",{..._(),children:M}):null,K=h.useCallback(({editor:z})=>{const ne=z.getHTML(),G=w?uu(ne):ne,se=z.getJSON(),Y=z.getText(),J=Y.length,Q=Y.split(/\s+/).filter(oe=>oe.length>0).length,q={html:G,json:se,text:Y,characters:J,words:Q};if(p?.(q),x?.(q),"onChange"in C&&typeof C.onChange=="function"){const oe={target:{value:G},currentTarget:{value:G}};C.onChange(oe)}},[p,x,C,w]);return t.jsxs(k,{...E(),children:[F?W:null,t.jsx("div",{...I(),className:c.cn(I().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:N?`${N+Na.toolbarHeight}px`:void 0,overflow:N?"auto":void 0},children:t.jsx(ps.EditorProvider,{editable:!y&&!b,slotBefore:l?t.jsx(mu,{modifiers:d,zoom:A,onZoomChange:v,onToolbarAction:g}):void 0,slotAfter:t.jsx(fu,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${L}px`,fontSize:`${A}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:$,content:m||f||e.defaultValue||"",onUpdate:K})})]})});is.displayName="TipTapEditor";const ei=h.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(is,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(is,{...r,variant:a,ref:n}))});ei.displayName="RichTextArea";function xu(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const ka=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],hu={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},ti=({presetAmounts:e=ka,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:p=3,isDisabled:x=!1,buttonVariant:g="bordered",buttonColor:y="default",inputVariant:b="bordered",size:w="md",className:C="",showCard:A=!0})=>{const v={...hu,...f},S=Array.isArray(e)?e:ka,L={2:"grid-cols-2",3:"grid-cols-3"},N={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},$=`${L[m]} ${N[p]}`,[k,M]=wn(n,s,a),[F,E]=h.useState(""),[_,I]=h.useState(!1),[W,K]=h.useState(0),z=h.useCallback(J=>{if(x)return;const Q={amount:J.amount,isCustom:!1,presetId:J.id};M(Q),E(""),I(!1),K(q=>q+1),r?.(Q)},[x,M,r]),ne=h.useCallback(J=>{if(x)return;if(E(J!==void 0?String(J):""),r){M(null);return}if(J===void 0||isNaN(J)){M(null);return}M({amount:J,isCustom:!0})},[x,M,r]),G=h.useCallback(()=>{if(x)return;const J=F!==""?parseFloat(F):void 0;J===void 0||isNaN(J)||r?.({amount:J,isCustom:!0})},[x,F,r]),se=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),Y=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[v.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:v.title}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",$),"data-testid":"donation-amounts-presets",children:S.map(J=>{const Q=k!==null&&!k.isCustom&&k.presetId===J.id;return t.jsx(O,{color:Q?"primary":y,variant:Q?"solid":g,className:"w-full",onPress:()=>z(J),isDisabled:x,"data-testid":`donation-amounts-preset-${J.id}`,children:J.label||xu(J.amount,o,i)},J.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{M(null),I(!0)}:void 0,variant:b,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:se,value:F!==""?parseFloat(F):void 0,onValueChange:ne,isDisabled:x,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-${W}`:k?.isCustom===!1?k.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:G,isDisabled:x||!_,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return A?t.jsx(c.Card,{className:c.cn("w-full",C),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Y})}):t.jsx("div",{className:c.cn("w-full",C),"data-testid":"donation-amounts-plain",children:Y})};ti.displayName="DonationAmounts";const pu=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},gu=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},bu=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"}},ni=h.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=pu,className:p,...x},g)=>{const[y,b]=wn(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),w=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),h.useEffect(()=>{if(!f||y<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(L=>L<=1?(w.current&&(clearInterval(w.current),w.current=null),C.current||(C.current=!0,a?.()),0):L-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,y,b,a]),h.useEffect(()=>{y>0&&(C.current=!1)},[y]);const A=d||gu(r),v=bu(i),S={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(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,S[u],p),...x,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(A,{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(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});ni.displayName="ExpireCartTimer";const gt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(T,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),yu=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:f="eager",showMoreButtonClassName:m,labels:p})=>{const[x,g]=h.useState(!1),[y,b]=h.useState(!1),w=h.useRef(null);return h.useEffect(()=>{const C=()=>{if(w.current){const A=w.current.scrollHeight>w.current.clientHeight;b(A)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[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&&s&&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:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"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:n}),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(gt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(gt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(gt,{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:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&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"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(T,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:x?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&&s&&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:f,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"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:n})]}),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(gt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(gt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(gt,{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:w,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&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"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>g(!x),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(T,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function ls(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function vu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const ju={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"},bt=e=>typeof e=="number"&&!isNaN(e),dn=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:x=!0,showPrice:g=!0,priceDisplay:y,classNames:b={},"data-testid":w,selectedColor:C="default",selectionMode:A="stepper",compact:v=!1,isSoldOut:S,isMaxReached:L,isRuleBlocked:N,statusTone:$="default",statusLabel:k,disabledReason:M,disabled:F})=>{const E=h.useMemo(()=>({...ju,...o}),[o]),[_,I]=h.useState(s),W=n!==void 0?n:_,K=!!(d||F),z=v||!!e.compact,ne=A==="press-to-add",G=h.useMemo(()=>typeof S=="boolean"?S:typeof e.isSoldOut=="boolean"?e.isSoldOut:!bt(e.totalTicketsSold)||!bt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[S,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),se=h.useMemo(()=>typeof L=="boolean"?L:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!bt(e.ticketsAllowed)?!1:W>=e.ticketsAllowed-(e.totalTicketsSold??0),[L,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,W]),Y=h.useMemo(()=>typeof N=="boolean"?N:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[N,e.isRuleBlocked]),J=M||e.disabledReason,Q=K||G||Y,q=ue=>{if(Q||ue>0&&se)return;const we=Math.max(0,W+ue);n===void 0&&I(we),a?.(e.id,we)},oe=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),V=h.useMemo(()=>$||(G||Y?"danger":se?"warning":"default"),[$,G,Y,se]),ee=h.useMemo(()=>{if(oe)return oe==="ruleBlocked"?k||J||E.ruleBlocked:oe==="soldOut"?k||J||E.soldOut:oe==="disabled"?k||J||E.disabled:k||E.maxReached},[oe,k,J,E]),te={soldOut:"danger",ruleBlocked:V,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"},Le=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",b.name),children:e.name}),_e=()=>{if(!g)return null;const ue=y?.price??e.price,we=y?.originalPrice,Ke=ls(ue,i,r);if(l?.renderPrice)return l.renderPrice(ue,Ke,e);if(bt(we)&&bt(ue)&&we>ue){const D=ls(we,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",D,", discounted price ",Ke]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",b.originalPrice),children:D}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",b.discountedPrice),children:Ke})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",b.price),children:Ke})},pt=()=>!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",z&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Ze=()=>{if(!x||!bt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ue=e.numberOfPeople===1?E.person:E.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",z&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(T,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",ue]})},Ye=()=>{const ue=W===0||Q,we=se||Q;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:W,onIncrement:()=>q(1),onDecrement:()=>q(-1),isDecrementDisabled:ue,isIncrementDisabled:we,isDisabled:Q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>q(-1),isDisabled:ue,variant:u,color:W>0?C:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(T,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:W}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>q(1),isDisabled:we,variant:u,color:W>0?C:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(T,{icon:"gravity-ui:plus",width:16})})]})},ot=(ue,we)=>l?.renderDisabledState?l.renderDisabledState(ue,we):ue==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(we):ue==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(we):t.jsx(c.Chip,{"data-testid":Be[ue],color:te[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,z&&"h-8"),startContent:t.jsx(T,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:we})}),st=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",Q||se?"opacity-50 pointer-events-none select-none":""),children:[Le(),_e(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[Ze(),pt()]})]}),!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",z&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:oe&&ee?ot(oe,ee):Ye()})]}),Ve=se&&!G&&!Y&&!K?t.jsx(Fe.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:ot("maxReached",ee||E.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!Q&&!se&&"cursor-pointer",z&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,isPressable:ne&&!Q&&!se,onPress:ne&&!Q&&!se?()=>q(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:st}),t.jsx(Fe.AnimatePresence,{children:Ve&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ve})})]}):t.jsxs("div",{className:c.cn("w-full",z&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",b.body),children:st}),t.jsx(Fe.AnimatePresence,{children:Ve&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",b.footer),children:Ve})})]})};dn.displayName="OfferCard";const si=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=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(T,{"data-testid":"offer-card-empty-icon",icon:n,width:s,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})};si.displayName="OfferCardEmpty";const wu={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ai=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...wu,...n},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?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})};ai.displayName="OfferCardError";const Nu={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},ri=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=Nu[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.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))})};ri.displayName="OfferCardSkeleton";const ii={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},li={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"}}},Cu={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},oi=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:x=!0,animated:g=!0,gap:y=2,compact:b=!1,classNames:w={}})=>{const[C,A]=h.useState(a),v=s!==void 0?s:C,S=h.useCallback((F,E)=>{const _={...v,[F]:Math.max(0,E)};s===void 0&&A(_),r?.(_),i?.(F,_[F])},[v,s,r,i]),L=[...e].sort((F,E)=>(F.position??0)-(E.position??0)),N=F=>{const E=n?n(F):F,_=(v??{})[E.id]||0;return{offer:E,quantity:_,onQuantityChange:S,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b}},$=Cu[y],k=c.cn("grid mx-auto pt-2",$,w.base),M=F=>{const E=N(F);return t.jsx(dn,{offer:E.offer,quantity:E.quantity,onQuantityChange:E.onQuantityChange,currency:E.currency,locale:E.locale,labels:E.labels,slots:E.slots,isDisabled:E.isDisabled,buttonVariant:E.buttonVariant,buttonColor:E.buttonColor,showCard:E.showCard,compact:E.compact,classNames:w.card},E.offer.id)};return g?t.jsx(Fe.motion.div,{"data-testid":"offer-card-list",className:k,variants:ii,initial:"hidden",animate:"show",children:t.jsx(Fe.AnimatePresence,{children:L.map(F=>{const E=N(F);return t.jsx(Fe.motion.div,{"data-testid":`offer-card-list-item-${E.offer.id}`,className:w.cardWrapper,variants:li,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(dn,{offer:E.offer,quantity:E.quantity,onQuantityChange:S,currency:o,locale:l,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:p,showCard:x,compact:b||E.offer.compact,classNames:w.card})},E.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:k,children:L.map(M)})};oi.displayName="OfferCardList";var qt=e=>e.type==="checkbox",ft=e=>e instanceof Date,Me=e=>e==null;const ci=e=>typeof e=="object";var je=e=>!Me(e)&&!Array.isArray(e)&&ci(e)&&!ft(e),di=e=>je(e)&&e.target?qt(e.target)?e.target.checked:e.target.value:e,ku=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ui=(e,n)=>e.has(ku(n)),Su=e=>{const n=e.constructor&&e.constructor.prototype;return je(n)&&n.hasOwnProperty("isPrototypeOf")},As=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function be(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(As&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(je(e)&&Su(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=be(e[r]));return a}var Nn=e=>/^\w*$/.test(e),he=e=>e===void 0,Ds=e=>Array.isArray(e)?e.filter(Boolean):[],Es=e=>Ds(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,s)=>{if(!n||!je(e))return s;const a=(Nn(n)?[n]:Es(n)).reduce((r,i)=>Me(r)?r:r[i],e);return he(a)||a===e?he(e[n])?s:e[n]:a},Ie=e=>typeof e=="boolean",Ee=e=>typeof e=="function",me=(e,n,s)=>{let a=-1;const r=Nn(n)?[n]:Es(n),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=s;if(a!==o){const u=e[l];d=je(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const un={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},qe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Xe={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mi=h.createContext(null);mi.displayName="HookFormControlContext";const Fs=()=>h.useContext(mi);var fi=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return n._proxyFormState[o]!==qe.all&&(n._proxyFormState[o]=!a||qe.all),s&&(s[o]=!0),e[o]}});return r};const Ls=typeof window<"u"?h.useLayoutEffect:h.useEffect;function $u(e){const n=Fs(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(s._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ls(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>fi(o,s,d.current,!1),[o,s])}var Oe=e=>typeof e=="string",os=(e,n,s,a,r)=>Oe(e)?(a&&n.watch.add(e),H(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),H(s,i))):(a&&(n.watchAll=!0),s),cs=e=>Me(e)||!ci(e);function We(e,n,s=new WeakSet){if(cs(e)||cs(n))return Object.is(e,n);if(ft(e)&&ft(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=n[i];if(ft(o)&&ft(l)||je(o)&&je(l)||Array.isArray(o)&&Array.isArray(l)?!We(o,l,s):!Object.is(o,l))return!1}}return!0}function Au(e){const n=Fs(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),f=h.useRef(void 0),m=h.useRef(s),p=h.useRef(a);u.current=l;const[x,g]=h.useState(()=>{const v=s._getWatch(a,d.current);return u.current?u.current(v):v}),y=h.useCallback(v=>{const S=os(a,s._names,v||s._formValues,!1,d.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),b=h.useCallback(v=>{if(!i){const S=os(a,s._names,v||s._formValues,!1,d.current);if(u.current){const L=u.current(S);We(L,f.current)||(g(L),f.current=L)}else g(S)}},[s._formValues,s._names,i,a]);Ls(()=>((m.current!==s||!We(p.current,a))&&(m.current=s,p.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:v=>{b(v.values)}})),[s,o,a,b]),h.useEffect(()=>s._removeUnmounted());const w=m.current!==s,C=p.current,A=h.useMemo(()=>{if(i)return null;const v=!w&&!We(C,a);return w||v?y():null},[i,w,a,C,y]);return A!==null?A:x}function Du(e){const n=Fs(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=ui(r._names.array,s),u=h.useMemo(()=>H(r._formValues,s,H(r._defaultValues,s,o)),[r,s,o]),f=Au({control:r,name:s,defaultValue:u,exact:l}),m=$u({control:r,name:s,exact:l}),p=h.useRef(e),x=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:f,...Ie(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const y=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,s)},error:{enumerable:!0,get:()=>H(m.errors,s)}}),[m,s]),b=h.useCallback(v=>g.current.onChange({target:{value:di(v),name:s},type:un.CHANGE}),[s]),w=h.useCallback(()=>g.current.onBlur({target:{value:H(r._formValues,s),name:s},type:un.BLUR}),[s,r._formValues]),C=h.useCallback(v=>{const S=H(r._fields,s);S&&S._f&&v&&(S._f.ref={focus:()=>Ee(v.focus)&&v.focus(),select:()=>Ee(v.select)&&v.select(),setCustomValidity:L=>Ee(v.setCustomValidity)&&v.setCustomValidity(L),reportValidity:()=>Ee(v.reportValidity)&&v.reportValidity()})},[r._fields,s]),A=h.useMemo(()=>({name:s,value:f,...Ie(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:b,onBlur:w,ref:C}),[s,a,m.disabled,b,w,C,f]);return h.useEffect(()=>{const v=r._options.shouldUnregister||i,S=x.current;S&&S!==s&&!d&&r.unregister(S),r.register(s,{...p.current.rules,...Ie(p.current.disabled)?{disabled:p.current.disabled}:{}});const L=(N,$)=>{const k=H(r._fields,N);k&&k._f&&(k._f.mount=$)};if(L(s,!0),v){const N=be(H(r._options.defaultValues,s,p.current.defaultValue));me(r._defaultValues,s,N),he(H(r._formValues,s))&&me(r._formValues,s,N)}return!d&&r.register(s),x.current=s,()=>{(d?v&&!r._state.action:v)?r.unregister(s):L(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),h.useMemo(()=>({field:A,formState:m,fieldState:y}),[A,m,y])}const Eu=h.createContext(null);Eu.displayName="HookFormContext";var Fu=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},Ot=e=>Array.isArray(e)?e:[e],Sa=()=>{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 xi(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&je(r)&&i){const o=xi(r,i);je(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var De=e=>je(e)&&!Object.keys(e).length,Rs=e=>e.type==="file",mn=e=>{if(!As)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},hi=e=>e.type==="select-multiple",Ms=e=>e.type==="radio",Lu=e=>Ms(e)||qt(e),zn=e=>mn(e)&&e.isConnected;function Ru(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=he(e)?a++:e[n[a++]];return e}function Mu(e){for(const n in e)if(e.hasOwnProperty(n)&&!he(e[n]))return!1;return!0}function ye(e,n){const s=Array.isArray(n)?n:Nn(n)?[n]:Es(n),a=s.length===1?e:Ru(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(je(a)&&De(a)||Array.isArray(a)&&Mu(a))&&ye(e,s.slice(0,-1)),e}var _u=e=>{for(const n in e)if(Ee(e[n]))return!0;return!1};function pi(e){return Array.isArray(e)||je(e)&&!_u(e)}function ds(e,n={}){for(const s in e){const a=e[s];pi(a)?(n[s]=Array.isArray(a)?[]:{},ds(a,n[s])):he(a)||(n[s]=!0)}return n}function Nt(e,n,s){s||(s=ds(n));for(const a in e){const r=e[a];if(pi(r))he(n)||cs(s[a])?s[a]=ds(r,Array.isArray(r)?[]:{}):Nt(r,Me(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!We(r,i)}}return s}const $a={value:!1,isValid:!1},Aa={value:!0,isValid:!0};var gi=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!he(e[0].attributes.value)?he(e[0].value)||e[0].value===""?Aa:{value:e[0].value,isValid:!0}:Aa:$a}return $a},bi=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>he(e)?e:n?e===""?NaN:e&&+e:s&&Oe(e)?new Date(e):a?a(e):e;const Da={isValid:!1,value:null};var yi=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,Da):Da;function Ea(e){const n=e.ref;return Rs(n)?n.files:Ms(n)?yi(e.refs).value:hi(n)?[...n.selectedOptions].map(({value:s})=>s):qt(n)?gi(e.refs).value:bi(he(n.value)?e.ref.value:n.value,e)}var Pu=(e,n,s,a)=>{const r={};for(const i of e){const o=H(n,i);o&&me(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},fn=e=>e instanceof RegExp,Lt=e=>he(e)?e:fn(e)?e.source:je(e)?fn(e.value)?e.value.source:e.value:e,Fa=e=>({isOnSubmit:!e||e===qe.onSubmit,isOnBlur:e===qe.onBlur,isOnChange:e===qe.onChange,isOnAll:e===qe.all,isOnTouch:e===qe.onTouched});const La="AsyncFunction";var Tu=e=>!!e&&!!e.validate&&!!(Ee(e.validate)&&e.validate.constructor.name===La||je(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===La)),Iu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ra=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const zt=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=H(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&n(o.refs[0],r)&&!a)return!0;if(o.ref&&n(o.ref,o.name)&&!a)return!0;if(zt(l,n))break}else if(je(l)&&zt(l,n))break}}};function Ma(e,n,s){const a=H(e,s);if(a||Nn(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=H(n,i),l=H(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};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:s}}var Ou=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return De(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(o=>n[o]===(!a||qe.all))},zu=(e,n,s)=>!e||!n||e===n||Ot(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Bu=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,Vu=(e,n)=>!Ds(H(e,n)).length&&ye(e,n),Uu=(e,n,s)=>{const a=Ot(H(e,s));return me(a,"root",n[s]),me(e,s,a),e};function _a(e,n,s="validate"){if(Oe(e)||Array.isArray(e)&&e.every(Oe)||Ie(e)&&!e)return{type:s,message:Oe(e)?e:"",ref:n}}var yt=e=>je(e)&&!fn(e)?e:{value:e,message:""},Pa=async(e,n,s,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:f,min:m,max:p,pattern:x,validate:g,name:y,valueAsNumber:b,mount:w}=e._f,C=H(s,y);if(!w||n.has(y))return{};const A=l?l[0]:o,v=E=>{r&&A.reportValidity&&(A.setCustomValidity(Ie(E)?"":E||""),A.reportValidity())},S={},L=Ms(o),N=qt(o),$=L||N,k=(b||Rs(o))&&he(o.value)&&he(C)||mn(o)&&o.value===""||C===""||Array.isArray(C)&&!C.length,M=Fu.bind(null,y,a,S),F=(E,_,I,W=Xe.maxLength,K=Xe.minLength)=>{const z=E?_:I;S[y]={type:E?W:K,message:z,ref:o,...M(E?W:K,z)}};if(i?!Array.isArray(C)||!C.length:d&&(!$&&(k||Me(C))||Ie(C)&&!C||N&&!gi(l).isValid||L&&!yi(l).isValid)){const{value:E,message:_}=Oe(d)?{value:!!d,message:d}:yt(d);if(E&&(S[y]={type:Xe.required,message:_,ref:A,...M(Xe.required,_)},!a))return v(_),S}if(!k&&(!Me(m)||!Me(p))){let E,_;const I=yt(p),W=yt(m);if(!Me(C)&&!isNaN(C)){const K=o.valueAsNumber||C&&+C;Me(I.value)||(E=K>I.value),Me(W.value)||(_=K<W.value)}else{const K=o.valueAsDate||new Date(C),z=se=>new Date(new Date().toDateString()+" "+se),ne=o.type=="time",G=o.type=="week";Oe(I.value)&&C&&(E=ne?z(C)>z(I.value):G?C>I.value:K>new Date(I.value)),Oe(W.value)&&C&&(_=ne?z(C)<z(W.value):G?C<W.value:K<new Date(W.value))}if((E||_)&&(F(!!E,I.message,W.message,Xe.max,Xe.min),!a))return v(S[y].message),S}if((u||f)&&!k&&(Oe(C)||i&&Array.isArray(C))){const E=yt(u),_=yt(f),I=!Me(E.value)&&C.length>+E.value,W=!Me(_.value)&&C.length<+_.value;if((I||W)&&(F(I,E.message,_.message),!a))return v(S[y].message),S}if(x&&!k&&Oe(C)){const{value:E,message:_}=yt(x);if(fn(E)&&!C.match(E)&&(S[y]={type:Xe.pattern,message:_,ref:o,...M(Xe.pattern,_)},!a))return v(_),S}if(g){if(Ee(g)){const E=await g(C,s),_=_a(E,A);if(_&&(S[y]={..._,...M(Xe.validate,_.message)},!a))return v(_.message),S}else if(je(g)){let E={};for(const _ in g){if(!De(E)&&!a)break;const I=_a(await g[_](C,s),A,_);I&&(E={...I,...M(_,I.message)},v(I.message),a&&(S[y]=E))}if(!De(E)&&(S[y]={ref:A,...E},!a))return S}}return v(!0),S};const Hu={mode:qe.onSubmit,reValidateMode:qe.onChange,shouldFocusError:!0};function qu(e={}){let n={...Hu,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ee(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=je(n.defaultValues)||je(n.values)?be(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:be(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 f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let p={...m};const x={array:Sa(),state:Sa()},g=n.criteriaMode===qe.all,y=j=>D=>{clearTimeout(u),u=setTimeout(j,D)},b=async j=>{if(!o.keepIsValid&&!n.disabled&&(m.isValid||p.isValid||j)){let D;n.resolver?(D=De((await $()).errors),w()):D=await M(a,!0),D!==s.isValid&&x.state.next({isValid:D})}},w=(j,D)=>{!n.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((j||Array.from(l.mount)).forEach(R=>{R&&(D?me(s.validatingFields,R,D):ye(s.validatingFields,R))}),x.state.next({validatingFields:s.validatingFields,isValidating:!De(s.validatingFields)}))},C=(j,D=[],R,U,B=!0,P=!0)=>{if(U&&R&&!n.disabled){if(o.action=!0,P&&Array.isArray(H(a,j))){const Z=R(H(a,j),U.argA,U.argB);B&&me(a,j,Z)}if(P&&Array.isArray(H(s.errors,j))){const Z=R(H(s.errors,j),U.argA,U.argB);B&&me(s.errors,j,Z),Vu(s.errors,j)}if((m.touchedFields||p.touchedFields)&&P&&Array.isArray(H(s.touchedFields,j))){const Z=R(H(s.touchedFields,j),U.argA,U.argB);B&&me(s.touchedFields,j,Z)}(m.dirtyFields||p.dirtyFields)&&(s.dirtyFields=Nt(r,i)),x.state.next({name:j,isDirty:E(j,D),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else me(i,j,D)},A=(j,D)=>{me(s.errors,j,D),x.state.next({errors:s.errors})},v=j=>{s.errors=j,x.state.next({errors:s.errors,isValid:!1})},S=(j,D,R,U)=>{const B=H(a,j);if(B){const P=H(i,j,he(R)?H(r,j):R);he(P)||U&&U.defaultChecked||D?me(i,j,D?P:Ea(B._f)):W(j,P),o.mount&&!o.action&&b()}},L=(j,D,R,U,B)=>{let P=!1,Z=!1;const ce={name:j};if(!n.disabled){if(!R||U){(m.isDirty||p.isDirty)&&(Z=s.isDirty,s.isDirty=ce.isDirty=E(),P=Z!==ce.isDirty);const de=We(H(r,j),D);Z=!!H(s.dirtyFields,j),de?ye(s.dirtyFields,j):me(s.dirtyFields,j,!0),ce.dirtyFields=s.dirtyFields,P=P||(m.dirtyFields||p.dirtyFields)&&Z!==!de}if(R){const de=H(s.touchedFields,j);de||(me(s.touchedFields,j,R),ce.touchedFields=s.touchedFields,P=P||(m.touchedFields||p.touchedFields)&&de!==R)}P&&B&&x.state.next(ce)}return P?ce:{}},N=(j,D,R,U)=>{const B=H(s.errors,j),P=(m.isValid||p.isValid)&&Ie(D)&&s.isValid!==D;if(n.delayError&&R?(d=y(()=>A(j,R)),d(n.delayError)):(clearTimeout(u),d=null,R?me(s.errors,j,R):ye(s.errors,j)),(R?!We(B,R):B)||!De(U)||P){const Z={...U,...P&&Ie(D)?{isValid:D}:{},errors:s.errors,name:j};s={...s,...Z},x.state.next(Z)}},$=async j=>(w(j,!0),await n.resolver(i,n.context,Pu(j||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),k=async j=>{const{errors:D}=await $(j);if(w(j),j)for(const R of j){const U=H(D,R);U?me(s.errors,R,U):ye(s.errors,R)}else s.errors=D;return D},M=async(j,D,R={valid:!0})=>{for(const U in j){const B=j[U];if(B){const{_f:P,...Z}=B;if(P){const ce=l.array.has(P.name),de=B._f&&Tu(B._f);de&&m.validatingFields&&w([P.name],!0);const $e=await Pa(B,l.disabled,i,g,n.shouldUseNativeValidation&&!D,ce);if(de&&m.validatingFields&&w([P.name]),$e[P.name]&&(R.valid=!1,D||e.shouldUseNativeValidation))break;!D&&(H($e,P.name)?ce?Uu(s.errors,$e,P.name):me(s.errors,P.name,$e[P.name]):ye(s.errors,P.name))}!De(Z)&&await M(Z,D,R)}}return R.valid},F=()=>{for(const j of l.unMount){const D=H(a,j);D&&(D._f.refs?D._f.refs.every(R=>!zn(R)):!zn(D._f.ref))&&te(j)}l.unMount=new Set},E=(j,D)=>!n.disabled&&(j&&D&&me(i,j,D),!We(Y(),r)),_=(j,D,R)=>os(j,l,{...o.mount?i:he(D)?r:Oe(j)?{[j]:D}:D},R,D),I=j=>Ds(H(o.mount?i:r,j,n.shouldUnregister?H(r,j,[]):[])),W=(j,D,R={})=>{const U=H(a,j);let B=D;if(U){const P=U._f;P&&(!P.disabled&&me(i,j,bi(D,P)),B=mn(P.ref)&&Me(D)?"":D,hi(P.ref)?[...P.ref.options].forEach(Z=>Z.selected=B.includes(Z.value)):P.refs?qt(P.ref)?P.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(B)?Z.checked=!!B.find(ce=>ce===Z.value):Z.checked=B===Z.value||!!B)}):P.refs.forEach(Z=>Z.checked=Z.value===B):Rs(P.ref)?P.ref.value="":(P.ref.value=B,P.ref.type||x.state.next({name:j,values:be(i)})))}(R.shouldDirty||R.shouldTouch)&&L(j,B,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&se(j)},K=(j,D,R)=>{for(const U in D){if(!D.hasOwnProperty(U))return;const B=D[U],P=j+"."+U,Z=H(a,P);(l.array.has(j)||je(B)||Z&&!Z._f)&&!ft(B)?K(P,B,R):W(P,B,R)}},z=(j,D,R={})=>{const U=H(a,j),B=l.array.has(j),P=be(D);me(i,j,P),B?(x.array.next({name:j,values:be(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&R.shouldDirty&&x.state.next({name:j,dirtyFields:Nt(r,i),isDirty:E(j,P)})):U&&!U._f&&!Me(P)?K(j,P,R):W(j,P,R),Ra(j,l)?x.state.next({...s,name:j,values:be(i)}):x.state.next({name:o.mount?j:void 0,values:be(i)})},ne=async j=>{o.mount=!0;const D=j.target;let R=D.name,U=!0;const B=H(a,R),P=de=>{U=Number.isNaN(de)||ft(de)&&isNaN(de.getTime())||We(de,H(i,R,de))},Z=Fa(n.mode),ce=Fa(n.reValidateMode);if(B){let de,$e;const ct=D.type?Ea(B._f):di(j),at=j.type===un.BLUR||j.type===un.FOCUS_OUT,Ao=!Iu(B._f)&&!n.resolver&&!H(s.errors,R)&&!B._f.deps||Bu(at,H(s.touchedFields,R),s.isSubmitted,ce,Z),Dn=Ra(R,l,at);me(i,R,ct),at?(!D||!D.readOnly)&&(B._f.onBlur&&B._f.onBlur(j),d&&d(0)):B._f.onChange&&B._f.onChange(j);const En=L(R,ct,at),Do=!De(En)||Dn;if(!at&&x.state.next({name:R,type:j.type,values:be(i)}),Ao)return(m.isValid||p.isValid)&&(n.mode==="onBlur"?at&&b():at||b()),Do&&x.state.next({name:R,...Dn?{}:En});if(!at&&Dn&&x.state.next({...s}),n.resolver){const{errors:ta}=await $([R]);if(w([R]),P(ct),U){const Eo=Ma(s.errors,a,R),na=Ma(ta,a,Eo.name||R);de=na.error,R=na.name,$e=De(ta)}}else w([R],!0),de=(await Pa(B,l.disabled,i,g,n.shouldUseNativeValidation))[R],w([R]),P(ct),U&&(de?$e=!1:(m.isValid||p.isValid)&&($e=await M(a,!0)));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&se(B._f.deps),N(R,$e,de,En))}},G=(j,D)=>{if(H(s.errors,D)&&j.focus)return j.focus(),1},se=async(j,D={})=>{let R,U;const B=Ot(j);if(n.resolver){const P=await k(he(j)?j:B);R=De(P),U=j?!B.some(Z=>H(P,Z)):R}else j?(U=(await Promise.all(B.map(async P=>{const Z=H(a,P);return await M(Z&&Z._f?{[P]:Z}:Z)}))).every(Boolean),!(!U&&!s.isValid)&&b()):U=R=await M(a);return x.state.next({...!Oe(j)||(m.isValid||p.isValid)&&R!==s.isValid?{}:{name:j},...n.resolver||!j?{isValid:R}:{},errors:s.errors}),D.shouldFocus&&!U&&zt(a,G,j?B:l.mount),U},Y=(j,D)=>{let R={...o.mount?i:r};return D&&(R=xi(D.dirtyFields?s.dirtyFields:s.touchedFields,R)),he(j)?R:Oe(j)?H(R,j):j.map(U=>H(R,U))},J=(j,D)=>({invalid:!!H((D||s).errors,j),isDirty:!!H((D||s).dirtyFields,j),error:H((D||s).errors,j),isValidating:!!H(s.validatingFields,j),isTouched:!!H((D||s).touchedFields,j)}),Q=j=>{j&&Ot(j).forEach(D=>ye(s.errors,D)),x.state.next({errors:j?s.errors:{}})},q=(j,D,R)=>{const U=(H(a,j,{_f:{}})._f||{}).ref,B=H(s.errors,j)||{},{ref:P,message:Z,type:ce,...de}=B;me(s.errors,j,{...de,...D,ref:U}),x.state.next({name:j,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&U&&U.focus&&U.focus()},oe=(j,D)=>Ee(j)?x.state.subscribe({next:R=>"values"in R&&j(_(void 0,D),R)}):_(j,D,!0),V=j=>x.state.subscribe({next:D=>{zu(j.name,D.name,j.exact)&&Ou(D,j.formState||m,ue,j.reRenderRoot)&&j.callback({values:{...i},...s,...D,defaultValues:r})}}).unsubscribe,ee=j=>(o.mount=!0,p={...p,...j.formState},V({...j,formState:{...f,...j.formState}})),te=(j,D={})=>{for(const R of j?Ot(j):l.mount)l.mount.delete(R),l.array.delete(R),D.keepValue||(ye(a,R),ye(i,R)),!D.keepError&&ye(s.errors,R),!D.keepDirty&&ye(s.dirtyFields,R),!D.keepTouched&&ye(s.touchedFields,R),!D.keepIsValidating&&ye(s.validatingFields,R),!n.shouldUnregister&&!D.keepDefaultValue&&ye(r,R);x.state.next({values:be(i)}),x.state.next({...s,...D.keepDirty?{isDirty:E()}:{}}),!D.keepIsValid&&b()},Be=({disabled:j,name:D})=>{if(Ie(j)&&o.mount||j||l.disabled.has(D)){const B=l.disabled.has(D)!==!!j;j?l.disabled.add(D):l.disabled.delete(D),B&&o.mount&&!o.action&&b()}},Le=(j,D={})=>{let R=H(a,j);const U=Ie(D.disabled)||Ie(n.disabled);return me(a,j,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:j}},name:j,mount:!0,...D}}),l.mount.add(j),R?Be({disabled:Ie(D.disabled)?D.disabled:n.disabled,name:j}):S(j,!0,D.value),{...U?{disabled:D.disabled||n.disabled}:{},...n.progressive?{required:!!D.required,min:Lt(D.min),max:Lt(D.max),minLength:Lt(D.minLength),maxLength:Lt(D.maxLength),pattern:Lt(D.pattern)}:{},name:j,onChange:ne,onBlur:ne,ref:B=>{if(B){Le(j,D),R=H(a,j);const P=he(B.value)&&B.querySelectorAll&&B.querySelectorAll("input,select,textarea")[0]||B,Z=Lu(P),ce=R._f.refs||[];if(Z?ce.find(de=>de===P):P===R._f.ref)return;me(a,j,{_f:{...R._f,...Z?{refs:[...ce.filter(zn),P,...Array.isArray(H(r,j))?[{}]:[]],ref:{type:P.type,name:j}}:{ref:P}}}),S(j,!1,void 0,P)}else R=H(a,j,{}),R._f&&(R._f.mount=!1),(n.shouldUnregister||D.shouldUnregister)&&!(ui(l.array,j)&&o.action)&&l.unMount.add(j)}}},_e=()=>n.shouldFocusError&&zt(a,G,l.mount),pt=j=>{Ie(j)&&(x.state.next({disabled:j}),zt(a,(D,R)=>{const U=H(a,R);U&&(D.disabled=U._f.disabled||j,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||j}))},0,!1))},Ze=(j,D)=>async R=>{let U;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let B=be(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Z}=await $();w(),s.errors=P,B=be(Z)}else await M(a);if(l.disabled.size)for(const P of l.disabled)ye(B,P);if(ye(s.errors,"root"),De(s.errors)){x.state.next({errors:{}});try{await j(B,R)}catch(P){U=P}}else D&&await D({...s.errors},R),_e(),setTimeout(_e);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:De(s.errors)&&!U,submitCount:s.submitCount+1,errors:s.errors}),U)throw U},Ye=(j,D={})=>{H(a,j)&&(he(D.defaultValue)?z(j,be(H(r,j))):(z(j,D.defaultValue),me(r,j,be(D.defaultValue))),D.keepTouched||ye(s.touchedFields,j),D.keepDirty||(ye(s.dirtyFields,j),s.isDirty=D.defaultValue?E(j,be(H(r,j))):E()),D.keepError||(ye(s.errors,j),m.isValid&&b()),x.state.next({...s}))},ot=(j,D={})=>{const R=j?be(j):r,U=be(R),B=De(j),P=B?r:U;if(D.keepDefaultValues||(r=R),!D.keepValues){if(D.keepDirtyValues){const Z=new Set([...l.mount,...Object.keys(Nt(r,i))]);for(const ce of Array.from(Z)){const de=H(s.dirtyFields,ce),$e=H(i,ce),ct=H(P,ce);de&&!he($e)?me(P,ce,$e):!de&&!he(ct)&&z(ce,ct)}}else{if(As&&he(j))for(const Z of l.mount){const ce=H(a,Z);if(ce&&ce._f){const de=Array.isArray(ce._f.refs)?ce._f.refs[0]:ce._f.ref;if(mn(de)){const $e=de.closest("form");if($e){$e.reset();break}}}}if(D.keepFieldsRef)for(const Z of l.mount)z(Z,H(P,Z));else a={}}i=n.shouldUnregister?D.keepDefaultValues?be(r):{}:be(P),x.array.next({values:{...P}}),x.state.next({values:{...P}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!D.keepIsValid||!!D.keepDirtyValues||!n.shouldUnregister&&!De(P),o.watch=!!n.shouldUnregister,o.keepIsValid=!!D.keepIsValid,o.action=!1,D.keepErrors||(s.errors={}),x.state.next({submitCount:D.keepSubmitCount?s.submitCount:0,isDirty:B?!1:D.keepDirty?s.isDirty:!!(D.keepDefaultValues&&!We(j,r)),isSubmitted:D.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:B?{}:D.keepDirtyValues?D.keepDefaultValues&&i?Nt(r,i):s.dirtyFields:D.keepDefaultValues&&j?Nt(r,j):D.keepDirty?s.dirtyFields:{},touchedFields:D.keepTouched?s.touchedFields:{},errors:D.keepErrors?s.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},st=(j,D)=>ot(Ee(j)?j(i):j,{...n.resetOptions,...D}),Ve=(j,D={})=>{const R=H(a,j),U=R&&R._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),D.shouldSelect&&Ee(B.select)&&B.select()})}},ue=j=>{s={...s,...j}},Ke={control:{register:Le,unregister:te,getFieldState:J,handleSubmit:Ze,setError:q,_subscribe:V,_runSchema:$,_updateIsValidating:w,_focusError:_e,_getWatch:_,_getDirty:E,_setValid:b,_setFieldArray:C,_setDisabledField:Be,_setErrors:v,_getFieldArray:I,_reset:ot,_resetDefaultValues:()=>Ee(n.defaultValues)&&n.defaultValues().then(j=>{st(j,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:pt,_subjects:x,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(j){o=j},get _defaultValues(){return r},get _names(){return l},set _names(j){l=j},get _formState(){return s},get _options(){return n},set _options(j){n={...n,...j}}},subscribe:ee,trigger:se,register:Le,handleSubmit:Ze,watch:oe,setValue:z,getValues:Y,reset:st,resetField:Ye,clearErrors:Q,unregister:te,setError:q,setFocus:Ve,getFieldState:J};return{...Ke,formControl:Ke}}function Wu(e={}){const n=h.useRef(void 0),s=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Ee(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:Ee(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!Ee(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=qu(e);n.current={...l,formState:a}}const i=n.current.control;return i._options=e,Ls(()=>{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&&!We(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.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()}),n.current.formState=h.useMemo(()=>fi(a,i),[i,a]),n.current}function Gu(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function Yu(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Ku(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Qu(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Zu(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function _s(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_s();const Xu={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:"$"},Bn=()=>({id:_s(),amount:0,glAccount:null,isTaxDeductible:!1}),vi=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:x,classNames:g={},"data-testid":y,control:b,name:w,rules:C})=>{const A={...Xu,...x},v=b!==void 0&&w!==void 0,S=Wu({defaultValues:{_internal:n||Bn()}}),L=Du({control:v?b:S.control,name:v?w:"_internal",rules:v?C:void 0}),[N,$]=h.useState(n||Bn()),k=v?L.field.value??Bn():e??N,M=v&&!!L.fieldState?.error,F=v&&(L.fieldState?.isTouched??!1),E=M||F,_=E&&(!k.amount||k.amount<=0),I=E&&!k.glAccount,[W,K]=h.useState(k.glAccount?.name||""),z=h.useCallback(q=>{const oe={...k,...q};v&&L.field.onChange(oe),!v&&e===void 0&&$(oe),i?.(oe)},[k,e,i,v,L]),ne=h.useCallback(q=>{const oe=q||0;z({amount:oe}),o?.(oe)},[z,o]),G=h.useCallback(q=>{K(q),r?.(q)},[r]),se=h.useCallback(q=>{if(q===null){z({glAccount:null}),l?.(null);return}const V=s.find(ee=>String(ee.id)===String(q))||null;z({glAccount:V}),l?.(V)},[s,z,l]),Y=h.useCallback(()=>{K(""),z({glAccount:null}),l?.(null)},[z,l]),J=h.useCallback(q=>{z({isTaxDeductible:q}),d?.(q)},[z,d]),Q=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"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":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[A.amount,t.jsx(c.Tooltip,{content:A.amountTooltip,children:t.jsx(T,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:k.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:A.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:_,errorMessage:_?"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:A.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[A.glAccount,t.jsx(c.Tooltip,{content:A.glAccountTooltip,children:t.jsx(T,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:k.glAccount?.name??W,selectedKey:k.glAccount?.id??null,isDisabled:p,isInvalid:I,errorMessage:I?"GL Account is required":void 0,listboxProps:{emptyContent:a?A.searching:A.noGlAccountsFound},placeholder:A.glAccountPlaceholder,onInputChange:G,onSelectionChange:se,onClear:Y,className:g.glAccountInput,children:q=>t.jsx(c.AutocompleteItem,{textValue:q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:q.name}),q.code&&t.jsx("span",{className:"text-xs text-default-400",children:q.code})]})},q.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":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:k.isTaxDeductible,onValueChange:J,isDisabled:p||!m,className:g.taxDeductibleCheckbox,children:A.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(O,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!f,onPress:Q,startContent:t.jsx(T,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:A.deleteButton})})]})})};vi.displayName="RevenueDistributionCard";const ji=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=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(T,{icon:n,width:s,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})};ji.displayName="RevenueDistributionEmpty";const Ju={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},wi=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Ju,...n},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?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})};wi.displayName="RevenueDistributionError";const Ni=({rows:e=1,showCard:n=!0,classNames:s={}})=>{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",s.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 n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.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",s.base),children:a.map(i=>r(i))})};Ni.displayName="RevenueDistributionSkeleton";function Ps({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{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:[s&&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:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.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:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(O,{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:n.cancel}),t.jsx(O,{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:f,children:n.confirm})]})]})})}const em=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Ta(e){return!e.fund&&Number(e.percentage||0)<=0}function tm({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,o)=>i+Number(o.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const nm={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"},Ci={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"},Rt={...Ci,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},sm={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"},am={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 rm(){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 im=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,lm=e=>e.fund!==null;function om({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:p,onOpenFundPicker:x,onCloseFundPicker:g,onCollapseChange:y,onSave:b}){const[w,C]=h.useState(null),A=f??w??void 0,v={...nm,...s},S=e.filter(V=>!Ta(V)),N=S.filter(lm).length>0,$=h.useMemo(()=>e.filter(V=>!Ta(V)).reduce((V,ee)=>V+Number(ee.percentage||0),0),[e]),k=Math.round($*100)/100,M=S.some(V=>!V.fund||Number(V.percentage||0)<=0),F=N&&(k!==100||M),E=`${v.totalError} (${v.total} ${Number($.toFixed(2))}%)`,_=tm({mode:"split",assignments:e}),I=N&&k>=100,[W,K]=h.useState(!1),[z,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(rm,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),se=(V,ee)=>{p(e.map(te=>te.id===V?{...te,...ee}:te))},Y=()=>{I||p([...e,em()])},J=V=>{e.length<=1||p(e.filter(ee=>ee.id!==V))},Q=()=>{if(!r){if(!_){ne(!0);return}if(!i){b();return}K(!0)}},q=()=>{K(!1),b()},oe=V=>{const ee=u??e.find(te=>!te.fund)?.id??e[0]?.id;ee&&(p(e.map(te=>te.id===ee?{...te,fund:V}:te)),g())};return t.jsxs("div",{ref:C,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"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:V=>y?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.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:[!N&&t.jsx(c.Alert,{icon:t.jsx(T,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Ci,color:"default",variant:"flat",title:v.emptySplit}),N&&t.jsx(cm,{assignments:e,labels:v,total:$,hasTotalError:z&&!_||F,validationMessage:E,onSelectFund:V=>x(V),onRemoveFund:J,onPercentageChange:(V,ee)=>se(V,{percentage:im(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(O,{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:I,onPress:()=>N?Y():x(),children:v.assignSpecificFund}),t.jsx(O,{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(T,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!_||r,onPress:Q,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(dm,{funds:n,labels:v,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:A,onSelect:oe,onClose:g}),t.jsx(Ps,{isOpen:W,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(T,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:A,shouldBlockScroll:!1,classNames:am,onClose:()=>K(!1),onConfirm:q})]})}function cm({assignments:e,labels:n,total:s,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(O,{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(O,{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:n.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:f=>l(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:sm})}),e.length>1&&t.jsx(O,{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":n.removeFund,children:t.jsx(T,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(T,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Rt,base:c.cn(Rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Rt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function dm({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{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:n.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":n.searchPlaceholder,value:o,placeholder:n.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(T,{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:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.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(O,{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:n.select})]},u.id))]})]})]})})}function um(){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 mm={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function fm({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...mm,...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(Vn,{label:l.totalAmount,value:d.format(e)}),t.jsx(Vn,{label:l.remainingBalance,value:d.format(n)}),t.jsx(Vn,{label:l.amountReceived,value:d.format(s)})]})})}function Vn({label:e,value:n}){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:n})]})}const xm={monthly:1,quarterly:3,annual:12},ki=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},hm=(e,n)=>new Date(e,n+1,0).getDate(),pm=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},gm=(e,n)=>{const{year:s,month:a,day:r}=ki(e),i=a-1+n,o=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,hm(o,l));return new Date(o,l,d)},bm=(e,n)=>{const{year:s,month:a,day:r}=ki(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function Si(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=xm[n.frequency];return Array.from({length:s},(l,d)=>{const u=n.frequency==="weekly"?bm(n.firstInstallmentDate,d*7):gm(n.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:pm(u),amount:(r+(d===0?i:0))/100}})}function ym(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function vm(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:ym(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function jm(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function wm(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const Nm=new Set(["paid","partially_refunded","refunded"]);function xt(e){return e!==void 0&&Nm.has(e)}const Cm={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."},km=["weekly","monthly","quarterly","annual"],Sm=Array.from({length:31},(e,n)=>n+1),$m=["numberOfInstallments","frequency","firstInstallmentDate"],Ia=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),xn=e=>Math.round(e*100)/100,Am=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},Cn=e=>{if(!e)return null;try{return vd(e)}catch{return null}},Dm=e=>Cn(e)?.day??1,Em=(e,n)=>new Date(e,n,0).getDate(),Fm=(e,n)=>{const s=Cn(e);if(!s)return e;const a=Math.min(n,Em(s.year,s.month));return s.set({day:a}).toString()},Oa=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function Lm({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=$m,startDate:p,firstInstallmentDateOverride:x,labels:g,classNames:y,isSaving:b=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:C=!1,onModeChange:A,onAutomaticSettingsChange:v,onInstallmentsChange:S,onSave:L,onCancel:N}){const[$,k]=h.useState(o),M={...Cm,...g},F=e??$,E=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),_=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),I=F==="automatic"?wm(Si(n,_),m.includes("firstInstallmentDate")?void 0:x):r,W=h.useMemo(()=>xn(I.reduce((te,Be)=>te+Number(Be.amount||0),0)),[I]),K=Math.abs(W-n)>.009,z=xn(n-W)<=0,ne=h.useMemo(()=>vm(r),[r]),G=F==="manual"&&jm(ne),se=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:M.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,J=te=>{te!==F&&(e||k(te),A?.(te),te==="manual"&&r.length===0&&S([Ia()]))},Q=(te,Be)=>{const Le=r.find(_e=>_e.id===te);xt(Le?.status)||S(r.map(_e=>_e.id===te?{..._e,...Be}:_e))},q=()=>{S([...r,Ia()])},oe=te=>{const Be=r.find(Le=>Le.id===te);xt(Be?.status)||S(r.filter(Le=>Le.id!==te))},V=()=>{b||se||L?.()},ee=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u||N?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Rm,{mode:F,labels:M,onModeChange:J,isDisabled:C,className:y?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[N?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:N,children:M.cancelEdit}):null,u?t.jsx(O,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(T,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||se,onPress:V,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[F==="automatic"&&t.jsx(Mm,{settings:_,inputs:m,labels:M,className:y?.controls,onSettingsChange:v}),I.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?M.emptyAutomatic:M.emptyManual}),I.length>0&&t.jsx(_m,{mode:F,installments:I,rowErrors:ne,labels:M,formatter:E,locale:a,onUpdateInstallment:Q,onRemoveInstallment:oe}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(O,{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:z,onPress:q,children:M.addInstallment})}),t.jsx(Om,{total:W,donationAmount:n,hasTotalMismatch:K,mode:F,installments:I,formatter:E,labels:M,className:y?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.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":M.title,title:Y,children:ee},"installment-schedule")}):ee})}function Rm({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Mm({settings:e,inputs:n,labels:s,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:s.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(Ge,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:km.map(l=>t.jsx(c.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(Dm(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Ge,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Fm(e.firstInstallmentDate,u)})},children:Sm.map(d=>t.jsx(c.SelectItem,{textValue:Oa(d),children:Oa(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Ss,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Cn(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(T,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function _m({mode:e,installments:n,rowErrors:s,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",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.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:Am(d.dueDate,i)}),u===0&&n.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:n.map((d,u)=>{const f=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),p=s.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(Ss,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:xt(d.status),isInvalid:f||m,errorMessage:f?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:Cn(d.dueDate),onChange:x=>o(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Tm,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:xt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:x=>o(d.id,{amount:x})})}),t.jsx(Im,{isDisabled:n.length<=1,isPaid:xt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Pm=/^\d*(?:[.,]\d{0,2})?$/;function Tm({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Pm.test(u))return;l(u);const f=Number(u.replace(",","."));i(xn(Number.isFinite(f)?f:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Im({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(O,{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||n,onPress:a,"aria-label":s,children:t.jsx(T,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?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 Om({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),p=xn(n-e),x=Math.max(p,0),g=Math.max(-p,0),y=s?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):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(f)})," 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(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${o.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:y})}function zm(){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,n)=>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"})]},n))})]})}const za={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"},$i={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"},Bm={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:$i.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."},Vm={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Um=[];function Hm({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=Um,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:x}){const[g,y]=h.useState(null),b={...Bm,...u},[w,C]=h.useState(""),A=new Intl.NumberFormat(s,{style:"currency",currency:n}),v=e.some(k=>Ai(k)!==null),S=e.some(k=>k.status==="partially_refunded"),L=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,N=h.useMemo(()=>{const k=w.trim().toLowerCase();if(!k)return e;const M=new Intl.NumberFormat(s,{style:"currency",currency:n});return e.filter(F=>{const E=F.status??"scheduled";return[Un(F),F.id,F.amount,F.dueDate,rn(F.dueDate,s),Hn(F,b.paidOn,s),qn(F,b.refundedAmount,M),E,Wn(E,b.partiallyRefunded)].join(" ").toLowerCase().includes(k)})},[s,n,e,w,b.paidOn,b.refundedAmount,b.partiallyRefunded]),$=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:w,placeholder:b.searchPlaceholder,onChange:k=>C(k.target.value),startContent:t.jsx(T,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(O,{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(T,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",N.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((k,M)=>{const F=k.status??"scheduled",E=Un(k),_=Hn(k,b.paidOn,s),I=qn(k,b.refundedAmount,A);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:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E||`PMT-${M+1}`})]}),t.jsx(Ba,{status:F,label:Wn(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:A.format(k.amount)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):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:rn(k.dueDate,s)}),_?t.jsx("p",{className:"text-xs text-default-500",children:_}):null]})]}),t.jsx(Va,{status:F,installment:k,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})]})},k.id)}),N.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",N.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:v?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:S?"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:[N.map((k,M)=>{const F=k.status??"scheduled",E=Un(k),_=Hn(k,b.paidOn,s),I=qn(k,b.refundedAmount,A);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[A.format(k.amount),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[rn(k.dueDate,s),_?t.jsx("span",{className:"block text-xs",children:_}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ba,{status:F,label:Wn(F,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Va,{status:F,installment:k,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:x})})]},k.id)}),N.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:y,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:L,children:$},"installment-table")}):$})}function Un(e){return e.name?.trim()||e.id}function Hn(e,n,s){return!xt(e.status)||!e.fulfilledAt?null:`${n} ${rn(e.fulfilledAt,s)}`}function Ai(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function qn(e,n,s){const a=Ai(e);return a===null?null:`${n} ${s.format(a)}`}function Wn(e,n){return e==="partially_refunded"?n:$i[e]??e}function Ba({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",za[e]??za.scheduled),startContent:t.jsx(Wm,{status:e}),children:n})}function Va({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=xt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(O,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(T,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(n),children:s.payNow}):null,t.jsx(qm,{isFulfilled:u,showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(n.id)})]})}function qm({isFulfilled:e,showDelete:n,labels:s,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(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(T,{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"&&n&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(T,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(T,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Ps,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(T,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Vm,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function Wm({status:e}){return e==="paid"?t.jsx(T,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(T,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(T,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(T,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(T,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(T,{icon:"solar:calendar-outline",className:"size-3"})}const Gm=/^\d{4}-\d{2}-\d{2}$/;function rn(e,n){const s=Gm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Ym={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},Km=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const p=Array.isArray(e)?e:[],[x,g]=h.useState(l),[y,b]=h.useState(o),w={...Ym,...r};h.useEffect(()=>{g(l)},[l]);const C=v=>{if(v===x){d&&f?.(v);return}g(v),f?.(v)},A=v=>{b(v),u?.(v)};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:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(Ri,{title:w.renewalTitle,description:w.renewalDescription,value:y,onValueChange:A}),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(v=>t.jsx(Di,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:s,isSelected:x===v.id,onSelect:C},v.id))})]})},Di=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:p,statusTone:x="default",className:g=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!f,w=m||p,C=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:C,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:f,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:n}),s&&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:s})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},Ua="w-full bg-gray-100",Ha={variant:"light",color:"default"},Ei=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:f,onPress:m,isPressable:p=!1,isDisabled:x=!1,compact:g=!1,className:y="",bodyClassName:b="",footerClassName:w="",dataTestId:C})=>{const A=!!(d&&d.value),v=!!u?.label,S=p&&!!m&&!v,L=!S,N=v?{variant:u?.variant??Ha.variant,color:u?.color??Ha.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(T,{icon:u.icon,width:16}):void 0}:null,$=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,Ua,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,Ua,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(T,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":C||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:S,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:$}),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:n}),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((k,M)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(T,{icon:k.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:k.label})]},`${k.label}-${M}`))}):null,(A||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",w),children:[A?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}),v&&L?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:N?.variant,color:N?.color,size:N?.size,startContent:N?.startContent,isDisabled:N?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};Ei.displayName="CatalogItemCard";const Qm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Fi({title:e,subtitle:n,price:s,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(T,{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:n})]}),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:Qm[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}Fi.displayName="ProgramListItem";const Zm={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Xm={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Jm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},ef={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},tf={card:"mt-1",panel:"mt-[22px]"},nf="bg-acct-page border-acct-border text-acct-muted",sf={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},af={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"},rf={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"},lf={empty:"status",error:"alert",success:"status",loading:"status"},of={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function cf(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:sf[e];return r?t.jsx(T,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function $t({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:o,role:l=lf[e],ariaLive:d=of[e],iconSize:u=24,className:f,classNames:m={},"data-testid":p="feedback-state"}){const x=cf(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Zm[n],n==="card"?af[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",Xm[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?nf:rf[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(Jm[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(ef[n],m.description),children:r}):null]}),o?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",tf[n],m.actions),children:o}):null]})}function Ts(e){return t.jsx($t,{...e,variant:"empty"})}function Is(e){return t.jsx($t,{...e,variant:"error"})}function Os(e){return t.jsx($t,{...e,variant:"loading"})}function Li(e){return t.jsx($t,{...e,variant:"success"})}$t.displayName="FeedbackState";Ts.displayName="EmptyState";Is.displayName="ErrorState";Os.displayName="LoadingState";Li.displayName="SuccessState";const Ri=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"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}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},df={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"},uf=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),Mi=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),mf=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),zs=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),qa=(e,n,s)=>{const a={};let r=s?n??mf(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of zs(e)){a[i.id]??={},a[i.id][o.id]??={};const d=s?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},Wa=(e,n,s)=>`${e}::${n}::${s}`,ff=(e,n,s)=>{const a=Mi(n);for(const{exhibition:r,dateGroup:i,ticket:o}of zs(e)){const l=n[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=s===void 0?o.max:Math.min(o.max,s-(a-l));if(d>0&&l<d)return!1}return!0},xf=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),f=d?o:String(i),m=()=>{r||i>=s||a?.(i+1)},p=()=>{r||i<=n||a?.(i-1)},x=v=>{if(r)return;l(v.target.value);const S=parseInt(v.target.value,10);isNaN(S)||a?.(Math.max(n,Math.min(s,S)))},g=v=>{const S=parseInt(v.target.value,10);if(u(!1),isNaN(S)){a?.(n);return}const L=Math.max(n,Math.min(s,S));L!==S?a?.(L):l(String(L))},y=i<=n,b=i>=s,w="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",C="bg-primary hover:bg-primary/80",A="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||y,className:c.cn(w,r||y?A:C),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:g,disabled:r,min:n,max:s,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(w,r||b?A:C),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},hf=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,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:n,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",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&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})]})},pf=({item:e,quantity:n,onChange:s,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-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=uf(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:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.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(xf,{initialQuantity:n,minQuantity:0,maxQuantity:l(),onChange:s})]}),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]})},gf=({exhibitionId:e,dateGroup:n,isLast:s=!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",!s&&"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:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(pf,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),bf=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,f]=h.useState(d),m=n.dates.reduce((x,g)=>x+g.tickets.reduce((y,b)=>y+a(n.id,g.id,b.id),0),0),p=n.dates.some(x=>x.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:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.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(T,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.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?n.dates.map((x,g)=>t.jsx(gf,{exhibitionId:n.id,dateGroup:x,isLast:g===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},x.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})})})})]})},yf=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...df,...s},[u,f]=h.useState(()=>qa(l,n,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const C=zs(l).map(({exhibition:A,dateGroup:v,ticket:S})=>[Wa(A.id,v.id,S.id),S]);return new Map(C)},[l]),x=ff(l,u,n),g=(C,A,v)=>u[C]?.[A]?.[v]?.selectedQuantity??0,y=()=>Mi(u),b=(C,A,v,S)=>{const L=g(C,A,v),N=y()-L;if(n!==void 0&&N+S>n)return;const $=p.get(Wa(C,A,v));if(!$)return;const k={...u,[C]:{...u[C],[A]:{...u[C]?.[A],[v]:{id:v,selectedQuantity:S,originalPrice:$.originalPrice,discountedPrice:$.price}}}};f(k),o?.(k)},w=C=>{const A=qa(l,n,C);f(A),o?.(A)};return h.useEffect(()=>{!m.current&&x&&(o?.(u),m.current=!0)},[x,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(hf,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),l.map(C=>t.jsx(bf,{title:C.exhibitionName,exhibition:C,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},C.id))]})},Gn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Yn=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},vf=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},jf=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,_i=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:p,countAriaLabel:x,countDisplay:g="badge",confirmLabel:y=Gn.confirm,clearLabel:b=Gn.clear,isOpen:w,defaultOpen:C=!1,onOpenChange:A,isDisabled:v=!1,closeOnConfirm:S=!0,keepOpenAfterClear:L=!1})=>{const[N,$]=h.useState(C),[k,M]=h.useState(()=>Yn(u)),F=w??N,E=p??u.filter(Y=>jf(Y)).length,_=Y=>{Y&&M(Yn(u)),w||$(Y),A?.(Y)},I=(Y,J)=>{M(Q=>({...Q,[Y.id]:J}))},W=(Y,J)=>{M(Q=>({...Q,[Y.id]:J?[J]:[]}))},K=async()=>{M(Yn(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),L||_(!1)},z=async()=>{const Y=vf(k,u);await f(Y),S&&_(!1)},ne=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:k[Y.id]??[],onValueChange:Q=>I(Y,Q),children:Y.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id);const J=k[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:J,onValueChange:Q=>W(Y,Q||null),children:Y.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},Y.id)},G=h.useMemo(()=>E>0?x?.(E)||`${E} filters applied`:void 0,[x,E]),se=h.useMemo(()=>E===0?e||Gn.noLabel:x?x(E):`${e} (${E})`,[E,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:_,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:v,variant:a,color:r,size:i,className:o,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(T,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&E>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:E}):g==="summary"&&se!==e?t.jsx("span",{className:"text-xs",children:se}):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(O,{variant:"light",color:"default",size:"sm",onPress:K,children:b}),t.jsx(O,{color:"primary",size:"sm",onPress:z,children:y})]})]})})]})})};_i.displayName="FilterPopover";const wf="No sessions available for this date",Nf=e=>e==="sold-out"||e==="closed"?"danger":"success",Cf=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},Ga=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",kf=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,Pi=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=wf,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:x,dayGroupAriaLabel:g,sessionGridAriaLabel:y,className:b,headingClassName:w,subheadingClassName:C})=>{const A=kf(s,a),v=s.find(k=>k.date===A),S=i??s.map(k=>({date:k.date,label:k.label})),L=v?.sessions??[],N=k=>k===A?"solid":"bordered",$=k=>{if(!Ga(k)){if(k.id===o){l(null);return}l(k.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",w),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",C),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[S.map(k=>t.jsx(O,{size:"sm",variant:N(k.date),color:"default",className:c.cn("rounded-full",p),isDisabled:k.isDisabled,onPress:()=>{r(k.date)},children:t.jsx("span",{children:k.label})},k.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[L.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,L.map(k=>{const M=Ga(k),F=k.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{$(k)},"aria-disabled":M,"aria-pressed":M?void 0:F,className:c.cn("w-full",M?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(k,{isSelected:F,isUnavailable:M}):M?`${k.startTime} ${k.endTime} sold out`:`${k.startTime} ${k.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:[k.startTime," – ",k.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(k):Nf(k.status),variant:"flat",children:u?u(k):Cf(k)})]})})},k.id)})]})]})};Pi.displayName="SessionTimeline";const us=16,tt=e=>`${e/us}rem`;function Sf(){if(typeof document>"u"||typeof getComputedStyle!="function")return us;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:us}const Wt=(e,n)=>e>=n*Sf(),$f=1120;function At(){const e=h.useRef(null),[n,s]=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&&s(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return s(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:n}}const Af=48,Ue={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"},Df=(e,n)=>typeof e=="string"?t.jsx(T,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,Ti=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:p})=>{const x=Df(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Ue.base,m?Ue.baseNarrow:Ue.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:f?Ue.identity:"flex items-center gap-4",children:[x?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:x}):null,t.jsxs("div",{className:f?Ue.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(f?m?Ue.titleNarrow:Ue.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Ue.subtitleNarrow:Ue.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Ue.actionsNarrow:Ue.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Ef=e=>{const{ref:n,width:s}=At(),a=s>0&&!Wt(s,Af);return t.jsx(Ti,{...e,list:!0,narrow:a,headerRef:n})},Ii=e=>e.variant==="list"?t.jsx(Ef,{...e}):t.jsx(Ti,{...e,list:!1,narrow:!1});Ii.displayName="PageHeader";const ze={ok:{fg:re.ok,bg:re["ok-fill"]},warn:{fg:re.warn,bg:re["warn-fill"]},danger:{fg:re.danger,bg:re["danger-fill"]},info:{fg:re.info,bg:re["info-fill"]},violet:{fg:re.violet,bg:re["violet-fill"]},neutral:{fg:re.neutral,bg:re["neutral-fill"]}};function Gt(e){if(e==="positive")return{color:re.ok};if(e==="negative")return{color:re.danger}}const Ff={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},ms={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},Lf={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Rf={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]"},Mf={info:ms.info,violet:ms.violet},Oi=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=ze[Lf[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",Rf[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(s==="dot"){const u=ms[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"}}),n]})}const d=r?void 0:Mf[e];return t.jsx(c.Chip,{color:r??Ff[e],variant:s,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:n})};Oi.displayName="StatusChip";const _f={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"},Xt={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"},kn=({label:e,value:n,size:s="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(Xt.base,Xt[s],r),children:[t.jsx("span",{className:Xt.label,children:e}),t.jsx("span",{className:Xt.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",_f[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});kn.displayName="KeyValueChip";const zi="(prefers-reduced-motion: reduce)",Bi="data-pos-reduce-motion",Yt="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Pf="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",ln=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Pf}`;function Tf(){return typeof document>"u"?!1:document.documentElement.getAttribute(Bi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(zi).matches}function If(){const[e,n]=h.useState(!1);return h.useEffect(()=>{const s=()=>n(Tf()),a=typeof window.matchMedia=="function"?window.matchMedia(zi):null;a?.addEventListener?.("change",s);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Bi]}),s(),()=>{a?.removeEventListener?.("change",s),r?.disconnect()}},[]),e}const Vi=({columns:e,rows:n=6,label:s="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:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>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 x=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(ln,l.bar),style:{height:tt(a),width:m==="fill"?"60%":tt(m),maxWidth:"100%"}})},p)})},f):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 x=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"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)})},f))})]});Vi.displayName="TableSkeleton";const Ui="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Hi="px-4 text-[13.5px] text-acct-ink2 align-middle",qi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Wi="w-full",Gi="border-t border-acct-border px-5 py-3.5",Jt={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 ${Yt}`,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"},Yi=({columns:e,children:n,emptyContent:s,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&&Jt.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Wi,l.table),th:c.cn(u?Jt.th:Ui,l.th),tr:c.cn(u?Jt.tr:qi,l.tr),td:c.cn(u?Jt.td:Hi,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Gi,l.footer),children:a}):null]})};Yi.displayName="AdminTable";const Mt={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"},Of={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},zf=48,Qe={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"},Ya={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},hn={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Ka={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Qa={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Ki=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const f=h.useRef(null),m=o==="lg",p=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{n(""),f.current?.focus()},className:c.cn(Ka.button,Qa[o].button),testId:`${l}-search-clear`,children:t.jsx(T,{icon:"lucide:x","aria-hidden":"true",className:Qa[o].icon})}):void 0;return t.jsx(c.Input,{ref:f,type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&hn.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&hn.input,r&&Ka.input)}})},Bf=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:f,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:x,width:g}=At(),y=g>0&&!Wt(g,zf),b=u==="fill";return t.jsxs("div",{ref:x,role:"search","data-testid":p,"data-variant":"framed","data-size":y?"narrow":"wide",className:c.cn(Qe.base,y&&Qe.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:b?Qe.searchFill:y?Qe.searchNarrow:Qe.searchWide,children:t.jsx(Ki,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(Qe.icon,f==="lg"&&hn.icon),children:r??t.jsx(T,{icon:"lucide:search"})}),classNames:{base:b?Ya.fill:y?Qe.inputBaseNarrow:Ya[u],inputWrapper:Qe.inputWrapper,innerWrapper:Qe.innerWrapper,input:Qe.input}})}),d]})},Qi=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:f="md",variant:m="default",className:p,"data-testid":x="admin-toolbar"})=>m==="framed"?t.jsx(Bf,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:f,className:p,"data-testid":x,children:l}):t.jsxs("div",{role:"search","data-testid":x,className:c.cn(Mt.base,p),children:[t.jsx(Ki,{searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:f,dataTestId:x,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Mt.icon,f==="lg"&&hn.icon),children:r}):void 0,classNames:{base:Of[u],inputWrapper:Mt.inputWrapper,input:Mt.input}}),l,d?t.jsx("div",{className:Mt.trailing,children:d}):null]});Qi.displayName="AdminToolbar";const Vf="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",Uf="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",Hf="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",Zi=h.forwardRef(function({icon:n,children:s,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(O,{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(T,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:Uf,children:a})]}):t.jsxs(O,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(Hf,i),...l,children:[t.jsx(T,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:Vf,children:a})]})});Zi.displayName="ToolbarButton";function Xi({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:o=>s(String(o)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),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",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(o=>t.jsx(c.Tab,{title:o.label,"data-testid":`${i}-${o.key}`,children:o.content},o.key))})}Xi.displayName="UnderlineTabs";const Bs="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Vs="font-normal normal-case tracking-normal",Ji=["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(" "),el="text-[13.5px] text-acct-ink",tl="bg-acct-page text-acct-muted cursor-default",nl="mt-[5px] text-xs text-acct-sub",sl="mt-[5px] text-xs text-acct-danger",al=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Bs,s),children:[e,n?t.jsxs("span",{className:Vs,children:[" ",n]}):null]});al.displayName="AdminFieldLabel";const rl=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":p="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Vs,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":p,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Bs,inputWrapper:Ji,input:c.cn(el,(l||o)&&"font-mono",o&&tl),description:nl,errorMessage:sl}});rl.displayName="AdminTextField";const qf={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},il=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(O,{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",qf[n]),children:r.icon},r.key))});il.displayName="RowActions";const ll=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,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(O,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-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:n}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};ll.displayName="PickerRow";const Pe={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",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Wf={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Gf={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"}},ol={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"}},Yf={md:void 0,lg:"min-h-12 text-base"},Kf={none:"",sm:"gap-1",md:"gap-2"},cl="m-0 flex list-none flex-col p-0",vt={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"]},dl=h.createContext(!1),Qf=()=>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"})}),Zf=()=>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 Xf(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return"—";const s=n[0]?.charAt(0)??"",a=n.length>1?n[n.length-1]?.charAt(0)??"":"";return`${s}${a}`.toUpperCase()}function ie(e){return e!=null&&e!==!1&&e!==""}const ul=({title:e,subtitle:n,leading:s,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:f,actions:m,actionsLabel:p,actionsIcon:x,size:g,variant:y="plain",isDisabled:b=!1,as:w,className:C,"data-testid":A="entity-row"})=>{const v=h.useContext(dl),S=bn(),L=g??(S==="touch"?"lg":"md"),N=ol[L],$=Gf[y],k=w??(v?"li":"div"),M=h.useId(),F=h.useId(),E=h.useId(),_=i!==void 0||r!==void 0,I=a!==void 0&&a.length>0,W=ie(n),K=m!==void 0&&m.length>0,z=typeof e=="string"?e:void 0,ne=s?t.jsx(c.Avatar,{"aria-hidden":"true",size:N.avatar,radius:s.shape==="square"?"lg":"full",src:s.src,icon:s.icon,name:s.icon!==void 0?void 0:s.initials??s.name??z,getInitials:s.initials!==void 0?q=>q:Xf,showFallback:s.src!==void 0,classNames:{base:Pe.avatar},"data-testid":`${A}-leading`}):null,G=t.jsxs(t.Fragment,{children:[ne,t.jsxs("span",{className:Pe.text,children:[t.jsxs("span",{className:Pe.titleLine,children:[t.jsx("span",{id:M,className:c.cn(Pe.title,N.title),title:z,children:e}),I&&t.jsx("span",{id:F,className:Pe.tags,children:a.map(q=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:q.tone??"default",className:Wf[q.tone??"default"],"data-testid":`${A}-tag-${q.key}`,children:q.label},q.key))})]}),W&&t.jsx("span",{id:E,className:c.cn(Pe.subtitle,N.subtitle),children:n})]})]}),se=[I?F:null,W?E:null].filter(Boolean).join(" "),Y={"aria-labelledby":M,"aria-describedby":se===""?void 0:se,isDisabled:b,className:c.cn(Pe.pressTarget,$.overlay,N.content)},J=`${A}-trigger`;let Q;return i!==void 0?Q=t.jsx(c.Link,{...Y,"data-testid":J,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:G}):r!==void 0?Q=t.jsx(O,{...Y,testId:J,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:G}):Q=t.jsx("div",{className:c.cn(Pe.content,N.content),children:G}),t.jsxs(k,{"data-testid":A,"data-size":L,"data-disabled":b||void 0,className:c.cn(Pe.base,$.row,N.row,_&&!b&&$.hover,C),children:[Q,(ie(d)||K)&&t.jsxs("div",{className:Pe.side,children:[d,K&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:N.control,variant:"light",color:"default",radius:"full",isDisabled:b,"aria-label":p,testId:`${A}-menu-trigger`,className:Pe.menuTrigger,children:x??t.jsx(Zf,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${A}-menu`,disabledKeys:m.filter(q=>q.isDisabled).map(q=>q.key),onAction:q=>{m.find(oe=>oe.key===q)?.onAction()},items:m,children:q=>t.jsx(c.DropdownItem,{textValue:q.label,color:q.tone==="danger"?"danger":"default",className:c.cn(q.tone==="danger"&&Pe.dangerItem,Yf[L]),startContent:q.icon,"data-testid":q["data-testid"]??`${A}-menu-${q.key}`,children:q.label},q.key)})]})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Pe.chevron,"data-testid":`${A}-chevron`,children:f??t.jsx(Qf,{})})]})};ul.displayName="EntityRow";const ml=({children:e,"aria-label":n,"aria-labelledby":s,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":n,"aria-labelledby":s,"data-testid":i,className:c.cn(cl,Kf[a],r),children:t.jsx(dl.Provider,{value:!0,children:e})});ml.displayName="EntityList";const fl=({label:e,rows:n=6,size:s,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=bn(),o=s??(i==="touch"?"lg":"md"),{titleWidths:l}=vt;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:cl,children:Array.from({length:n},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(vt.row,ol[o].row),children:[t.jsx(c.Skeleton,{className:vt.avatar[o]}),t.jsxs("span",{className:vt.lines,children:[t.jsx(c.Skeleton,{className:c.cn(vt.title,l[u%l.length])}),t.jsx(c.Skeleton,{className:vt.subtitle})]})]},u))})]})};fl.displayName="EntityListSkeleton";function xl(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const hl=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:f}=xl(e,n,s),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:f,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${f}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};hl.displayName="PaginationSummary";const Sn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Je={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"},Jf={card:Sn,flat:""},ex={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]"},tx={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:""}},pl=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:x,emptyActions:g,emptyContent:y,children:b,toolbar:w,variant:C="default",className:A,classNames:v={},"data-testid":S="list-panel"})=>{const L=C==="framed",N={base:c.cn("border-0 bg-transparent py-12",v.state)},$=L?{base:c.cn("px-6 py-[3.625rem]",v.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"}:N;let k;return e?k=r??t.jsx(Os,{title:a,classNames:N,"data-testid":`${S}-loading`}):n?k=f??t.jsx(Is,{title:i,description:o,classNames:N,"data-testid":`${S}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?k=y??t.jsx(Ts,{surface:L?"panel":void 0,title:m,description:p,icon:x,actions:g,classNames:$,"data-testid":`${S}-empty`}):k=b,t.jsxs("section",{"data-testid":S,"data-variant":L?"framed":void 0,className:c.cn(L?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Sn}`:"rounded-xl bg-white p-2 shadow-sm",A,v.base),children:[w,k]})};pl.displayName="ListPanel";const Us=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),Ht=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},gl=(e,n)=>{const[s,a]=h.useState(()=>n(e)),r=(Ht(s)??0)===(e??0)?s:n(e),i=h.useCallback(()=>{a(o=>{const l=Ht(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},nx=/^[\d.,]+$/,bl=(e,n=Object.is)=>{const s=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=s.current;return l===null||!(n(d,l.source)||n(d,l.emitted))},[n]),i=h.useCallback(l=>{a.current={source:s.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},yl=(e,n)=>{const s=h.useRef(null),a=h.useRef(n);return h.useLayoutEffect(()=>{a.current=n},[n]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&nx.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]),s},sx=350,ax={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}"},rx=7,ix=e=>[...new Set((e??[]).filter(n=>Number.isFinite(n)&&n>0))].sort((n,s)=>n-s).slice(0,rx),lx=(e,n,s)=>{if(!Number.isInteger(e))return xe(e,n,s);try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return xe(e,n,s)}},ox=(e,n)=>(e??0)===(n??0),_t=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),cx=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:f=!1,className:m,"data-testid":p="cash-tender-form"})=>{const x={...ax,...i},g=St(e.currency,r),y=n!==void 0,[b,w]=h.useState(s??null),C=y?n:b,{draft:A,setDraft:v,normalize:S}=gl(C,V=>V==null?"":String(V)),{isUntouched:L,markEdited:N,markUntouched:$}=bl(C,ox),k=h.useMemo(()=>{const V=typeof C=="number"&&Number.isFinite(C)?C:0,ee=rs(V,e.value,e.currency,r);return{received:V,change:ee>0?ee:0,isValid:V>=e.value&&V>0}},[C,e.value,e.currency,r]),M=h.useCallback(V=>{const ee=V.currentTarget;requestAnimationFrame(()=>{ee.isConnected&&ee.select()})},[]),F=h.useCallback(V=>{y||w(V);const ee=typeof V=="number"&&Number.isFinite(V)?V:0,te=rs(ee,e.value,e.currency,r);a?.({received:ee,change:te>0?te:0,isValid:ee>=e.value&&ee>0})},[y,e.value,e.currency,r,a]),E=h.useCallback(V=>{if(o)return;const ee=V.replace(/[^\d.,]/g,"");if(!Us(ee,g))return;const te=Ht(ee);te!==null&&l!==void 0&&te>l||(v(ee),N(te),F(te))},[o,l,v,N,g,F]),_=yl(L,E),I=h.useMemo(()=>ix(d),[d]),W=V=>l!==void 0&&V>l,K=()=>{o||W(e.value)||(v(String(e.value)),$(),F(e.value))},z=V=>{if(o)return;const ee=L()||typeof C!="number"||!Number.isFinite(C)?0:C,te=$s(ee+V,e.currency,r);W(te)||(v(String(te)),N(te),F(te))},ne=k.isValid&&k.change>0,G=!k.isValid&&k.received>0,se=xe(k.change,r,e.currency),Y=xe(e.value,r,e.currency),[J,Q]=h.useState(""),q=h.useRef(null);h.useEffect(()=>{q.current&&clearTimeout(q.current);const V=ne?_t(x.changeMessageTemplate,{change:se}):"",ee=ne?sx:0;return q.current=setTimeout(()=>Q(V),ee),()=>{q.current&&clearTimeout(q.current)}},[ne,se,x.changeMessageTemplate]);const oe=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:_,id:oe,label:x.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:A,onChange:V=>E(V.target.value),onFocus:M,onBlur:S,placeholder:x.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?_t(x.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-received-input`}),I.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":x.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(O,{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":_t(x.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[x.exactAmountLabel," ",Y]}),I.map(V=>{const ee=lx(V,r,e.currency);return t.jsx(O,{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":_t(x.quickAmountAriaTemplate,{amount:ee}),onPress:()=>z(V),"data-testid":`${p}-quick-amount-${V}`,children:ee},V)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:x.changeLabel,description:_t(x.changeMessageTemplate,{change:se}),icon:t.jsx(T,{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:J})]})},dx={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Za=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},vl=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":p="check-tender-form"})=>{const x={...dx,...r},g=n!==void 0,[y,b]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Za()}),[w,C]=h.useState(!!s?.checkNumber),A=h.useMemo(()=>g?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Za()}:y,[g,n,y]),v=h.useCallback(F=>{g||b(F);const E=F.checkNumber.trim(),_={amount:e.value,checkNumber:E,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:E.length>0&&e.value>0};a?.(_)},[g,e.value,i,a]),S=h.useCallback(F=>E=>{l||(F==="checkNumber"&&E.length>0&&C(!0),v({...A,[F]:E}))},[A,v,l]),L=h.useCallback(()=>{l||C(!0)},[l]),N=w&&A.checkNumber.trim()==="",$=`${p}-check-number`,k=`${p}-bank-name`,M=`${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:$,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:A.checkNumber,onChange:F=>S("checkNumber")(F.target.value),onBlur:L,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:N,errorMessage:N?x.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${p}-check-number-input`}),!o&&t.jsx(c.Input,{id:k,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:A.bankName,onChange:F=>S("bankName")(F.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:M,label:x.dateLabel,labelPlacement:"outside",type:"date",value:A.date,onChange:F=>S("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};vl.displayName="CheckTenderForm";const ux={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},mx=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],jl=({dueAmount:e,methodOptions:n=mx,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...ux,...i},m=s!==void 0,[p,x]=h.useState({method:a?.method??"",reference:a?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:p,[m,s,p]),y=h.useCallback(S=>n.find(L=>L.value===S)?.label??"",[n]),b=h.useCallback(S=>{m||x(S);const L=y(S.method),N={amount:e.value,method:S.method,description:L,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(N)},[m,e.value,r,y]),w=h.useCallback(S=>{if(l)return;const L=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";b({...g,method:L})},[g,b,l]),C=h.useCallback(S=>{l||b({...g,reference:S})},[g,b,l]),A=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Ge,{id:A,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:w,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:n.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),o&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:S=>C(S.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};jl.displayName="OtherTenderForm";const fx={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},xx={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},hx={pending:"warning",recorded:"success",failed:"danger"},px=e=>e==="pending"||e==="recorded",gx=e=>`#${e+1}`,wl=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...fx,...r},{collected:f,remaining:m,isComplete:p}=h.useMemo(()=>{const g=n.reduce((b,w)=>px(w.status)?b+w.amount:b,0),y=Math.max(e.value-g,0);return{collected:g,remaining:y,isComplete:g>=e.value&&e.value>0}},[n,e.value]),x=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?f: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?f:m,a,e.currency)})]}),!i&&n.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}),n.map((g,y)=>t.jsx(bx,{index:y,tender:g,locale:a,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:x(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${y}`},g.id))]})]})};wl.displayName="SplitPaymentSummary";const bx=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(O,{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(T,{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:gx(e)}),t.jsx(T,{icon:xx[n.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:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:hx[n.status],startContent:n.status==="recorded"?t.jsx(T,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(T,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},yx=`
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 @@ ${s}${a}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,hl=h.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:rx}),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",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));hl.displayName="ModalShell";const pl=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,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}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(I,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});pl.displayName="ModalShellHeader";const gl=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===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",s),"data-testid":a,children:e});gl.displayName="ModalShellFooter";const ix={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"},lx={1:"grid-cols-1",2:"grid-cols-2"},Un=e=>typeof e=="string"?t.jsx(I,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Qt="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",ox="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Wa="flex-none",cx=typeof window<"u"?h.useLayoutEffect:h.useEffect,qa=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",bl=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const p=e.find(x=>x.key===n);return i==="compact"?t.jsx(dx,{options:e,selectedKey:n,onSelect:s,ariaLabel:r,moreLabel:o,dataTestId:m,...a!==void 0?{heading:a}:{},...l!==void 0?{maxVisible:l}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(He,{"aria-label":a?void 0:r,"aria-labelledby":a?`${m}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:x=>{const y=Array.from(x)[0];typeof y=="string"&&s(y)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:p?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Un(p.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(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Un(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${m}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",lx[u],ix[d]),children:e.map(x=>{const b=n===x.key;return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":b,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>s(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",b?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Un(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};bl.displayName="TileSelect";function dx({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=h.useRef(null),f=h.useRef(null),m=h.useMemo(()=>e.map(($,k)=>({option:$,index:k})).filter(({option:$})=>$.alwaysInMenu!==!0).map(({index:$})=>$),[e]),p=m.length<e.length,x=h.useCallback($=>{const k=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,E)=>F.priority-E.priority||E.index-F.index),R=new Set(k.slice(0,m.length-$).map(F=>F.index));return m.filter(F=>!R.has(F))},[e,m]),[b,y]=h.useState(e.length);cx(()=>{const $=u.current,k=f.current;if(!$||!k)return;const R=()=>{const E=Array.from(k.children),_=E.slice(0,e.length).map(G=>G.getBoundingClientRect().width),T=E[e.length]?.getBoundingClientRect().width??0,q=window.getComputedStyle($),Y=Number.parseFloat(q.columnGap)||0,z=$.clientWidth-(Number.parseFloat(q.paddingLeft)||0)-(Number.parseFloat(q.paddingRight)||0);if(z<=0||_.some(G=>G===0)){y(m.length);return}const ne=G=>{const se=p||G<m.length,K=G+(se?1:0);return x(G).reduce((Q,W)=>Q+(_[W]??0),0)+(se?T:0)+Y*(K-1)<=z};for(let G=m.length;G>=1;G-=1)if(ne(G)){y(G);return}y(1)};R();const F=new ResizeObserver(R);return F.observe($),()=>F.disconnect()},[e,l,x,m,p]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),N=!p&&g===m.length-1&&b===m.length?m.length:g,D=p||N<m.length,j=new Set(x(N)),S=e.filter(($,k)=>j.has(k)),L=D?e.filter(($,k)=>!j.has(k)):[],C=L.find($=>$.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"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:[S.map($=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":n===$.key,isDisabled:$.isDisabled,onPress:()=>s($.key),"data-testid":$["data-testid"]??`${d}-${$.key}`,className:c.cn(Qt,qa(n===$.key)),children:$.label},$.key)),L.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(O,{variant:"light",radius:"full","aria-pressed":C!==void 0,"data-testid":`${d}-more`,className:c.cn(Qt,"gap-1",C!==void 0?"min-w-0":"min-w-fit",qa(C!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:C?.label??l}),t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:C?[C.key]:[],disabledKeys:L.filter($=>$.isDisabled).map($=>$.key),onAction:$=>s(String($)),children:L.map($=>t.jsx(c.DropdownItem,{textValue:$.label,...$.description!==void 0?{description:$.description}:{},"data-testid":$["data-testid"]??`${d}-${$.key}`,children:$.label},$.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:ox,children:[e.map($=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Qt,Wa),children:$.label},$.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Qt,Wa,"gap-1"),children:[l,t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const ux={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},yl=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=ux[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:he(e.value,s,e.currency)})]})};yl.displayName="PaymentTotalBanner";const mx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},vl=({title:e,subtitle:n,backdrop:s="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",mx[s],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}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});vl.displayName="LoadingOverlay";const Ts=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="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]",o),children:[t.jsx(I,{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:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:he(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(O,{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(I,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Ts.displayName="PaymentCashChangeBanner";const jl=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,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(I,{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":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Ts,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};jl.displayName="PaymentSuccessView";const Is=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:p=!1,className:x,"data-testid":b="payment-sub-amount-input"})=>{const y=`${b}-input`,g=s!==void 0,[w,N]=h.useState(a??""),D=g?s:w,{isUntouched:j,markEdited:S}=dl(D),L=h.useCallback(k=>{if(m!==void 0){const R=Number.parseFloat(k.replace(",","."));if(Number.isFinite(R)&&R>m)return}S(k),g||N(k),r?.(k)},[m,r,S,g]),C=ul(j,L),$=h.useCallback(k=>{const R=k.currentTarget;requestAnimationFrame(()=>{R.isConnected&&R.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{ref:C,id:y,label:n,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:D,onChange:k=>L(k.target.value),onFocus:$,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${b}-field`})]})};Is.displayName="PaymentSubAmountInput";const fx={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"}},xx=e=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e,Os=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:x,"data-testid":b="confirm-dialog"})=>{const y=i??l??null,g=fx[d],w=p?null:xx(x??g.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,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:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:w}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(O,{color:g.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Os.displayName="ConfirmDialog";const ct={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"},hx={danger:"bg-danger-50",warning:"bg-warning-50"},wl=({message:e,description:n,confirmLabel:s,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:l="danger",isPending:o=!1,initialFocus:d="cancel",containEscape:u=!0,size:f="sm",as:m="div",className:p,"data-testid":x="inline-confirm"})=>{const b=h.useId(),y=h.useId(),g=h.useRef(null),w=h.useRef(null),N=h.useRef(null),D=n!=null,j=h.useRef({isPending:o,containEscape:u,onCancel:i});j.current={isPending:o,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?w:N).current?.focus()},[]),h.useEffect(()=>{const C=g.current;if(C===null)return;const $=k=>{k.key==="Escape"&&(j.current.containEscape&&k.stopPropagation(),!j.current.isPending&&j.current.onCancel())};return C.addEventListener("keydown",$),()=>C.removeEventListener("keydown",$)},[]);const S=h.useRef(!1);h.useLayoutEffect(()=>{const C=g.current;if(C===null)return;const $=document.activeElement;if(o){const k=$===null||$===document.body||!C.contains($),R=$ instanceof HTMLButtonElement&&$.disabled;S.current&&(k||R)&&C.focus({preventScroll:!0});return}$===C&&(d==="confirm"?w:N).current?.focus()},[o,d]);const L=t.jsx(c.Card,{ref:g,role:"alertdialog","aria-modal":"false","aria-labelledby":b,"aria-describedby":D?y:void 0,"aria-busy":o||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{S.current=!0},onBlur:C=>{const $=C.relatedTarget;S.current=$ instanceof Node&&C.currentTarget.contains($)},className:c.cn(ct.box,hx[l],m==="div"&&p),"data-testid":x,children:t.jsxs(c.CardBody,{className:ct.body,children:[t.jsxs("div",{className:ct.text,children:[t.jsx("p",{id:b,className:ct.message,children:e}),D?t.jsx("p",{id:y,className:ct.description,children:n}):null]}),t.jsxs("div",{className:ct.actions,children:[t.jsx(O,{ref:w,size:f,color:l,variant:"solid",onPress:r,isLoading:o,"data-testid":`${x}-confirm`,children:s}),t.jsx(O,{ref:N,size:f,color:"default",variant:"light",onPress:i,isDisabled:o,"data-testid":`${x}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(ct.item,p),children:L}):L};wl.displayName="InlineConfirm";const px={guardScope:(e,n)=>n(),bypass:e=>e(),report:()=>{},unreport:()=>{}},wn=h.createContext(px),zs=h.createContext(null);function gx(e){const{report:n,unreport:s}=h.useContext(wn),a=h.useContext(zs),r=h.useId();h.useEffect(()=>{n(r,{scope:a,isDirty:e})},[n,r,a,e]),h.useEffect(()=>()=>s(r),[s,r])}function bx(){const{guardScope:e,bypass:n}=h.useContext(wn);return h.useMemo(()=>({guard:s=>e(null,s),bypass:n}),[e,n])}function Nl(){const{guardScope:e}=h.useContext(wn),n=h.useContext(zs);return h.useCallback(s=>e(n,s),[e,n])}const yx=({scope:e,children:n})=>t.jsx(zs.Provider,{value:e,children:n}),Cl=({guard:e,children:n,title:s="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":l="discard-guard"})=>{const{pending:o,confirmKey:d,confirm:u,keepEditing:f,report:m,unreport:p,guardScope:x}=e.internals,b=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:p}),[x,e.bypass,m,p]);return t.jsxs(wn.Provider,{value:b,children:[n,t.jsx(Os,{isOpen:o!==null,onOpenChange:y=>{y||f()},onConfirm:u,variant:"warning",title:s,description:a,confirmLabel:r,cancelLabel:i,"data-testid":l},d)]})};Cl.displayName="DiscardGuard";const Bs=h.createContext(null);function vx(){const e=h.useContext(Bs),n=Nl(),s=e?.back,a=h.useCallback(()=>{s&&n(s)},[n,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const jx=["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 wx(e){for(const n of e.querySelectorAll(jx))if(!n.closest('[hidden], [inert], [aria-hidden="true"]'))return n;return null}function Ga(e,n){return!e||!e.isConnected||!n.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const Nx=new Set(["menu","listbox","dialog","grid","tree"]);function Cx(e){for(const n of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=n.ownerDocument.getElementById(n.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((n.getAttribute("aria-haspopup")??"false")!=="false"||Nx.has(s.getAttribute("role")??""))return s}return null}const Ka="react-aria-focus-scope-restore";class kx{panels=new Map;active=null;setContainer(n,s){s?this.panels.set(n,{entry:null,last:null,...this.panels.get(n),container:s}):this.panels.delete(n)}setEntry(n,s){const a=this.panels.get(n);a?a.entry=s:s&&this.panels.set(n,{container:null,entry:s,last:null})}remember(n,s){const a=this.panels.get(n);a&&(a.last=s)}setActive(n,s){this.active={key:n,isReturn:s}}focusActive(){if(!this.active)return;const n=this.panels.get(this.active.key),s=n?.container;if(!n||!s||s.contains(document.activeElement))return;((this.active.isReturn&&Ga(n.last,s)?n.last:null)??(Ga(n.entry,s)?n.entry:null)??wx(s))?.focus()}recoverFocus(){const n=this.active?this.panels.get(this.active.key)?.container:null,s=n?Cx(n):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const Sx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",$x="min-w-0 flex-1 truncate text-large font-semibold",Ax="flex shrink-0 items-center gap-2",Dx="size-5";function Ex({panels:e,children:n}){const[s]=h.useState(()=>new kx),{entries:a,back:r}=e,i=a[a.length-1].key,l=h.useRef(null);return h.useLayoutEffect(()=>{const o=l.current;l.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!o||o.activeKey===i)&&(s.setActive(i,o.keys.has(i)),s.focusActive())},[i,a,s]),t.jsx(t.Fragment,{children:a.map((o,d)=>t.jsx(Fx,{entryKey:o.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:s,children:n(o.panel,o)},o.key))})}const Fx=({entryKey:e,isActive:n,canGoBack:s,back:a,memory:r,children:i})=>{const l=h.useRef(null),o=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=l.current;if(r.setContainer(e,u),!u)return;const f=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Ka,f),()=>{u.removeEventListener(Ka,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:n,canGoBack:s,back:a,setEntryFocus:o}),[n,s,a,o]);return t.jsx(Bs.Provider,{value:d,children:t.jsx(yx,{scope:e,children:t.jsx("div",{ref:l,hidden:!n,style:{display:n?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},kl=({title:e,onBack:n,backLabel:s="Back",isBackDisabled:a,size:r="md",actions:i,className:l,"data-testid":o="modal-panel-header"})=>{const d=h.useContext(Bs),u=Nl(),f=h.useId(),m=n??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Sx,l),"data-testid":o,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":f,isDisabled:a,onPress:()=>u(m),"data-testid":`${o}-back`,children:t.jsx(I,{icon:"solar:arrow-left-outline",className:Dx,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:$x,"data-testid":`${o}-title`,children:e}),i?t.jsx("div",{className:Ax,children:i}):null]})};kl.displayName="ModalPanelHeader";function Lx(e){const n=h.useRef(1),[s]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${n.current}`;return n.current+=1,{key:m,panel:f}},[]),l=h.useCallback(f=>{const m=i(f);r(p=>[...p,m])},[i]),o=h.useCallback(()=>{r(f=>f.length>1?f.slice(0,-1):f)},[]),d=h.useCallback(f=>{const m=i(f);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(f=>{r([i(f===void 0?s:f)])},[i,s]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:l,back:o,replace:d,reset:u}),[a,l,o,d,u])}function Mx(){const e=h.useRef(new Map),[n,s]=h.useState(0),[a,r]=h.useState(null),[i,l]=h.useState(0),o=h.useCallback(()=>{let g=0;for(const w of e.current.values())w.isDirty&&(g+=1);s(g)},[]),d=h.useCallback((g,w)=>{e.current.set(g,w),o()},[o]),u=h.useCallback(g=>{e.current.delete(g),o()},[o]),f=h.useCallback((g,w)=>{let N=!1;for(const D of e.current.values())D.isDirty&&(g===null||D.scope===g)&&(N=!0);N?r({leave:w}):w()},[]),m=h.useCallback(g=>f(null,g),[f]),p=h.useCallback(g=>{for(const w of e.current.values())w.isDirty=!1;o(),r(null),g()},[o]),x=h.useCallback(g=>w=>{w?g(!0):m(()=>g(!1))},[m]),b=h.useCallback(()=>{const g=a?.leave;r(null),l(w=>w+1),g?.()},[a]),y=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:n>0,guard:m,bypass:p,guardOpenChange:x,internals:{pending:a,confirmKey:i,confirm:b,keepEditing:y,report:d,unreport:u,guardScope:f}}),[n,m,p,x,a,i,b,y,d,u,f])}const Rx=60,_x=(e,n,s=Rx)=>n?e>s:e<-s,Sl=(e,n)=>Math.max(0,Math.min(e,n)),Px=160,Tx=(e,n,s=Px)=>Math.min(e,Math.max(0,n-s)),Ix=(e,n,s)=>Sl(e-n,s),Ox=(e,n,s)=>e!==null?Sl(e,s):n?s:0,zx=e=>e?"":"transition-[height] duration-300 ease-out",Bx=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Ix(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{_x(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),ft=(e,n)=>he(e.value,n,e.currency),Ya="opacity-60 transition-opacity",Vs=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const l=!!e.children&&e.children.length>0,o=!!s&&r,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:We[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-[13px] text-default-600 line-through",e.pending&&Ya),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&&Ya),children:ft(e.amount,n)}),o&&t.jsx(O,{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:()=>s(e.id),children:t.jsx(I,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),re(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(I,{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(I,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,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??f}`,className:"flex shrink-0 items-center",children:t.jsx(I,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),l&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Vs,{item:u,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};Vs.displayName="SummaryItemRow";const $l=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),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:ft(e.amount,n)})]});$l.displayName="SummaryServiceFeeRow";const Us=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:l=!1})=>{const o=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:l?void 0:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:l?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[o?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",l&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(I,{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",!l&&"text-base",e.amountTone==="success"&&"text-success"),children:ft(e.amount,n)})]})};Us.displayName="SummaryTotalsLineRow";const Al=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:p=!1,classNames:x})=>{const b=(s?.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",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),b?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:s.map(y=>t.jsx(Vs,{item:y,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:f,compact:p},y.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($l,{fee:a,locale:i,className:x.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",x.totalsRows),children:r.map((y,g)=>t.jsx(Us,{row:y,locale:i,emphasized:!p&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:p},y.key))})]})};Al.displayName="SummaryBody";const Dl=({total:e,locale:n,compact:s=!1,className:a})=>{const r=s?"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:ft(e.amount,n)})]})};Dl.displayName="SummaryGrandTotalRow";const El=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),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:ft(e.amount,n)})]});El.displayName="SummarySecondaryTotalRow";const fn=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});fn.displayName="SummaryPrimaryCta";const Fl=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,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",!l&&"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(I,{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",!l&&"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:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:ft(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:ft(s.amount,a)})]})]})]})});Fl.displayName="SummaryCollapseHeader";const Ll=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,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(I,{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})]});Ll.displayName="SummaryCartButton";const Ml=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.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-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(Ll,{cart:i,ariaLabel:l,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(fn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(fn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),o&&t.jsx("div",{children:o})]});Ml.displayName="SummaryActionBar";const Vx="(max-width: 767px)",Ux=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Hx=(e=Vx)=>{const[n,s]=h.useState(()=>Ux(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},Rl=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:p,isOpen:x,onToggleOpen:b,defaultOpen:y=!1,primaryAction:g,isLoading:w=!1,onRemoveItem:N,showRemoveButton:D,ctaCaption:j,ctaError:S,variant:L,cart:C,emptyState:$,labels:k,classNames:R={},density:F="default","data-testid":E="summary",className:_})=>{const T=k?.removeAriaLabel??"Remove item",q=k?.removeTotalRowAriaLabel??"Remove discount",Y=k?.removePostTotalRowAriaLabel??"Remove applied code",z=k?.toggleAriaLabel??"Toggle summary",ne=k?.cartAriaLabel??"View cart",G=F==="compact",se=Hx(),J=p??(L??(se?"mobile":"main"))==="mobile",[Q,W]=h.useState(y),ie=x!==void 0,V=!J||(ie?x:Q),ee=h.useCallback(()=>{ie||W(P=>!P),b?.()},[ie,b]),[te,Ie]=h.useState(0),[Fe,Me]=h.useState(null),xt=h.useRef(null),Ye=h.useRef(null),qe=h.useCallback(()=>{const P=xt.current;P&&Ie(Tx(P.scrollHeight,window.innerHeight))},[]),it=h.useCallback(P=>{Ye.current?.disconnect(),Ye.current=null,xt.current=P,P&&(qe(),typeof ResizeObserver<"u"&&(Ye.current=new ResizeObserver(qe),Ye.current.observe(P)))},[qe]);h.useEffect(()=>(window.addEventListener("resize",qe),()=>window.removeEventListener("resize",qe)),[qe]);const tt=Bx({open:V,fullHeight:te,setDragHeight:Me,onToggleOpen:ee}),Oe=Fe!==null,ce=Ox(Fe,V,te),ve=te>0?Math.min(1,Math.max(0,ce/te)):V?1:0,Ge=t.jsx(Dl,{total:o,locale:a,compact:G,className:R.total}),v=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(P=>t.jsx(Us,{row:P,locale:a,emphasized:!1,onRemove:f,removeAriaLabel:Y,showRemoveButton:D,compact:G},P.key))}),A=m&&t.jsx(El,{secondaryTotal:m,locale:a,className:R.secondaryTotal}),M=j!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",R.ctaCaption),children:j}),U=S!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",R.ctaError),children:S}),B=t.jsx(Al,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:l,locale:a,onRemoveItem:N,removeAriaLabel:T,onRemoveTotalRow:u,removeTotalRowAriaLabel:q,showRemoveButton:D,emptyState:$,compact:G,classNames:R});return J?t.jsxs(Ee.motion.section,{"data-testid":E,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:tt.onDrag,onDragEnd:tt.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)]",_,R.base),children:[t.jsx(Fl,{title:e,total:o,secondaryTotal:m,locale:a,open:V,progress:ve,dragging:Oe,toggleAriaLabel:z,onToggleOpen:ee,classNames:R}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:ce},className:c.cn("min-h-0",V&&!Oe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",zx(Oe)),children:t.jsxs("div",{ref:it,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ge,v,A]})}),t.jsx(Ml,{open:V,progress:ve,dragging:Oe,primaryAction:g,isLoading:w,cart:C,cartAriaLabel:ne,ctaCaption:M,ctaError:U,onToggleOpen:ee,classNames:R})]}):t.jsxs("section",{"data-testid":E,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",_,R.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",R.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",R.title),children:e})}),B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ge,v,A,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(fn,{action:g,disabledByLoading:w,className:c.cn("w-full",R.cta)}),U,M]})};Rl.displayName="Summary";const Wx={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},qx={backgroundColor:je.destructive,color:"#fff"},Qa="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Hn="absolute top-0 h-5 w-5 opacity-0",_l=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":p="wizard-shell",children:x})=>{const b={...Wx,...f},y=n.filter(j=>j.state!=="skipped"),g=n.find(j=>j.id===s),w=Math.max(0,y.findIndex(j=>j.id===s)),N=r??e,D=r?b.back:b.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:[N&&t.jsx(O,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${p}-header-back`,startContent:t.jsx(I,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:D}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:g?.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":b.close,onClick:e,className:c.cn(Hn,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(Hn,"left-6"),"data-testid":`${p}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(Hn,"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:[l&&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:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:he(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Qa,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Qa,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:b.owesBadge})]}),t.jsx(O,{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"?qx:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${p}-stepper`,children:y.map((j,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<w&&"bg-pos-ok",S===w&&"bg-primary",S>w&&"bg-pos-line")},j.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:x}),u]})};_l.displayName="WizardShell";const Gx=(e,n,s)=>Math.min(Math.max(e,n),s);function is(e,n,s){const a=Math.max(1,Math.trunc(n)),r=Gx(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,zt(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/a),d=l-o*a;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Kx(e,n){return is(e,n,1)}const Yx=e=>Number.isFinite(e)?e.toFixed(2):"",ls=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=h.useState(null),m=h.useRef(null),p=Math.abs(e-n)>.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",l),"data-testid":o,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??Yx(e),onChange:x=>{const b=x.target.value,y=Number.parseFloat(b.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(b),Number.isFinite(y)&&y>=0?a(y):b.trim()===""&&a(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};ls.displayName="AmountCell";const Qx={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"},Zx="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",Za="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",Wn="absolute h-5 w-5 opacity-0",Xx=e=>{const n=he(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Kx(e.paidAmount,e.quantity);return`${e.quantity} × ${he(s.value,void 0,s.currency)} · ${n}`},Pl=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...Qx,...l},f=[{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",o),"data-testid":d,children:[e.map(m=>{const p=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),g=p?.quantity,w=p?.selected?Math.min(g??y,y):g??0,N=is(m.paidAmount,y,w).value,D=p?.amount??(p?.selected?N:0),j=w===0&&D>.004,S=C=>s(m.id,{selected:C.quantity>0||C.amount>.004,mode:"full",...C}),L=C=>{const $=Math.min(Math.max(C,0),y);S({quantity:$,amount:is(m.paidAmount,y,$).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",x&&"opacity-60"),"data-testid":b,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":`${b}-icon`,children:t.jsx(I,{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":`${b}-detail`,children:m.detail??Xx(m)}),j&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-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":`${b}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:he(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(ls,{value:D,expected:N,max:m.paidAmount.value,onChange:C=>S({quantity:w,amount:C}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),x?t.jsx("span",{className:Zx,"data-testid":`${b}-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":`${b}-qty`,children:[t.jsx("button",{type:"button",className:Za,"aria-label":u.decrease.replace("{name}",m.name),disabled:w===0,onClick:()=>L(w-1),"data-testid":`${b}-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":`${b}-qty-value`,children:w}),t.jsx("button",{type:"button",className:Za,"aria-label":u.increase.replace("{name}",m.name),disabled:w===y,onClick:()=>L(w+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),w>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(y))}),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":`${b}-warning`,children:[t.jsx(I,{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})]}),w>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(He,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:C=>{if(C==="all")return;const $=[...C][0];$&&(r?.(m.id,$),a(m.id,$==="stock"))},"data-testid":`${b}-restock`,children:f.map(C=>t.jsx(c.SelectItem,{children:C.label},C.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(Wn,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:C=>s(m.id,{selected:C,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(Wn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>S({quantity:w,amount:N}),className:c.cn(Wn,"left-5 top-0"),"data-testid":`${b}-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(I,{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(I,{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}",he(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(ls,{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(I,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Pl.displayName="LineItemList";const Jx={color:je.danger},Tl=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Tl.displayName="MetaCard";const Il=({label:e,htmlFor:n,required:s,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:n,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Jx,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Il.displayName="MetaCard.Row";const Ol=({label:e,children:n,className:s,"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",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});Ol.displayName="MetaCard.Section";const eh=Object.assign(Tl,{Row:Il,Section:Ol}),zl=({heading:e,icon:n="lucide:rotate-ccw",action:s,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(I,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.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(I,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});zl.displayName="SectionPanel";const Bl=({name:e,detail:n,icon:s="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(I,{icon:s,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}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});Bl.displayName="CustomerCard";const th={label:"Reason for the return",placeholder:"Select a reason…"},Vl=({options:e,value:n,onChange:s,error:a,isRequired:r,labels:i,className:l,"data-testid":o="reason-select"})=>{const d={...th,...i};return t.jsx(He,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:n?[n]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(l),"data-testid":o,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&s(String(f))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};Vl.displayName="ReasonSelect";const nh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Ul=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...nh,...i},[u,f]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,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":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};Ul.displayName="NotesField";const sh={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},ah={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Xa="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Hs=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=sh[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(I,{icon:ah[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(O,{color:"primary",className:Xa,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(Xa,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Hs.displayName="TenderBanner";const rh={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"},ih={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Hl=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...rh,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,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":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-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":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.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":`${o}-tile-${f.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(I,{icon:ih[f.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:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:he(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.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":`${o}-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(I,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};Hl.displayName="TenderMethods";const lh=e=>e.refunded!==null,oh={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"},ch="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",dh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Wl=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":p="split-tender-panel"})=>{const x={...oh,...f},b=e.filter(lh),y=e.find(C=>C.tenderId===a.tenderId)?.label,g=!!(r?.length&&a.onTenderChange),w=zt(s.currency),{draft:N,setDraft:D,normalize:j}=cl(a.amount,String),S=h.useCallback(C=>{ol(C,w)&&(D(C),a.onAmountChange(mn(C)??0))},[a,D,w]),L=l?.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:x.title}),l&&t.jsx(Hs,{tone:L?"danger":"warning",title:L?x.declinedTitle:x.networkTitle,body:L?x.partDeclinedBody:x.partNetworkBody,onRetry:l.onRetry,retryLabel:x.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:x.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:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:he(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",he(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:ch,children:x.refundedSoFar}),b.map((C,$)=>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-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",$+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(I,{icon:C.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:C.label}),C.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:C.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:he(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(dh,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?x.pending:x.succeeded})]},C.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:x.partHeading.replace("{n}",String(b.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:x.amountForPart}),t.jsx(Is,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:S,onBlur:j,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(C=>{const $=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":$,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.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",$?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${C.tenderId}`,children:[C.icon&&t.jsx(I,{icon:C.icon,width:15,height:15,"aria-hidden":"true"}),C.label]},C.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(O,{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:o,"data-testid":`${p}-back`,children:x.back}),t.jsx(O,{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:x.submit})]})]})};Wl.displayName="SplitTenderPanel";const uh={label:"Supervisor authorization",placeholder:"••••"},ql=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...uh,...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":l,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(I,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(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":`${l}-input`})]})};ql.displayName="PinField";const mh={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}"},fh={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},xh="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ja="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",hh="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",ph=["email","print"],Gl=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const p={...mh,...u},x=n?he(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-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:p.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&hh,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(I,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:p.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:p.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ja,children:p.destinationsTitle}),s.map((b,y)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${y}-${b.status}`,children:[t.jsx("span",{className:"font-semibold",children:b.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:he(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(xh,fh[b.status]),children:b.status==="succeeded"?p.succeeded:p.pending})]})]},`${b.label}-${y}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ja,children:p.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:ph.map(b=>{const y=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":y,onClick:()=>l(b),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${b}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:y,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:p[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:p.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:p.done})})]})};Gl.displayName="OutcomeView";const $e={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"},gh="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",bh="calc(100vw - 1.5rem)",Kl=({label:e,value:n,options:s,onChange:a,clearLabel:r,minWidth:i,"data-testid":l="filter-select"})=>{const o=n!==null,d=o?s.find(x=>x.value===n)?.label:void 0,u=h.useRef(null),f=h.useRef(null),[m,p]=h.useState();return t.jsxs("div",{ref:u,"data-testid":l,"data-slot":"filter-select","data-active":o?"true":void 0,title:d,className:c.cn($e.base,o&&$e.baseActive),style:i===void 0?void 0:{"--filter-select-min":Je(i)},children:[t.jsx(He,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:x=>{if(x==="all")return;const b=[...x][0];a(b===void 0?null:String(b))},onOpenChange:x=>{x&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:bh}},"data-testid":`${l}-trigger`,classNames:{base:c.cn($e.select,$e.cell),trigger:c.cn($e.trigger,o&&$e.triggerActive),value:c.cn($e.value,o&&$e.valueActive),selectorIcon:c.cn(o&&$e.iconActive)},children:s.map(x=>t.jsx(c.SelectItem,{classNames:{title:$e.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${l}-sizer`,className:c.cn($e.sizer,o&&$e.sizerActive,$e.cell),children:d??e}),o&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${l}-clear`,className:$e.clear,children:t.jsx(I,{icon:"lucide:x",className:$e.clearIcon,"aria-hidden":"true"})})]})};Kl.displayName="FilterSelect";const Yl=({children:e,className:n,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:c.cn(gh,n),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});Yl.displayName="FilterSelectGroup";const at={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"},Ql=({status:e,onLoadMore:n,loadingLabel:s,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":l="load-more-footer"})=>{const o=h.useRef(null),d=h.useRef(n),u=h.useRef(!1);return h.useEffect(()=>{d.current=n},[n]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=o.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":l,"data-status":"idle",className:at.idle,children:t.jsx("div",{ref:o,"aria-hidden":"true","data-testid":`${l}-sentinel`,className:at.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":l,"data-status":"loading",role:"status","aria-live":"polite",className:at.base,children:[t.jsx("span",{"aria-hidden":"true",className:at.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${l}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":l,"data-status":"error",className:at.base,children:[t.jsx("span",{role:"alert","data-testid":`${l}-error`,className:at.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${l}-retry`,children:r})]}):t.jsx("div",{"data-testid":l,"data-status":"end",className:i?at.base:at.idle,children:i&&t.jsx("span",{"data-testid":`${l}-end`,children:i})})};Ql.displayName="LoadMoreFooter";const be={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 ${Ht}`,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"},er=({item:e,withActions:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(be.headline,n&&be.headlineWithActions),children:[t.jsx("span",{className:be.title,children:e.title}),re(e.amount)&&!n&&t.jsx("span",{className:be.amount,children:e.amount})]}),n?(re(e.chips)||re(e.amount))&&t.jsxs("span",{className:be.chipsLine,children:[re(e.chips)&&t.jsx("span",{className:be.chipsInline,children:e.chips}),re(e.amount)&&t.jsx("span",{className:be.amount,children:e.amount})]}):re(e.chips)&&t.jsx("span",{className:be.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:be.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:be.row,children:[t.jsx("span",{className:be.rowLabel,children:s.label}),t.jsx("span",{className:be.rowValue,children:s.value})]},a))})]}),Zl=({items:e,ariaLabel:n,onSelect:s,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:be.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(l,o)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:be.skeletonRow,children:[t.jsx("div",{className:nn,style:{height:Je(13),width:Je(130)}}),t.jsx("div",{className:nn,style:{height:Je(11),width:"70%",marginTop:Je(10)}}),t.jsx("div",{className:nn,style:{height:Je(11),width:"45%",marginTop:Je(8)}})]},o))})}):t.jsx("ul",{"aria-label":n,className:be.list,children:e.map(l=>{const o=re(l.actions);return t.jsxs("li",{"data-testid":`${i}-item-${l.id}`,className:be.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(l.id),className:c.cn(be.card,be.cardInteractive),children:t.jsx(er,{item:l,withActions:o})}):t.jsx("div",{className:be.card,children:t.jsx(er,{item:l,withActions:o})}),o&&t.jsx("div",{"data-testid":`${i}-item-${l.id}-actions`,className:be.actions,children:l.actions})]},l.id)})})});Zl.displayName="CardList";const yh=48,ae={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${jn}`,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 ${Ht}`,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"},Xl=h.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));Xl.displayName="CrumbBase";const Jl=({breadcrumb:e=[],onBack:n,backLabel:s,title:a,meta:r,amountLabel:i,amount:l,amountCaption:o,recordId:d,chips:u,statItems:f,stats:m,banner:p,"data-testid":x="record-header"})=>{const{ref:b,width:y}=Ct(),g=!Vt(y,yh),w=e.length>0||!!n,N=!!(f&&f.length>0),D=!!i||re(l)||re(o)||re(d)||re(u)||N;return t.jsxs("div",{ref:b,"data-testid":x,"data-size":g?"narrow":"wide",className:ae.base,children:[w&&t.jsxs("div",{"data-testid":`${x}-band`,className:ae.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":s,"data-testid":`${x}-back`,className:ae.back,children:t.jsx(I,{icon:"lucide:chevron-left",className:ae.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:ae.breadcrumb,list:ae.breadcrumbList},itemClasses:{base:ae.crumbBase,item:ae.crumb,separator:ae.crumbSeparator},children:e.map((j,S)=>t.jsx(c.BreadcrumbItem,{as:Xl,"data-testid":`${x}-crumb-${S}`,isDisabled:!j.onClick&&S<e.length-1,onPress:j.onClick?()=>j.onClick?.():void 0,children:j.label},S))})]}),t.jsxs("div",{className:c.cn(ae.body,g?ae.bodyNarrow:ae.bodyWide),children:[t.jsxs("div",{className:ae.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(ae.title,g?ae.titleNarrow:ae.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:ae.meta,children:r.map((j,S)=>t.jsxs("li",{className:ae.metaLine,children:[j.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:ae.metaIcon,children:j.icon}),t.jsx("span",{className:ae.metaText,children:j.text})]},S))})]}),D&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(ae.money,g?ae.moneyNarrow:ae.moneyWide),children:[i&&t.jsx("div",{className:ae.amountLabel,children:i}),re(l)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(ae.amount,g?ae.amountNarrow:ae.amountWide),children:l}),re(o)&&t.jsx("div",{className:ae.amountCaption,children:o}),re(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:ae.recordId,children:d}),re(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(ae.chips,g?ae.chipsNarrow:ae.chipsWide),children:u}),N&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:ae.statItems,children:f?.map((j,S)=>t.jsxs("div",{"data-testid":`${x}-stat-${S}`,className:c.cn(ae.stat,g?ae.statNarrow:ae.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${S}-label`,className:ae.statLabel,children:j.label}),t.jsx("dd",{"data-testid":`${x}-stat-${S}-value`,className:ae.statValue,style:j.tone?{color:We[j.tone].fg}:void 0,children:j.value})]},j.id??S))})]})]}),re(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:g?ae.statsNarrow:ae.statsWide,children:m}),re(p)&&t.jsx("div",{"data-testid":`${x}-banner`,children:p})]})};Jl.displayName="RecordHeader";const vh=50,Lt={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]"},eo=({children:e,aside:n,"data-testid":s="record-layout"})=>{const{ref:a,width:r}=Ct(),i=re(n),l=i&&r>0&&Vt(r,vh),o=t.jsx("div",{"data-testid":`${s}-main`,className:Lt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:Lt.aside,children:n},"aside"):null;return t.jsx("div",{ref:a,"data-testid":s,"data-layout":l?"split":"stacked",className:c.cn(Lt.base,l?Lt.split:Lt.stacked),children:l?[o,d]:[d,o]})};eo.displayName="RecordLayout";const jh=560,Mt={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"},to=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:s,width:a}=Ct(),r=a>=ff?Math.max(e.length,1):a>=jh?2:1;return t.jsx("div",{ref:s,"data-testid":n,"data-columns":r,className:Mt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,l)=>t.jsxs("div",{"data-testid":`${n}-item-${l}`,className:Mt.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${l}-value`,className:Mt.value,style:i.tone?{color:We[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${l}-label`,className:Mt.label,children:i.label}),re(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${l}-caption`,className:Mt.caption,children:i.caption})]},l))})};to.displayName="StatTiles";const Xe={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"},wh={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]"}},Ws="pill-tabs",qs=(e,n=Ws)=>`${n}-tab-${e}`,Gs=(e,n=Ws)=>`${n}-panel-${e}`,Nh=(e,n=Ws)=>({role:"tabpanel",id:Gs(e,n),"aria-labelledby":qs(e,n),tabIndex:0}),no=({items:e,value:n,onChange:s,ariaLabel:a,idPrefix:r,size:i="md","data-testid":l="pill-tabs"})=>{const o=Cf(),d=!!c.useProviderContext()?.disableAnimation,u=r??l,f=wh[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:o||void 0,selectedKey:n,onSelectionChange:m=>s(String(m)),"data-testid":l,"data-size":i,classNames:{base:Xe.base,tabList:Xe.tabList,cursor:Xe.cursor,tab:c.cn(Xe.tab,f.tab,(o||d)&&Xe.tabStill),tabContent:c.cn(f.tabContent,Xe.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${l}-${m.key}`;return t.jsx(c.Tab,{id:qs(m.key,u),"aria-controls":Gs(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(Xe.title,f.title),children:[re(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(Xe.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(f.count,Xe.count),children:m.count})]})},m.key)})})};no.displayName="PillTabs";const xe={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 ${Ht}`,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"},tr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:xe.dot,style:{backgroundColor:We[e.tone].fg}}),t.jsxs("span",{className:xe.body,children:[t.jsx("span",{className:xe.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:xe.meta,children:[e.reference!=null&&t.jsx("span",{className:xe.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:xe.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:xe.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:xe.detail,children:e.detail})]}),t.jsx("span",{className:xe.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${n}-amount`,className:xe.amount,style:Ut(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:xe.note,style:e.noteTone==="warn"?{color:We.warn.fg}:void 0,children:e.note}):null})]}),so=({rows:e,footer:n,emptyContent:s,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:xe.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:xe.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:xe.base,children:[t.jsx("ul",{className:xe.list,children:e.map(i=>{const l=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":l,className:xe.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(xe.row,xe.rowInteractive),children:t.jsx(tr,{row:i,testId:l})}):t.jsx("div",{className:xe.row,children:t.jsx(tr,{row:i,testId:l})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:xe.footer,children:[t.jsx("span",{className:xe.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:xe.footerAmount,style:Ut(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:xe.footerNote,children:n.note})]})]});so.displayName="AmountList";const _e={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"},ao=({events:e,emptyContent:n,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:n!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:_e.empty,children:n})}):t.jsx("ol",{"data-testid":s,className:_e.list,children:e.map((a,r)=>{const i=r===e.length-1,l=`${s}-event-${a.id}`;return t.jsxs("li",{"data-testid":l,className:c.cn(_e.event,!i&&_e.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:_e.rail,children:[t.jsx("span",{className:_e.dot,style:{backgroundColor:We[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${l}-connector`,className:_e.connector})]}),t.jsxs("div",{className:_e.body,children:[t.jsxs("div",{className:_e.head,children:[t.jsx("span",{className:_e.title,children:a.title}),t.jsx("span",{className:_e.timestamp,children:a.timestamp})]}),re(a.detail)&&t.jsx("div",{className:_e.detail,children:a.detail}),re(a.actor)&&t.jsx("div",{"data-testid":`${l}-actor`,className:_e.actor,children:a.actor})]})]},a.id)})});ao.displayName="ActivityTimeline";const we={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${jn}`,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 ${Ht}`,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"},nr=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:we.rowBody,children:[t.jsxs("span",{className:we.rowHead,children:[t.jsx("span",{className:e.onSelect?we.primaryLinked:we.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:we.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:we.amount,style:Ut(e.amountTone),children:e.amount})]}),ro=({title:e,count:n,rows:s,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),l=!!e;return t.jsxs("section",{"data-testid":r,role:l?"group":void 0,"aria-labelledby":l?i:void 0,className:we.base,children:[l&&t.jsxs("div",{className:we.header,children:[t.jsx("h3",{id:i,className:we.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:we.count,children:n})]}),s.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(we.empty,!l&&we.emptyHeadless),children:a}):t.jsx("ul",{className:we.list,children:s.map((o,d)=>{const u=`${r}-row-${o.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(we.item,d===0&&!l&&we.itemFirstHeadless),children:o.onSelect?t.jsx("button",{type:"button",onClick:o.onSelect,className:c.cn(we.row,we.rowInteractive),children:t.jsx(nr,{row:o,testId:u})}):t.jsx("div",{className:we.row,children:t.jsx(nr,{row:o,testId:u})})},o.id)})})]})};ro.displayName="RelatedRecordList";const io=({title:e,titleAs:n="h2",icon:s,count:a,badge:r,action:i,description:l,footer:o,variant:d="section",body:u="padded",surface:f="card",className:m,children:p,"data-testid":x="record-card"})=>{const b=h.useId(),y=re(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:y?"group":void 0,"aria-labelledby":y?b:void 0,className:c.cn(Ze.base,Of[f],m),children:[y&&t.jsxs("div",{"data-testid":`${x}-header`,className:zf[d],children:[re(s)&&t.jsx("span",{"aria-hidden":"true",className:Ze.icon,children:s}),t.jsx(n,{id:b,className:Ze.title,children:e}),re(a)&&t.jsx("span",{"data-testid":`${x}-count`,className:Ze.count,children:a}),r,re(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:Ze.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:Bf[d][u],children:[re(l)&&t.jsx("p",{"data-testid":`${x}-description`,className:Ze.description,children:l}),p,re(o)&&t.jsx("div",{"data-testid":`${x}-footer`,className:c.cn(Ze.footer,re(p)?Ze.footerAfterContent:Ze.footerAfterDescription),children:o})]})]})};io.displayName="RecordCard";const Ch={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]"},lo=({layout:e="stack",className:n,children:s,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Ch[e],n),children:s});lo.displayName="CardStack";const Zt={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]"},kh={regular:"py-[0.5625rem]",compact:"py-2"},oo=({rows:e,density:n="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:Zt.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${s}-row-${a.id??r}`,className:c.cn(Zt.row,kh[n]),children:[t.jsx("dt",{className:Zt.label,children:a.label}),t.jsx("dd",{className:Zt.value,children:a.value})]},a.id??r))});oo.displayName="KeyValueRows";const Be={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"},co=({items:e,ariaLabel:n,originalAmountLabel:s,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":a,className:Be.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,l=re(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Be.row,style:r.tone?{backgroundColor:We[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Be.body,children:[t.jsx("div",{className:Be.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Be.details,children:r.details.map((o,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Be.separator,children:"·"}),t.jsx("span",{className:Be.detail,children:o})]},d))})]}),t.jsxs("div",{className:Be.trailing,children:[t.jsxs("span",{className:Be.amounts,children:[l&&t.jsxs("s",{"data-testid":`${i}-original`,className:Be.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Be.amount,style:l?{color:We.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});co.displayName="LineItemRows";const Sh=37.5,Ce={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"},uo=({rows:e,total:n,memo:s,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=Ct(),l=i>0&&!Vt(i,Sh),o=l?Ce.rowNarrow:Ce.rowWide,d=l?Ce.labelNarrow:Ce.labelWide,u=l?Ce.noteNarrow:Ce.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":l?"narrow":"wide",className:Ce.base,children:[e.map(f=>{const m=`${a}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(o,Ce.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ce.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ce.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ce.value,style:Ut(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ce.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(o,Ce.totalRow),children:[t.jsx("span",{className:c.cn(d,Ce.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Ce.totalValue,children:n.value})]})}),re(s)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Ce.memo,children:s})]})};uo.displayName="RecordTotals";const os={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},$h={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},mo=({variant:e="text",tone:n,secondary:s,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(os.base,$h[e]),style:Ut(n),children:[a,re(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:os.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});mo.displayName="CellText";const fo=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:os.chipStack,children:e});fo.displayName="ChipStack";exports.ActivityTimeline=ao;exports.AdminFieldLabel=Yi;exports.AdminTable=Oi;exports.AdminTextField=Qi;exports.AdminToolbar=Bi;exports.AmountList=so;exports.AppliedCodeCard=gr;exports.Button=O;exports.CardList=Zl;exports.CardStack=lo;exports.CashTenderForm=Yf;exports.CatalogItemCard=ji;exports.CellText=mo;exports.CheckTenderForm=ml;exports.ChipStack=fo;exports.CommitmentDetails=Ju;exports.ConfirmDialog=Os;exports.ConfirmationModal=Ds;exports.ConfirmationPageTemplate=Nd;exports.CustomerCard=Bl;exports.DatePicker=ys;exports.DensityProvider=Go;exports.DimensionChip=Rs;exports.DiscardGuard=Cl;exports.DonationAmounts=qr;exports.EmptyState=Es;exports.EntityList=sl;exports.EntityListSkeleton=al;exports.EntityRow=nl;exports.ErrorState=Fs;exports.EventDetails=ru;exports.EventDetailsTemplate=kd;exports.ExpireCartTimer=Gr;exports.FeedbackState=Nt;exports.FilterPopover=Si;exports.FilterSelect=Kl;exports.FilterSelectGroup=Yl;exports.Footer=Ad;exports.HeroUIProvider=Wo;exports.HorizontalSteps=Br;exports.InlineConfirm=wl;exports.InstallmentFundAssignment=Ku;exports.InstallmentFundAssignmentSkeleton=Zu;exports.InstallmentSchedule=bm;exports.InstallmentScheduleSkeleton=Sm;exports.InstallmentTable=Em;exports.ItemCard=vi;exports.KeyValueChip=Rs;exports.KeyValueRows=oo;exports.LineItemList=Pl;exports.LineItemRows=co;exports.ListPanel=ll;exports.LoadMoreFooter=Ql;exports.LoadingOverlay=vl;exports.LoadingState=Ls;exports.MembershipSelectCards=_m;exports.MetaCard=eh;exports.ModalPanelHeader=kl;exports.ModalPanels=Ex;exports.ModalShell=hl;exports.ModalShellFooter=gl;exports.ModalShellHeader=pl;exports.Multiselect=Dd;exports.Navbar=wd;exports.NotesField=Ul;exports.OfferCard=rn;exports.OfferCardEmpty=Kr;exports.OfferCardError=Yr;exports.OfferCardList=Jr;exports.OfferCardSkeleton=Qr;exports.OtherTenderForm=fl;exports.OutcomeView=Gl;exports.PageHeader=Di;exports.PaginationSummary=il;exports.PaymentCashChangeBanner=Ts;exports.PaymentSubAmountInput=Is;exports.PaymentSuccessView=jl;exports.PaymentTotalBanner=yl;exports.PickerRow=Xi;exports.PillTabs=no;exports.PinField=ql;exports.ProgramListItem=wi;exports.RICH_TEXT_PRESETS=Hr;exports.ReasonSelect=Vl;exports.RecordCard=io;exports.RecordHeader=Jl;exports.RecordLayout=eo;exports.RecordTotals=uo;exports.RedeemCodeInput=bd;exports.RelatedRecordList=ro;exports.RevenueDistributionCard=ui;exports.RevenueDistributionEmpty=mi;exports.RevenueDistributionError=fi;exports.RevenueDistributionSkeleton=xi;exports.RichTextArea=Wr;exports.RowActions=Zi;exports.SectionPanel=zl;exports.Select=He;exports.SessionTimeline=$i;exports.SplitPaymentSummary=xl;exports.SplitTenderPanel=Wl;exports.StatTiles=to;exports.StatusChip=Ei;exports.Stepper=zr;exports.SuccessState=Ni;exports.Summary=Rl;exports.TableSkeleton=Mi;exports.TenderMethods=Hl;exports.TicketSelection=af;exports.TileSelect=bl;exports.Toggle=Ci;exports.ToolbarButton=Vi;exports.UnderlineTabs=Ui;exports.WizardShell=_l;exports.adminFieldErrorClass=Ki;exports.adminFieldHintClass=Gi;exports.adminFieldLabelClass=_s;exports.adminFieldLabelSuffixClass=Ps;exports.adminInputClass=Wi;exports.adminInputReadOnlyClass=qi;exports.adminInputWrapperClass=Hi;exports.adminRowClass=Pi;exports.adminSurfaceCss=Ho;exports.adminSurfaceTokens=ds;exports.adminTableClass=Ti;exports.adminTableFooterClass=Ii;exports.adminTdClass=_i;exports.adminThClass=Ri;exports.calculateAllocationDifference=Tu;exports.computeChange=Xn;exports.currencyFractionDigits=zt;exports.formatMoney=he;exports.formatOfferCurrency=es;exports.formatRevenueAmount=Mu;exports.formatRevenueCurrency=Ru;exports.generateAutomaticInstallments=gi;exports.generateDistributionId=As;exports.getCurrencySymbol=_u;exports.offerCardVariants=Xr;exports.offerListVariants=Zr;exports.pageRange=rl;exports.parseOfferCurrency=iu;exports.parseRevenueCurrency=Pu;exports.pillTabId=qs;exports.pillTabPanelId=Gs;exports.pillTabPanelProps=Nh;exports.posSurfaceTokens=je;exports.roundToCurrency=vs;exports.useControlSize=qo;exports.useDensity=xn;exports.useDiscardGuard=Mx;exports.useDiscardGuardActions=bx;exports.useModalPanel=vx;exports.useModalPanels=Lx;exports.useReportUnsavedChanges=gx;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,Nl=h.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:yx}),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",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Nl.displayName="ModalShell";const Cl=({title:e,subtitle:n,leading:s,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:[s,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}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(T,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Cl.displayName="ModalShellHeader";const kl=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===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",s),"data-testid":a,children:e});kl.displayName="ModalShellFooter";const vx={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"},jx={1:"grid-cols-1",2:"grid-cols-2"},Kn=e=>typeof e=="string"?t.jsx(T,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,en="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",wx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Xa="flex-none",Nx=typeof window<"u"?h.useLayoutEffect:h.useEffect,Ja=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",Sl=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const p=e.find(x=>x.key===n);return i==="compact"?t.jsx(Cx,{options:e,selectedKey:n,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:m,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Ge,{"aria-label":a?void 0:r,"aria-labelledby":a?`${m}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:x=>{const y=Array.from(x)[0];typeof y=="string"&&s(y)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:p?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Kn(p.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(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Kn(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${m}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",jx[u],vx[d]),children:e.map(x=>{const g=n===x.key;return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":g,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>s(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",g?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Kn(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};Sl.displayName="TileSelect";function Cx({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),f=h.useRef(null),m=h.useMemo(()=>e.map(($,k)=>({option:$,index:k})).filter(({option:$})=>$.alwaysInMenu!==!0).map(({index:$})=>$),[e]),p=m.length<e.length,x=h.useCallback($=>{const k=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,E)=>F.priority-E.priority||E.index-F.index),M=new Set(k.slice(0,m.length-$).map(F=>F.index));return m.filter(F=>!M.has(F))},[e,m]),[g,y]=h.useState(e.length);Nx(()=>{const $=u.current,k=f.current;if(!$||!k)return;const M=()=>{const E=Array.from(k.children),_=E.slice(0,e.length).map(G=>G.getBoundingClientRect().width),I=E[e.length]?.getBoundingClientRect().width??0,W=window.getComputedStyle($),K=Number.parseFloat(W.columnGap)||0,z=$.clientWidth-(Number.parseFloat(W.paddingLeft)||0)-(Number.parseFloat(W.paddingRight)||0);if(z<=0||_.some(G=>G===0)){y(m.length);return}const ne=G=>{const se=p||G<m.length,Y=G+(se?1:0);return x(G).reduce((Q,q)=>Q+(_[q]??0),0)+(se?I:0)+K*(Y-1)<=z};for(let G=m.length;G>=1;G-=1)if(ne(G)){y(G);return}y(1)};M();const F=new ResizeObserver(M);return F.observe($),()=>F.disconnect()},[e,o,x,m,p]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),C=!p&&b===m.length-1&&g===m.length?m.length:b,A=p||C<m.length,v=new Set(x(C)),S=e.filter(($,k)=>v.has(k)),L=A?e.filter(($,k)=>!v.has(k)):[],N=L.find($=>$.key===n);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:[S.map($=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":n===$.key,isDisabled:$.isDisabled,onPress:()=>s($.key),"data-testid":$["data-testid"]??`${d}-${$.key}`,className:c.cn(en,Ja(n===$.key)),children:$.label},$.key)),L.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(O,{variant:"light",radius:"full","aria-pressed":N!==void 0,"data-testid":`${d}-more`,className:c.cn(en,"gap-1",N!==void 0?"min-w-0":"min-w-fit",Ja(N!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:N?.label??o}),t.jsx(T,{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:N?[N.key]:[],disabledKeys:L.filter($=>$.isDisabled).map($=>$.key),onAction:$=>s(String($)),children:L.map($=>t.jsx(c.DropdownItem,{textValue:$.label,...$.description!==void 0?{description:$.description}:{},"data-testid":$["data-testid"]??`${d}-${$.key}`,children:$.label},$.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:wx,children:[e.map($=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(en,Xa),children:$.label},$.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(en,Xa,"gap-1"),children:[o,t.jsx(T,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const kx={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},$l=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=kx[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:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:xe(e.value,s,e.currency)})]})};$l.displayName="PaymentTotalBanner";const Sx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Al=({title:e,subtitle:n,backdrop:s="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",Sx[s],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}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Al.displayName="LoadingOverlay";const Hs=({cashChange:e,label:n="Cash to return",secondaryLine:s,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(T,{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:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(O,{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(T,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Hs.displayName="PaymentCashChangeBanner";const Dl=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,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(T,{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":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Hs,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Dl.displayName="PaymentSuccessView";const qs=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:p=!1,className:x,"data-testid":g="payment-sub-amount-input"})=>{const y=`${g}-input`,b=s!==void 0,[w,C]=h.useState(a??""),A=b?s:w,{isUntouched:v,markEdited:S}=bl(A),L=h.useCallback(k=>{if(m!==void 0){const M=Number.parseFloat(k.replace(",","."));if(Number.isFinite(M)&&M>m)return}S(k),b||C(k),r?.(k)},[m,r,S,b]),N=yl(v,L),$=h.useCallback(k=>{const M=k.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"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:N,id:y,label:n,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:A,onChange:k=>L(k.target.value),onFocus:$,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${g}-field`})]})};qs.displayName="PaymentSubAmountInput";const $x={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"}},Ax=e=>typeof e=="string"?t.jsx(T,{icon:e,className:"size-5","aria-hidden":"true"}):e,Ws=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:x,"data-testid":g="confirm-dialog"})=>{const y=i??o??null,b=$x[d],w=p?null:Ax(x??b.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:C=>r?.(C),placement:"center",size:"md",isDismissable:(f??!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:[w?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:w}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{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(O,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Ws.displayName="ConfirmDialog";const ut={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"},Dx={danger:"bg-danger-50",warning:"bg-warning-50"},El=({message:e,description:n,confirmLabel:s,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:f="sm",as:m="div",className:p,"data-testid":x="inline-confirm"})=>{const g=h.useId(),y=h.useId(),b=h.useRef(null),w=h.useRef(null),C=h.useRef(null),A=n!=null,v=h.useRef({isPending:l,containEscape:u,onCancel:i});v.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?w:C).current?.focus()},[]),h.useEffect(()=>{const N=b.current;if(N===null)return;const $=k=>{k.key==="Escape"&&(v.current.containEscape&&k.stopPropagation(),!v.current.isPending&&v.current.onCancel())};return N.addEventListener("keydown",$),()=>N.removeEventListener("keydown",$)},[]);const S=h.useRef(!1);h.useLayoutEffect(()=>{const N=b.current;if(N===null)return;const $=document.activeElement;if(l){const k=$===null||$===document.body||!N.contains($),M=$ instanceof HTMLButtonElement&&$.disabled;S.current&&(k||M)&&N.focus({preventScroll:!0});return}$===N&&(d==="confirm"?w:C).current?.focus()},[l,d]);const L=t.jsx(c.Card,{ref:b,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":A?y:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{S.current=!0},onBlur:N=>{const $=N.relatedTarget;S.current=$ instanceof Node&&N.currentTarget.contains($)},className:c.cn(ut.box,Dx[o],m==="div"&&p),"data-testid":x,children:t.jsxs(c.CardBody,{className:ut.body,children:[t.jsxs("div",{className:ut.text,children:[t.jsx("p",{id:g,className:ut.message,children:e}),A?t.jsx("p",{id:y,className:ut.description,children:n}):null]}),t.jsxs("div",{className:ut.actions,children:[t.jsx(O,{ref:w,size:f,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${x}-confirm`,children:s}),t.jsx(O,{ref:C,size:f,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${x}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(ut.item,p),children:L}):L};El.displayName="InlineConfirm";const Ex={guardScope:(e,n)=>n(),bypass:e=>e(),report:()=>{},unreport:()=>{}},$n=h.createContext(Ex),Gs=h.createContext(null);function Fx(e){const{report:n,unreport:s}=h.useContext($n),a=h.useContext(Gs),r=h.useId();h.useEffect(()=>{n(r,{scope:a,isDirty:e})},[n,r,a,e]),h.useEffect(()=>()=>s(r),[s,r])}function Lx(){const{guardScope:e,bypass:n}=h.useContext($n);return h.useMemo(()=>({guard:s=>e(null,s),bypass:n}),[e,n])}function Fl(){const{guardScope:e}=h.useContext($n),n=h.useContext(Gs);return h.useCallback(s=>e(n,s),[e,n])}const Rx=({scope:e,children:n})=>t.jsx(Gs.Provider,{value:e,children:n}),Ll=({guard:e,children:n,title:s="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:f,report:m,unreport:p,guardScope:x}=e.internals,g=h.useMemo(()=>({guardScope:x,bypass:e.bypass,report:m,unreport:p}),[x,e.bypass,m,p]);return t.jsxs($n.Provider,{value:g,children:[n,t.jsx(Ws,{isOpen:l!==null,onOpenChange:y=>{y||f()},onConfirm:u,variant:"warning",title:s,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};Ll.displayName="DiscardGuard";const Ys=h.createContext(null);function Mx(){const e=h.useContext(Ys),n=Fl(),s=e?.back,a=h.useCallback(()=>{s&&n(s)},[n,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const _x=["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 Px(e){for(const n of e.querySelectorAll(_x))if(!n.closest('[hidden], [inert], [aria-hidden="true"]'))return n;return null}function er(e,n){return!e||!e.isConnected||!n.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const Tx=new Set(["menu","listbox","dialog","grid","tree"]);function Ix(e){for(const n of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=n.ownerDocument.getElementById(n.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((n.getAttribute("aria-haspopup")??"false")!=="false"||Tx.has(s.getAttribute("role")??""))return s}return null}const tr="react-aria-focus-scope-restore";class Ox{panels=new Map;active=null;setContainer(n,s){s?this.panels.set(n,{entry:null,last:null,...this.panels.get(n),container:s}):this.panels.delete(n)}setEntry(n,s){const a=this.panels.get(n);a?a.entry=s:s&&this.panels.set(n,{container:null,entry:s,last:null})}remember(n,s){const a=this.panels.get(n);a&&(a.last=s)}setActive(n,s){this.active={key:n,isReturn:s}}focusActive(){if(!this.active)return;const n=this.panels.get(this.active.key),s=n?.container;if(!n||!s||s.contains(document.activeElement))return;((this.active.isReturn&&er(n.last,s)?n.last:null)??(er(n.entry,s)?n.entry:null)??Px(s))?.focus()}recoverFocus(){const n=this.active?this.panels.get(this.active.key)?.container:null,s=n?Ix(n):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const zx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Bx="min-w-0 flex-1 truncate text-large font-semibold",Vx="flex shrink-0 items-center gap-2",Ux="size-5";function Hx({panels:e,children:n}){const[s]=h.useState(()=>new Ox),{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)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,a,s]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(qx,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:s,children:n(l.panel,l)},l.key))})}const qx=({entryKey:e,isActive:n,canGoBack:s,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 f=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(tr,f),()=>{u.removeEventListener(tr,f),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:n,canGoBack:s,back:a,setEntryFocus:l}),[n,s,a,l]);return t.jsx(Ys.Provider,{value:d,children:t.jsx(Rx,{scope:e,children:t.jsx("div",{ref:o,hidden:!n,style:{display:n?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Rl=({title:e,onBack:n,backLabel:s="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(Ys),u=Fl(),f=h.useId(),m=n??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(zx,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":f,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(T,{icon:"solar:arrow-left-outline",className:Ux,"aria-hidden":"true"})}):null,t.jsx("h2",{id:f,className:Bx,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:Vx,children:i}):null]})};Rl.displayName="ModalPanelHeader";function Wx(e){const n=h.useRef(1),[s]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(f=>{const m=`panel-${n.current}`;return n.current+=1,{key:m,panel:f}},[]),o=h.useCallback(f=>{const m=i(f);r(p=>[...p,m])},[i]),l=h.useCallback(()=>{r(f=>f.length>1?f.slice(0,-1):f)},[]),d=h.useCallback(f=>{const m=i(f);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(f=>{r([i(f===void 0?s:f)])},[i,s]);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 Gx(){const e=h.useRef(new Map),[n,s]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let b=0;for(const w of e.current.values())w.isDirty&&(b+=1);s(b)},[]),d=h.useCallback((b,w)=>{e.current.set(b,w),l()},[l]),u=h.useCallback(b=>{e.current.delete(b),l()},[l]),f=h.useCallback((b,w)=>{let C=!1;for(const A of e.current.values())A.isDirty&&(b===null||A.scope===b)&&(C=!0);C?r({leave:w}):w()},[]),m=h.useCallback(b=>f(null,b),[f]),p=h.useCallback(b=>{for(const w of e.current.values())w.isDirty=!1;l(),r(null),b()},[l]),x=h.useCallback(b=>w=>{w?b(!0):m(()=>b(!1))},[m]),g=h.useCallback(()=>{const b=a?.leave;r(null),o(w=>w+1),b?.()},[a]),y=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:n>0,guard:m,bypass:p,guardOpenChange:x,internals:{pending:a,confirmKey:i,confirm:g,keepEditing:y,report:d,unreport:u,guardScope:f}}),[n,m,p,x,a,i,g,y,d,u,f])}const Yx=60,Kx=(e,n,s=Yx)=>n?e>s:e<-s,Ml=(e,n)=>Math.max(0,Math.min(e,n)),Qx=160,Zx=(e,n,s=Qx)=>Math.min(e,Math.max(0,n-s)),Xx=(e,n,s)=>Ml(e-n,s),Jx=(e,n,s)=>e!==null?Ml(e,s):n?s:0,eh=e=>e?"":"transition-[height] duration-300 ease-out",th=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Xx(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{Kx(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),ht=(e,n)=>xe(e.value,n,e.currency),nr="opacity-60 transition-opacity",Ks=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!s&&r,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-[13px] text-default-600 line-through",e.pending&&nr),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&&nr),children:ht(e.amount,n)}),l&&t.jsx(O,{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:()=>s(e.id),children:t.jsx(T,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),ie(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(T,{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(T,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(T,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,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??f}`,className:"flex shrink-0 items-center",children:t.jsx(T,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),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(Ks,{item:u,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};Ks.displayName="SummaryItemRow";const _l=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),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:ht(e.amount,n)})]});_l.displayName="SummaryServiceFeeRow";const Qs=({row:e,locale:n,emphasized:s,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(s?"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(O,{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(T,{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:ht(e.amount,n)})]})};Qs.displayName="SummaryTotalsLineRow";const Pl=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:p=!1,classNames:x})=>{const g=(s?.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",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),g?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:s.map(y=>t.jsx(Ks,{item:y,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:f,compact:p},y.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(_l,{fee:a,locale:i,className:x.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",x.totalsRows),children:r.map((y,b)=>t.jsx(Qs,{row:y,locale:i,emphasized:!p&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:p},y.key))})]})};Pl.displayName="SummaryBody";const Tl=({total:e,locale:n,compact:s=!1,className:a})=>{const r=s?"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:ht(e.amount,n)})]})};Tl.displayName="SummaryGrandTotalRow";const Il=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),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:ht(e.amount,n)})]});Il.displayName="SummarySecondaryTotalRow";const pn=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(T,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});pn.displayName="SummaryPrimaryCta";const Ol=({title:e,total:n,secondaryTotal:s,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(T,{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:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:ht(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:ht(s.amount,a)})]})]})]})});Ol.displayName="SummaryCollapseHeader";const zl=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,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(T,{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})]});zl.displayName="SummaryCartButton";const Bl=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.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-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(zl,{cart:i,ariaLabel:o,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(pn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(pn,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),l&&t.jsx("div",{children:l})]});Bl.displayName="SummaryActionBar";const nh="(max-width: 767px)",sh=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,ah=(e=nh)=>{const[n,s]=h.useState(()=>sh(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},Vl=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:p,isOpen:x,onToggleOpen:g,defaultOpen:y=!1,primaryAction:b,isLoading:w=!1,onRemoveItem:C,showRemoveButton:A,ctaCaption:v,ctaError:S,variant:L,cart:N,emptyState:$,labels:k,classNames:M={},density:F="default","data-testid":E="summary",className:_})=>{const I=k?.removeAriaLabel??"Remove item",W=k?.removeTotalRowAriaLabel??"Remove discount",K=k?.removePostTotalRowAriaLabel??"Remove applied code",z=k?.toggleAriaLabel??"Toggle summary",ne=k?.cartAriaLabel??"View cart",G=F==="compact",se=ah(),J=p??(L??(se?"mobile":"main"))==="mobile",[Q,q]=h.useState(y),oe=x!==void 0,V=!J||(oe?x:Q),ee=h.useCallback(()=>{oe||q(P=>!P),g?.()},[oe,g]),[te,Be]=h.useState(0),[Le,_e]=h.useState(null),pt=h.useRef(null),Ze=h.useRef(null),Ye=h.useCallback(()=>{const P=pt.current;P&&Be(Zx(P.scrollHeight,window.innerHeight))},[]),ot=h.useCallback(P=>{Ze.current?.disconnect(),Ze.current=null,pt.current=P,P&&(Ye(),typeof ResizeObserver<"u"&&(Ze.current=new ResizeObserver(Ye),Ze.current.observe(P)))},[Ye]);h.useEffect(()=>(window.addEventListener("resize",Ye),()=>window.removeEventListener("resize",Ye)),[Ye]);const st=th({open:V,fullHeight:te,setDragHeight:_e,onToggleOpen:ee}),Ve=Le!==null,ue=Jx(Le,V,te),we=te>0?Math.min(1,Math.max(0,ue/te)):V?1:0,Ke=t.jsx(Tl,{total:l,locale:a,compact:G,className:M.total}),j=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(P=>t.jsx(Qs,{row:P,locale:a,emphasized:!1,onRemove:f,removeAriaLabel:K,showRemoveButton:A,compact:G},P.key))}),D=m&&t.jsx(Il,{secondaryTotal:m,locale:a,className:M.secondaryTotal}),R=v!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:v}),U=S!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",M.ctaError),children:S}),B=t.jsx(Pl,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:C,removeAriaLabel:I,onRemoveTotalRow:u,removeTotalRowAriaLabel:W,showRemoveButton:A,emptyState:$,compact:G,classNames:M});return J?t.jsxs(Fe.motion.section,{"data-testid":E,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:st.onDrag,onDragEnd:st.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)]",_,M.base),children:[t.jsx(Ol,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:we,dragging:Ve,toggleAriaLabel:z,onToggleOpen:ee,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:ue},className:c.cn("min-h-0",V&&!Ve?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",eh(Ve)),children:t.jsxs("div",{ref:ot,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ke,j,D]})}),t.jsx(Bl,{open:V,progress:we,dragging:Ve,primaryAction:b,isLoading:w,cart:N,cartAriaLabel:ne,ctaCaption:R,ctaError:U,onToggleOpen:ee,classNames:M})]}):t.jsxs("section",{"data-testid":E,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",_,M.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),B,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),Ke,j,D,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(pn,{action:b,disabledByLoading:w,className:c.cn("w-full",M.cta)}),U,R]})};Vl.displayName="Summary";const rh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},ih={backgroundColor:re.destructive,color:"#fff"},lh={warn:{backgroundColor:re["warn-fill"],color:re.warn},ok:{backgroundColor:re["ok-fill"],color:re.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${re.line}`}},Qn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Zn="absolute top-0 h-5 w-5 opacity-0",Ul=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":p="wizard-shell",children:x})=>{const g={...rh,...f},y=n.filter(v=>v.state!=="skipped"),b=n.find(v=>v.id===s),w=Math.max(0,y.findIndex(v=>v.id===s)),C=r??e,A=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:[C&&t.jsx(O,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:C,"data-testid":`${p}-header-back`,startContent:t.jsx(T,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:A}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:b?.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(Zn,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(Zn,"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(Zn,"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(Qn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:g.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(Qn,"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:Qn,style:lh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(O,{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"?ih:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${p}-stepper`,children:y.map((v,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<w&&"bg-pos-ok",S===w&&"bg-primary",S>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:x}),u]})};Ul.displayName="WizardShell";const oh=(e,n,s)=>Math.min(Math.max(e,n),s);function fs(e,n,s){const a=Math.max(1,Math.trunc(n)),r=oh(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,St(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 ch(e,n){return fs(e,n,1)}const dh=e=>Number.isFinite(e)?e.toFixed(2):"",xs=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,f]=h.useState(null),m=h.useRef(null),p=Math.abs(e-n)>.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??dh(e),onChange:x=>{const g=x.target.value,y=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(g),Number.isFinite(y)&&y>=0?a(y):g.trim()===""&&a(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};xs.displayName="AmountCell";const uh={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"},mh="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",fh=e=>{const n=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=ch(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(s.value,void 0,s.currency)} · ${n}`},Hl=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...uh,...o},f=[{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=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),b=p?.quantity,w=p?.selected?Math.min(b??y,y):b??0,C=fs(m.paidAmount,y,w).value,A=p?.amount??(p?.selected?C:0),v=w===0&&A>.004,S=N=>s(m.id,{selected:N.quantity>0||N.amount>.004,mode:"full",...N}),L=N=>{const $=Math.min(Math.max(N,0),y);S({quantity:$,amount:fs(m.paidAmount,y,$).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",x&&"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(T,{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??fh(m)}),v&&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:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(xs,{value:A,expected:C,max:m.paidAmount.value,onChange:N=>S({quantity:w,amount:N}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),x?t.jsx("span",{className:mh,"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:w===0,onClick:()=>L(w-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:w}),t.jsx("button",{type:"button",className:sr,"aria-label":u.increase.replace("{name}",m.name),disabled:w===y,onClick:()=>L(w+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),w>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(y))}),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(T,{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})]}),w>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(Ge,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:N=>{if(N==="all")return;const $=[...N][0];$&&(r?.(m.id,$),a(m.id,$==="stock"))},"data-testid":`${g}-restock`,children:f.map(N=>t.jsx(c.SelectItem,{children:N.label},N.key))})]})]}),!x&&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:N=>s(m.id,{selected:N,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:()=>S({quantity:w,amount:C}),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(T,{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(T,{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(xs,{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(T,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Hl.displayName="LineItemList";const xh={color:re.danger},ql=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ql.displayName="MetaCard";const Wl=({label:e,htmlFor:n,required:s,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:n,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:xh,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Wl.displayName="MetaCard.Row";const Gl=({label:e,children:n,className:s,"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",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});Gl.displayName="MetaCard.Section";const hh=Object.assign(ql,{Row:Wl,Section:Gl}),Yl=({heading:e,icon:n="lucide:rotate-ccw",action:s,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(T,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.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(T,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});Yl.displayName="SectionPanel";const Kl=({name:e,detail:n,icon:s="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(T,{icon:s,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}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});Kl.displayName="CustomerCard";const ph={label:"Reason for the return",placeholder:"Select a reason…"},Ql=({options:e,value:n,onChange:s,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...ph,...i};return t.jsx(Ge,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:n?[n]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const f=[...u][0];f&&s(String(f))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};Ql.displayName="ReasonSelect";const gh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Zl=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...gh,...i},[u,f]=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=>n(m.target.value),maxLength:s,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=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};Zl.displayName="NotesField";const bh={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},yh={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},ar="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",An=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=bh[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,l),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(T,{icon:yh[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(O,{color:"primary",className:ar,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(ar,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:o})]})]})]})};An.displayName="TenderBanner";const vh={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"},jh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Xl=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...vh,...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(An,{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(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.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-${f.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(T,{icon:jh[f.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:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.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(T,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};Xl.displayName="TenderMethods";const wh=e=>e.refunded!==null,Nh={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"},Ch="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",kh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Jl=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:f,className:m,"data-testid":p="split-tender-panel"})=>{const x={...Nh,...f},g=e.filter(wh),y=e.find(N=>N.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),w=St(s.currency),{draft:C,setDraft:A,normalize:v}=gl(a.amount,String),S=h.useCallback(N=>{Us(N,w)&&(A(N),a.onAmountChange(Ht(N)??0))},[a,A,w]),L=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:x.title}),o&&t.jsx(An,{tone:L?"danger":"warning",title:L?x.declinedTitle:x.networkTitle,body:L?x.partDeclinedBody:x.partNetworkBody,onRetry:o.onRetry,retryLabel:x.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:x.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:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",xe(n.value,void 0,n.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Ch,children:x.refundedSoFar}),g.map((N,$)=>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-${N.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",$+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(T,{icon:N.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:N.label}),N.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:N.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(N.refunded.value,void 0,N.refunded.currency)}),t.jsx("span",{className:c.cn(kh,N.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:N.status==="pending"?x.pending:x.succeeded})]},N.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:x.partHeading.replace("{n}",String(g.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:x.amountForPart}),t.jsx(qs,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:C,onChange:S,onBlur:v,maxAmount:s.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(N=>{const $=N.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":$,disabled:N.disabled||d,onClick:()=>a.onTenderChange?.(N.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",$?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${N.tenderId}`,children:[N.icon&&t.jsx(T,{icon:N.icon,width:15,height:15,"aria-hidden":"true"}),N.label]},N.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(O,{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:x.back}),t.jsx(O,{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:x.submit})]})]})};Jl.displayName="SplitTenderPanel";const eo="hsl(var(--heroui-primary))",Sh="hsl(var(--heroui-primary) / 0.05)",to="hsl(var(--heroui-default-100))",no="hsl(var(--heroui-default-600))",Zs={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},le={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"},$h={idle:{borderColor:re.line,backgroundColor:"#fff"},selected:{borderColor:eo,backgroundColor:Sh},declined:{borderColor:re.danger,backgroundColor:re["danger-fill"]}},gn={idle:{backgroundColor:to,color:no},selected:{backgroundColor:eo,color:"#fff"}},Ah={backgroundColor:to,color:no},Dh={borderColor:re.line},rr={declined:{color:re.danger},pending:{color:re.warn,backgroundColor:re["warn-fill"]},done:{color:re.ok,backgroundColor:re["ok-fill"]}},Eh={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"},Fh=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(n=>n.type==="currency")?.value??e}catch{return e}},Lh=({method:e,currency:n,busy:s,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",f=u==="pending"||u==="done",m=s||f,p=!!(e.removable&&l),x=e.cap?.currency??n,g=St(x),y=`${d}-amount`,b=a.amountFor.replace("{method}",e.label),w=h.useCallback(L=>{if(!Us(L,g))return;const N=Ht(L);e.cap&&N!==null&&N>e.cap.value||i(e.id,L)},[g,e.cap,e.id,i]),C=h.useCallback(L=>{const N=L.currentTarget;requestAnimationFrame(()=>{N.isConnected&&N.select()})},[]),A=u==="declined"?"declined":e.selected?"selected":"idle",v=e.statusLabel??(u==="idle"?void 0:a[u]),S=t.jsxs("span",{className:le.toggleHeader,children:[t.jsx("span",{className:le.iconBox,style:e.selected?gn.selected:gn.idle,"data-testid":`${d}-icon`,children:t.jsx(T,{icon:Zs[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:le.text,children:[t.jsx("span",{className:le.label,children:e.label}),u==="declined"&&v?t.jsx("span",{className:le.status,style:rr.declined,"data-testid":`${d}-status`,children:v}):e.subtitle&&t.jsx("span",{className:le.subtitle,children:e.subtitle})]}),f&&v&&t.jsx("span",{className:le.badge,style:rr[u],"data-testid":`${d}-status`,children:v})]});return t.jsxs("div",{className:le.card,style:$h[A],"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(le.toggle,le.focusRing,p&&le.toggleRemovable),"data-testid":`${d}-toggle`,children:S}),t.jsxs("div",{className:le.amountSlot,children:[t.jsx("label",{htmlFor:y,className:"sr-only",children:b}),t.jsx(c.Input,{id:y,"aria-label":b,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:L=>w(L.target.value),onFocus:C,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:Fh(x)}),classNames:{inputWrapper:le.amountWrapper,input:le.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(le.toggle,le.toggleUnselected,le.focusRing,p&&le.toggleRemovable),"data-testid":`${d}-toggle`,children:[S,t.jsx("span",{className:le.lowerSlot,style:Ah,"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:s,onClick:()=>l?.(e.id),className:c.cn(le.remove,le.focusRing),"data-testid":`${d}-remove`,children:t.jsx(T,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},so=({methods:e,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:f,className:m,"data-testid":p="refund-method-cards"})=>{const x={...Eh,...f};return t.jsxs("div",{className:c.cn(le.root,m),"data-testid":p,children:[d&&t.jsx(An,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:x.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:le.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:le.eyebrowRow,children:[t.jsx("p",{className:le.eyebrow,children:x.heading}),o&&t.jsx(kn,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":x.heading,className:le.grid,"data-testid":`${p}-grid`,children:[e.map(g=>t.jsx(Lh,{method:g,currency:i,busy:u,labels:x,onToggle:n,onAmountChange:s,onAmountBlur:a,onRemove:r,testId:`${p}-method-${g.id}`},g.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:le.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(le.another,le.focusRing),style:Dh,"data-testid":`${p}-another`,children:[t.jsx("span",{className:le.iconBox,style:gn.idle,children:t.jsx(T,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:le.label,children:l.label}),t.jsx("span",{className:le.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:le.menuItem,startContent:t.jsx("span",{className:le.iconBox,style:gn.idle,children:t.jsx(T,{icon:Zs[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};so.displayName="RefundMethodCards";const Re={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"},ao="hsl(var(--heroui-primary))",Rh={idle:{borderColor:re.line,backgroundColor:"#fff"},active:{borderColor:ao,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:re.danger,backgroundColor:re["danger-fill"]}},ir={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:ao,color:"#fff"}},Mh={backgroundColor:"#fff",color:re.neutral},jt=e=>({color:ze[e].fg,backgroundColor:ze[e].bg}),_h={queued:jt("neutral"),processing:jt("info"),waiting_reader:jt("warn"),waiting_cash:jt("warn"),done:jt("ok"),failed:jt("danger")},Ph={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},Th={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},lr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Ih=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",ro=({parts:e,activeId:n,labels:s,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Ph,...s},o=n??e.find(Ih)?.id;return t.jsxs("div",{className:c.cn(Re.root,a),"data-testid":r,children:[t.jsx("p",{className:Re.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Re.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,f=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Re.row,style:Rh[f],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Re.main,children:[t.jsx("span",{className:Re.iconBox,style:d?ir.active:ir.idle,children:t.jsx(T,{icon:Zs[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Re.text,children:[t.jsx("span",{className:Re.label,children:l.label}),l.note&&t.jsx("span",{className:Re.note,children:l.note})]}),t.jsx("span",{className:Re.amount,children:xe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Re.badge,style:_h[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(T,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[Th[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Re.prompt,style:Mh,"data-testid":`${u}-prompt`,children:[lr[l.status]&&t.jsx(T,{icon:lr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Re.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Re.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};ro.displayName="RefundProgressList";const Oh={label:"Supervisor authorization",placeholder:"••••"},io=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...Oh,...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(T,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>n(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`})]})};io.displayName="PinField";const zh={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}"},Bh={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Vh="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",or="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",Uh="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",Hh=["email","print"],lo=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:o,onDone:l,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const p={...zh,...u},x=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-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:p.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&Uh,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(T,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:p.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:p.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:or,children:p.destinationsTitle}),s.map((g,y)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${y}-${g.status}`,children:[t.jsx("span",{className:"font-semibold",children:g.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:xe(g.amount.value,void 0,g.amount.currency)}),t.jsx("span",{className:c.cn(Vh,Bh[g.status]),children:g.status==="succeeded"?p.succeeded:p.pending})]})]},`${g.label}-${y}`))]}),o&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:or,children:p.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Hh.map(g=>{const y=i?.includes(g)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":y,onClick:()=>o(g),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${g}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:y,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:p[g]})]},g)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:p.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:l,"data-testid":`${m}-done`,children:p.done})})]})};lo.displayName="OutcomeView";const Ae={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"},qh="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",Wh="calc(100vw - 1.5rem)",oo=({label:e,value:n,options:s,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=n!==null,d=l?s.find(x=>x.value===n)?.label:void 0,u=h.useRef(null),f=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(Ae.base,l&&Ae.baseActive),style:i===void 0?void 0:{"--filter-select-min":tt(i)},children:[t.jsx(Ge,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:x=>{if(x==="all")return;const g=[...x][0];a(g===void 0?null:String(g))},onOpenChange:x=>{x&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:f,placement:"bottom-start",style:{minWidth:m,maxWidth:Wh}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Ae.select,Ae.cell),trigger:c.cn(Ae.trigger,l&&Ae.triggerActive),value:c.cn(Ae.value,l&&Ae.valueActive),selectorIcon:c.cn(l&&Ae.iconActive)},children:s.map(x=>t.jsx(c.SelectItem,{classNames:{title:Ae.optionTitle},children:x.label},x.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Ae.sizer,l&&Ae.sizerActive,Ae.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:Ae.clear,children:t.jsx(T,{icon:"lucide:x",className:Ae.clearIcon,"aria-hidden":"true"})})]})};oo.displayName="FilterSelect";const co=({children:e,className:n,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:c.cn(qh,n),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});co.displayName="FilterSelectGroup";const it={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"},uo=({status:e,onLoadMore:n,loadingLabel:s,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(n),u=h.useRef(!1);return h.useEffect(()=>{d.current=n},[n]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=l.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:it.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:it.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:it.base,children:[t.jsx("span",{"aria-hidden":"true",className:it.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:it.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:it.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?it.base:it.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};uo.displayName="LoadMoreFooter";const ve={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 ${Yt}`,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"},cr=({item:e,withActions:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(ve.headline,n&&ve.headlineWithActions),children:[t.jsx("span",{className:ve.title,children:e.title}),ie(e.amount)&&!n&&t.jsx("span",{className:ve.amount,children:e.amount})]}),n?(ie(e.chips)||ie(e.amount))&&t.jsxs("span",{className:ve.chipsLine,children:[ie(e.chips)&&t.jsx("span",{className:ve.chipsInline,children:e.chips}),ie(e.amount)&&t.jsx("span",{className:ve.amount,children:e.amount})]}):ie(e.chips)&&t.jsx("span",{className:ve.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:ve.rows,children:e.rows.map((s,a)=>t.jsxs("span",{className:ve.row,children:[t.jsx("span",{className:ve.rowLabel,children:s.label}),t.jsx("span",{className:ve.rowValue,children:s.value})]},a))})]}),mo=({items:e,ariaLabel:n,onSelect:s,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:ve.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"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:ve.skeletonRow,children:[t.jsx("div",{className:ln,style:{height:tt(13),width:tt(130)}}),t.jsx("div",{className:ln,style:{height:tt(11),width:"70%",marginTop:tt(10)}}),t.jsx("div",{className:ln,style:{height:tt(11),width:"45%",marginTop:tt(8)}})]},l))})}):t.jsx("ul",{"aria-label":n,className:ve.list,children:e.map(o=>{const l=ie(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:ve.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(o.id),className:c.cn(ve.card,ve.cardInteractive),children:t.jsx(cr,{item:o,withActions:l})}):t.jsx("div",{className:ve.card,children:t.jsx(cr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:ve.actions,children:o.actions})]},o.id)})})});mo.displayName="CardList";const Gh=48,ae={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Sn}`,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 ${Yt}`,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"},fo=h.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));fo.displayName="CrumbBase";const xo=({breadcrumb:e=[],onBack:n,backLabel:s,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:f,stats:m,banner:p,"data-testid":x="record-header"})=>{const{ref:g,width:y}=At(),b=!Wt(y,Gh),w=e.length>0||!!n,C=!!(f&&f.length>0),A=!!i||ie(o)||ie(l)||ie(d)||ie(u)||C;return t.jsxs("div",{ref:g,"data-testid":x,"data-size":b?"narrow":"wide",className:ae.base,children:[w&&t.jsxs("div",{"data-testid":`${x}-band`,className:ae.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":s,"data-testid":`${x}-back`,className:ae.back,children:t.jsx(T,{icon:"lucide:chevron-left",className:ae.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:ae.breadcrumb,list:ae.breadcrumbList},itemClasses:{base:ae.crumbBase,item:ae.crumb,separator:ae.crumbSeparator},children:e.map((v,S)=>t.jsx(c.BreadcrumbItem,{as:fo,"data-testid":`${x}-crumb-${S}`,isDisabled:!v.onClick&&S<e.length-1,onPress:v.onClick?()=>v.onClick?.():void 0,children:v.label},S))})]}),t.jsxs("div",{className:c.cn(ae.body,b?ae.bodyNarrow:ae.bodyWide),children:[t.jsxs("div",{className:ae.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(ae.title,b?ae.titleNarrow:ae.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:ae.meta,children:r.map((v,S)=>t.jsxs("li",{className:ae.metaLine,children:[v.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:ae.metaIcon,children:v.icon}),t.jsx("span",{className:ae.metaText,children:v.text})]},S))})]}),A&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(ae.money,b?ae.moneyNarrow:ae.moneyWide),children:[i&&t.jsx("div",{className:ae.amountLabel,children:i}),ie(o)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(ae.amount,b?ae.amountNarrow:ae.amountWide),children:o}),ie(l)&&t.jsx("div",{className:ae.amountCaption,children:l}),ie(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:ae.recordId,children:d}),ie(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(ae.chips,b?ae.chipsNarrow:ae.chipsWide),children:u}),C&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:ae.statItems,children:f?.map((v,S)=>t.jsxs("div",{"data-testid":`${x}-stat-${S}`,className:c.cn(ae.stat,b?ae.statNarrow:ae.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${S}-label`,className:ae.statLabel,children:v.label}),t.jsx("dd",{"data-testid":`${x}-stat-${S}-value`,className:ae.statValue,style:v.tone?{color:ze[v.tone].fg}:void 0,children:v.value})]},v.id??S))})]})]}),ie(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:b?ae.statsNarrow:ae.statsWide,children:m}),ie(p)&&t.jsx("div",{"data-testid":`${x}-banner`,children:p})]})};xo.displayName="RecordHeader";const Yh=50,Pt={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]"},ho=({children:e,aside:n,"data-testid":s="record-layout"})=>{const{ref:a,width:r}=At(),i=ie(n),o=i&&r>0&&Wt(r,Yh),l=t.jsx("div",{"data-testid":`${s}-main`,className:Pt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:Pt.aside,children:n},"aside"):null;return t.jsx("div",{ref:a,"data-testid":s,"data-layout":o?"split":"stacked",className:c.cn(Pt.base,o?Pt.split:Pt.stacked),children:o?[l,d]:[d,l]})};ho.displayName="RecordLayout";const Kh=560,Tt={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"},po=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:s,width:a}=At(),r=a>=$f?Math.max(e.length,1):a>=Kh?2:1;return t.jsx("div",{ref:s,"data-testid":n,"data-columns":r,className:Tt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${n}-item-${o}`,className:Tt.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${o}-value`,className:Tt.value,style:i.tone?{color:ze[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${o}-label`,className:Tt.label,children:i.label}),ie(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${o}-caption`,className:Tt.caption,children:i.caption})]},o))})};po.displayName="StatTiles";const et={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"},Qh={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]"}},Xs="pill-tabs",Js=(e,n=Xs)=>`${n}-tab-${e}`,ea=(e,n=Xs)=>`${n}-panel-${e}`,Zh=(e,n=Xs)=>({role:"tabpanel",id:ea(e,n),"aria-labelledby":Js(e,n),tabIndex:0}),go=({items:e,value:n,onChange:s,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=If(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,f=Qh[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:n,onSelectionChange:m=>s(String(m)),"data-testid":o,"data-size":i,classNames:{base:et.base,tabList:et.tabList,cursor:et.cursor,tab:c.cn(et.tab,f.tab,(l||d)&&et.tabStill),tabContent:c.cn(f.tabContent,et.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:Js(m.key,u),"aria-controls":ea(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(et.title,f.title),children:[ie(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(et.icon,f.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(f.count,et.count),children:m.count})]})},m.key)})})};go.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 ${Yt}`,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"},dr=({row:e,testId:n})=>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":`${n}-amount`,className:ge.amount,style:Gt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:ge.note,style:e.noteTone==="warn"?{color:ze.warn.fg}:void 0,children:e.note}):null})]}),bo=({rows:e,footer:n,emptyContent:s,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ge.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ge.empty,children:s})}):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(dr,{row:i,testId:o})}):t.jsx("div",{className:ge.row,children:t.jsx(dr,{row:i,testId:o})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ge.footer,children:[t.jsx("span",{className:ge.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ge.footerAmount,style:Gt(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ge.footerNote,children:n.note})]})]});bo.displayName="AmountList";const Te={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"},yo=({events:e,emptyContent:n,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:n!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:Te.empty,children:n})}):t.jsx("ol",{"data-testid":s,className:Te.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${s}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Te.event,!i&&Te.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Te.rail,children:[t.jsx("span",{className:Te.dot,style:{backgroundColor:ze[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Te.connector})]}),t.jsxs("div",{className:Te.body,children:[t.jsxs("div",{className:Te.head,children:[t.jsx("span",{className:Te.title,children:a.title}),t.jsx("span",{className:Te.timestamp,children:a.timestamp})]}),ie(a.detail)&&t.jsx("div",{className:Te.detail,children:a.detail}),ie(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Te.actor,children:a.actor})]})]},a.id)})});yo.displayName="ActivityTimeline";const Ne={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Sn}`,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 ${Yt}`,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"},ur=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ne.rowBody,children:[t.jsxs("span",{className:Ne.rowHead,children:[t.jsx("span",{className:e.onSelect?Ne.primaryLinked:Ne.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Ne.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:Ne.amount,style:Gt(e.amountTone),children:e.amount})]}),vo=({title:e,count:n,rows:s,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:Ne.base,children:[o&&t.jsxs("div",{className:Ne.header,children:[t.jsx("h3",{id:i,className:Ne.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Ne.count,children:n})]}),s.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Ne.empty,!o&&Ne.emptyHeadless),children:a}):t.jsx("ul",{className:Ne.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Ne.item,d===0&&!o&&Ne.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Ne.row,Ne.rowInteractive),children:t.jsx(ur,{row:l,testId:u})}):t.jsx("div",{className:Ne.row,children:t.jsx(ur,{row:l,testId:u})})},l.id)})})]})};vo.displayName="RelatedRecordList";const jo=({title:e,titleAs:n="h2",icon:s,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:f="card",className:m,children:p,"data-testid":x="record-card"})=>{const g=h.useId(),y=ie(e);return t.jsxs("section",{"data-testid":x,"data-variant":d,"data-surface":f,role:y?"group":void 0,"aria-labelledby":y?g:void 0,className:c.cn(Je.base,Jf[f],m),children:[y&&t.jsxs("div",{"data-testid":`${x}-header`,className:ex[d],children:[ie(s)&&t.jsx("span",{"aria-hidden":"true",className:Je.icon,children:s}),t.jsx(n,{id:g,className:Je.title,children:e}),ie(a)&&t.jsx("span",{"data-testid":`${x}-count`,className:Je.count,children:a}),r,ie(i)&&t.jsx("span",{"data-testid":`${x}-action`,className:Je.action,children:i})]}),t.jsxs("div",{"data-testid":`${x}-body`,className:tx[d][u],children:[ie(o)&&t.jsx("p",{"data-testid":`${x}-description`,className:Je.description,children:o}),p,ie(l)&&t.jsx("div",{"data-testid":`${x}-footer`,className:c.cn(Je.footer,ie(p)?Je.footerAfterContent:Je.footerAfterDescription),children:l})]})]})};jo.displayName="RecordCard";const Xh={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]"},wo=({layout:e="stack",className:n,children:s,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Xh[e],n),children:s});wo.displayName="CardStack";const tn={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]"},Jh={regular:"py-[0.5625rem]",compact:"py-2"},No=({rows:e,density:n="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:tn.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${s}-row-${a.id??r}`,className:c.cn(tn.row,Jh[n]),children:[t.jsx("dt",{className:tn.label,children:a.label}),t.jsx("dd",{className:tn.value,children:a.value})]},a.id??r))});No.displayName="KeyValueRows";const He={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"},Co=({items:e,ariaLabel:n,originalAmountLabel:s,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":a,className:He.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=ie(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:He.row,style:r.tone?{backgroundColor:ze[r.tone].bg}:void 0,children:[t.jsxs("div",{className:He.body,children:[t.jsx("div",{className:He.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:He.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:He.separator,children:"·"}),t.jsx("span",{className:He.detail,children:l})]},d))})]}),t.jsxs("div",{className:He.trailing,children:[t.jsxs("span",{className:He.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:He.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:He.amount,style:o?{color:ze.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Co.displayName="LineItemRows";const ep=37.5,ke={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"},ko=({rows:e,total:n,memo:s,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=At(),o=i>0&&!Wt(i,ep),l=o?ke.rowNarrow:ke.rowWide,d=o?ke.labelNarrow:ke.labelWide,u=o?ke.noteNarrow:ke.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:ke.base,children:[e.map(f=>{const m=`${a}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,ke.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,ke.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,ke.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:ke.value,style:Gt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:ke.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,ke.totalRow),children:[t.jsx("span",{className:c.cn(d,ke.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:ke.totalValue,children:n.value})]})}),ie(s)&&t.jsx("div",{"data-testid":`${a}-memo`,className:ke.memo,children:s})]})};ko.displayName="RecordTotals";const hs={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},tp={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},So=({variant:e="text",tone:n,secondary:s,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(hs.base,tp[e]),style:Gt(n),children:[a,ie(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:hs.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});So.displayName="CellText";const $o=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:hs.chipStack,children:e});$o.displayName="ChipStack";exports.ActivityTimeline=yo;exports.AdminFieldLabel=al;exports.AdminTable=Yi;exports.AdminTextField=rl;exports.AdminToolbar=Qi;exports.AmountList=bo;exports.AppliedCodeCard=Sr;exports.Button=O;exports.CardList=mo;exports.CardStack=wo;exports.CashTenderForm=cx;exports.CatalogItemCard=Ei;exports.CellText=So;exports.CheckTenderForm=vl;exports.ChipStack=$o;exports.CommitmentDetails=fm;exports.ConfirmDialog=Ws;exports.ConfirmationModal=Ps;exports.ConfirmationPageTemplate=Td;exports.CustomerCard=Kl;exports.DatePicker=Ss;exports.DensityProvider=lc;exports.DimensionChip=kn;exports.DiscardGuard=Ll;exports.DonationAmounts=ti;exports.EmptyState=Ts;exports.EntityList=ml;exports.EntityListSkeleton=fl;exports.EntityRow=ul;exports.ErrorState=Is;exports.EventDetails=yu;exports.EventDetailsTemplate=Od;exports.ExpireCartTimer=ni;exports.FeedbackState=$t;exports.FilterPopover=_i;exports.FilterSelect=oo;exports.FilterSelectGroup=co;exports.Footer=Vd;exports.HeroUIProvider=rc;exports.HorizontalSteps=Qr;exports.InlineConfirm=El;exports.InstallmentFundAssignment=om;exports.InstallmentFundAssignmentSkeleton=um;exports.InstallmentSchedule=Lm;exports.InstallmentScheduleSkeleton=zm;exports.InstallmentTable=Hm;exports.ItemCard=Di;exports.KeyValueChip=kn;exports.KeyValueRows=No;exports.LineItemList=Hl;exports.LineItemRows=Co;exports.ListPanel=pl;exports.LoadMoreFooter=uo;exports.LoadingOverlay=Al;exports.LoadingState=Os;exports.MembershipSelectCards=Km;exports.MetaCard=hh;exports.ModalPanelHeader=Rl;exports.ModalPanels=Hx;exports.ModalShell=Nl;exports.ModalShellFooter=kl;exports.ModalShellHeader=Cl;exports.Multiselect=Ud;exports.Navbar=Pd;exports.NotesField=Zl;exports.OfferCard=dn;exports.OfferCardEmpty=si;exports.OfferCardError=ai;exports.OfferCardList=oi;exports.OfferCardSkeleton=ri;exports.OtherTenderForm=jl;exports.OutcomeView=lo;exports.PageHeader=Ii;exports.PaginationSummary=hl;exports.PaymentCashChangeBanner=Hs;exports.PaymentSubAmountInput=qs;exports.PaymentSuccessView=Dl;exports.PaymentTotalBanner=$l;exports.PickerRow=ll;exports.PillTabs=go;exports.PinField=io;exports.ProgramListItem=Fi;exports.RICH_TEXT_PRESETS=Jr;exports.ReasonSelect=Ql;exports.RecordCard=jo;exports.RecordHeader=xo;exports.RecordLayout=ho;exports.RecordTotals=ko;exports.RedeemCodeInput=Ld;exports.RefundMethodCards=so;exports.RefundProgressList=ro;exports.RelatedRecordList=vo;exports.RevenueDistributionCard=vi;exports.RevenueDistributionEmpty=ji;exports.RevenueDistributionError=wi;exports.RevenueDistributionSkeleton=Ni;exports.RichTextArea=ei;exports.RowActions=il;exports.SectionPanel=Yl;exports.Select=Ge;exports.SessionTimeline=Pi;exports.SplitPaymentSummary=wl;exports.SplitTenderPanel=Jl;exports.StatTiles=po;exports.StatusChip=Oi;exports.Stepper=Kr;exports.SuccessState=Li;exports.Summary=Vl;exports.TableSkeleton=Vi;exports.TenderMethods=Xl;exports.TicketSelection=yf;exports.TileSelect=Sl;exports.Toggle=Ri;exports.ToolbarButton=Zi;exports.UnderlineTabs=Xi;exports.WizardShell=Ul;exports.adminFieldErrorClass=sl;exports.adminFieldHintClass=nl;exports.adminFieldLabelClass=Bs;exports.adminFieldLabelSuffixClass=Vs;exports.adminInputClass=el;exports.adminInputReadOnlyClass=tl;exports.adminInputWrapperClass=Ji;exports.adminRowClass=qi;exports.adminSurfaceCss=ac;exports.adminSurfaceTokens=gs;exports.adminTableClass=Wi;exports.adminTableFooterClass=Gi;exports.adminTdClass=Hi;exports.adminThClass=Ui;exports.calculateAllocationDifference=Zu;exports.computeChange=rs;exports.currencyFractionDigits=St;exports.formatMoney=xe;exports.formatOfferCurrency=ls;exports.formatRevenueAmount=Gu;exports.formatRevenueCurrency=Yu;exports.generateAutomaticInstallments=Si;exports.generateDistributionId=_s;exports.getCurrencySymbol=Ku;exports.offerCardVariants=li;exports.offerListVariants=ii;exports.pageRange=xl;exports.parseOfferCurrency=vu;exports.parseRevenueCurrency=Qu;exports.pillTabId=Js;exports.pillTabPanelId=ea;exports.pillTabPanelProps=Zh;exports.posSurfaceTokens=re;exports.roundToCurrency=$s;exports.useControlSize=ic;exports.useDensity=bn;exports.useDiscardGuard=Gx;exports.useDiscardGuardActions=Lx;exports.useModalPanel=Mx;exports.useModalPanels=Wx;exports.useReportUnsavedChanges=Fx;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)}})();