@veevarts/design-system 2.0.0-alpha.59 → 2.0.0-alpha.60
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/README.md +22 -0
- package/dist/assistant.cjs +1 -0
- package/dist/assistant.d.ts +10 -0
- package/dist/assistant.js +790 -0
- package/dist/hasContent-BCRxiry-.js +1200 -0
- package/dist/hasContent-JfCtoDIu.cjs +1 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +6253 -7432
- package/dist/patterns/AssistantActivity/AssistantActivity.d.ts +15 -0
- package/dist/patterns/AssistantActivity/formatAssistantDuration.d.ts +10 -0
- package/dist/patterns/AssistantActivity/index.d.ts +3 -0
- package/dist/patterns/AssistantActivity/styles.d.ts +31 -0
- package/dist/patterns/AssistantActivity/types.d.ts +42 -0
- package/dist/patterns/AssistantComposer/AssistantComposer.d.ts +15 -0
- package/dist/patterns/AssistantComposer/index.d.ts +2 -0
- package/dist/patterns/AssistantComposer/styles.d.ts +33 -0
- package/dist/patterns/AssistantComposer/types.d.ts +62 -0
- package/dist/patterns/AssistantMessage/AssistantMessage.d.ts +17 -0
- package/dist/patterns/AssistantMessage/index.d.ts +2 -0
- package/dist/patterns/AssistantMessage/styles.d.ts +45 -0
- package/dist/patterns/AssistantMessage/types.d.ts +84 -0
- package/dist/patterns/AssistantNotice/AssistantNotice.d.ts +18 -0
- package/dist/patterns/AssistantNotice/index.d.ts +2 -0
- package/dist/patterns/AssistantNotice/styles.d.ts +49 -0
- package/dist/patterns/AssistantNotice/types.d.ts +58 -0
- package/dist/patterns/ScrollToLatest/ScrollToLatest.d.ts +18 -0
- package/dist/patterns/ScrollToLatest/index.d.ts +2 -0
- package/dist/patterns/ScrollToLatest/styles.d.ts +11 -0
- package/dist/patterns/ScrollToLatest/types.d.ts +36 -0
- package/dist/test/backdrop.d.ts +12 -0
- package/package.json +21 -2
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"),
|
|
2
|
-
`),a
|
|
3
|
-
font-family: ${
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),o=require("@heroui/react"),h=require("react"),p=require("./hasContent-JfCtoDIu.cjs"),ee=require("lucide-react"),ze=require("framer-motion"),gs=require("@tiptap/react"),dn=require("@tiptap/core"),Bo=require("@tiptap/extension-bold"),Po=require("@tiptap/extension-italic"),To=require("@tiptap/extension-strike"),Oo=require("@tiptap/extension-underline"),zo=require("@tiptap/extension-code"),Vo=require("@tiptap/extension-color"),Uo=require("@tiptap/extension-highlight"),Ho=require("@tiptap/extension-link"),Wo=require("@tiptap/extension-text-style"),qo=require("@tiptap/extension-heading"),Go=require("@tiptap/extension-paragraph"),Ko=require("@tiptap/extension-bullet-list"),Yo=require("@tiptap/extension-ordered-list"),Zo=require("@tiptap/extension-task-list"),Qo=require("@tiptap/extension-task-item"),Xo=require("@tiptap/extension-list-item"),Jo=require("@tiptap/extension-code-block"),ec=require("@tiptap/extension-blockquote"),tc=require("@tiptap/extension-horizontal-rule"),ac=require("@tiptap/extension-hard-break"),un=require("@tiptap/extension-history"),sc=require("@tiptap/extension-text-align"),nc=require("@tiptap/extension-document"),rc=require("@tiptap/extension-text"),ic=require("@tiptap/extension-dropcursor"),lc=require("@tiptap/extension-gapcursor"),$e={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:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",700:"#b45309"},info:{100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#2563EB",600:"#1d4ed8",800:"#1e3a8a",900:"#172554"}}},xe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ye={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:sa}=$e.neutral,oc=$e.palettes.warning[700],cc=$e.palettes.warning[100],dt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Xt={"--rust":$e.brand.primary[500],"--rust-fill":dt.rustFill,"--rust-border":dt.rustBorder,"--page":dt.page,"--surface":$e.neutral.white,"--border":dt.border,"--hair":dt.hair,"--ink":sa[900],"--ink2":sa[700],"--sub":sa[500],"--muted":sa[400],"--ok":$e.semantic.success,"--ok-fill":dt.okFill,"--warn":oc,"--warn-fill":cc,"--danger":$e.semantic.danger,"--danger-fill":dt.dangerFill,"--info":$e.semantic.info,"--info-fill":dt.infoFill};Object.fromEntries(Object.entries(Xt).map(([e,a])=>[e.replace(/^--/,""),a]));function dc({scope:e=".acct",fontFamily:a="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(Xt).map(([r,i])=>` ${r}: ${i};`).join(`
|
|
2
|
+
`),n=a?`
|
|
3
|
+
font-family: ${a};
|
|
4
4
|
color: var(--ink);`:"";return`${e} {
|
|
5
|
-
${
|
|
5
|
+
${s}${n}
|
|
6
6
|
}
|
|
7
|
-
`}const de={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Le.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...de});const ht=Le.palettes.info,xs={light:{content1:"#ffffff",content2:"#f4f4f5"},dark:{content1:"#18181b",content2:"#27272a"}},ri=["accent","fill","border","user-bubble","assistant-bubble","focus"],Un={light:{accent:ht[600],fill:ht[100],border:ht[200],"user-bubble":xs.light.content2,"assistant-bubble":xs.light.content1,focus:ht[500]},dark:{accent:ht[300],fill:ht[900],border:ht[800],"user-bubble":xs.dark.content2,"assistant-bubble":xs.dark.content1,focus:ht[400]}};function ii(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw new Error(`bad hex: ${e}`);return[1,3,5].map(s=>parseInt(e.slice(s,s+2),16)).join(" ")}const li=e=>`--ai-${e}`,za=e=>Object.fromEntries(ri.map(s=>[li(s),ii(Un[e][s])])),Va={light:':root, .light, [data-theme="light"]',dark:".dark"};Va.light+"",za("light"),Va.dark+"",za("dark");Object.fromEntries(ri.map(e=>[e,`rgb(var(${li(e)}, ${ii(Un.light[e])}) / <alpha-value>)`]));const oi=h.createContext(void 0);function ci(){return h.useContext(oi)}function hd({children:e,closeLabel:s,locale:n,reducedMotion:a="user"}){const r=ci();return t.jsx(c.HeroUIProvider,{locale:n,reducedMotion:a,children:t.jsx(oi.Provider,{value:s??r,children:e})})}const di="(prefers-reduced-motion: reduce)",ui="data-pos-reduce-motion",ke="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Hn="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",Ns=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Hn}`;function bd(){return typeof document>"u"?!1:document.documentElement.getAttribute(ui)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(di).matches}function Bs(){const[e,s]=h.useState(!1);return h.useEffect(()=>{const n=()=>s(bd()),a=typeof window.matchMedia=="function"?window.matchMedia(di):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[ui]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const gd="whitespace-normal overflow-visible text-clip break-words",Vt={base:"gap-x-2 sm:w-auto sm:min-w-[356px] sm:max-w-[min(32rem,calc(100vw_-_11rem))]",closeButton:"relative inset-auto self-start shrink-0 -my-3 -me-3 h-11 w-11 min-w-11 opacity-100",closeIcon:"h-6 w-6",title:`${gd} me-0`,description:"me-0"};function yd(e){return{...e,base:c.cn(Vt.base,e?.base),closeButton:c.cn(Vt.closeButton,e?.closeButton),closeIcon:c.cn(Vt.closeIcon,e?.closeIcon),title:c.cn(Vt.title,e?.title),description:c.cn(Vt.description,e?.description)}}function vd({toastProps:e,disableAnimation:s,...n}){const a=Bs();return t.jsx(c.ToastProvider,{...n,disableAnimation:s??(a||void 0),toastProps:{...e,classNames:yd(e?.classNames)}})}const mi=h.createContext("default");function zs(){return h.useContext(mi)}function jd(e){return zs()==="touch"?"lg":e}function wd({density:e,children:s}){return t.jsx(mi.Provider,{value:e,children:s})}function Nd(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(n).concat(Object.keys(a)).forEach(i),r}const fi=Object.freeze({left:0,top:0,width:16,height:16}),Es=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Wn=Object.freeze({...fi,...Es}),Nn=Object.freeze({...Wn,body:"",hidden:!1});function Cd(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function Ua(e,s){const n=Cd(e,s);for(const a in Nn)a in Es?a in e&&!(a in n)&&(n[a]=Es[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function kd(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Ua(a[l]||r[l],i)}return o(s),n.forEach(o),Ua(e,i)}function pi(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=Nd(e);for(const r in a){const i=a[r];i&&(s(r,kd(e,r,i)),n.push(r))}return n}const Sd={provider:"",aliases:{},not_found:{},...fi};function Js(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function xi(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Js(e,Sd))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Js(i,Nn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Js(i,Nn))return null}return s}const Ha=Object.create(null);function $d(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function Tt(e,s){const n=Ha[e]||(Ha[e]=Object.create(null));return n[s]||(n[s]=$d(e,s))}function hi(e,s){return xi(s)?pi(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function Ad(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const bi=/^[a-z0-9]+(-[a-z0-9]+)*$/,Vs=(e,s,n,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return s&&!Cs(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return s&&!Cs(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!Cs(l,n)?null:l}return null},Cs=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let as=!1;function gi(e){return typeof e=="boolean"&&(as=e),as}function Wa(e){const s=typeof e=="string"?Vs(e,!0,as):e;if(s){const n=Tt(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function Ed(e,s){const n=Vs(e,!0,as);if(!n)return!1;const a=Tt(n.provider,n.prefix);return s?Ad(a,n.name,s):(a.missing.add(n.name),!0)}function Dd(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),as&&!s&&!e.prefix){let r=!1;return xi(e)&&(e.prefix="",pi(e,(i,o)=>{Ed(i,o)&&(r=!0)})),r}const n=e.prefix;if(!Cs({prefix:n,name:"a"}))return!1;const a=Tt(s,n);return!!hi(a,e)}const yi=Object.freeze({width:null,height:null}),vi=Object.freeze({...yi,...Es}),Ld=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Fd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function qa(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(Ld);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=Fd.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function _d(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function Rd(e,s){return e?"<defs>"+e+"</defs>"+s:s}function Md(e,s,n){const a=_d(e);return Rd(a.defs,s+a.content+n)}const Pd=e=>e==="unset"||e==="undefined"||e==="none";function Td(e,s){const n={...Wn,...e},a={...vi,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(v=>{const g=[],y=v.hFlip,w=v.vFlip;let k=v.rotate;y?w?k+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):w&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let N;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:N=r.height/2+r.top,g.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,g.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}k%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),g.length&&(i=Md(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let p,m;o===null?(m=l===null?"1em":l==="auto"?u:l,p=qa(m,d/u)):(p=o==="auto"?d:o,m=l===null?qa(p,u/d):l==="auto"?u:l);const x={},f=(v,g)=>{Pd(g)||(x[v]=g.toString())};f("width",p),f("height",m);const b=[r.left,r.top,d,u];return x.viewBox=b.join(" "),{attributes:x,viewBox:b,body:i}}const Id=/\sid="(\S+)"/g,Od="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Bd=0;function zd(e,s=Od){const n=[];let a;for(;a=Id.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(Bd++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const Cn=Object.create(null);function Vd(e,s){Cn[e]=s}function kn(e){return Cn[e]||Cn[""]}function qn(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Gn=Object.create(null),Ut=["https://api.simplesvg.com","https://api.unisvg.com"],ks=[];for(;Ut.length>0;)Ut.length===1||Math.random()>.5?ks.push(Ut.shift()):ks.push(Ut.pop());Gn[""]=qn({resources:["https://api.iconify.design"].concat(ks)});function Ud(e,s){const n=qn(s);return n===null?!1:(Gn[e]=n,!0)}function Kn(e){return Gn[e]}const Hd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ga=Hd();function Wd(e,s){const n=Kn(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function qd(e){return e===404}const Gd=(e,s,n)=>{const a=[],r=Wd(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Kd(e){if(typeof e=="string"){const s=Kn(e);if(s)return s.path}return"/"}const Yd=(e,s,n)=>{if(!Ga){n("abort",424);return}let a=Kd(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;Ga(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(qd(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},Qd={prepare:Gd,send:Yd};function ji(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function Zd(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||ji([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Xd=0;function Jd(e,s,n){const a=Xd++,r=ji.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function eu(e){const s={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=Tt(i,o));let p;l in u.icons?p=s.loaded:o===""||u.missing.has(l)?p=s.missing:p=s.pending;const m={provider:i,prefix:o,name:l};p.push(m)}),s}function tu(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Vs(r,s,n):r;i&&a.push(i)}),a}const su={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function nu(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let D=e.resources.slice(0);for(o=[];D.length>1;){const j=Math.floor(Math.random()*D.length);o.push(D[j]),D=D.slice(0,j).concat(D.slice(j+1))}o=o.concat(D)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,p,m=null,x=[],f=[];typeof a=="function"&&f.push(a);function b(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),b(),x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function g(D,j){j&&(f=[]),typeof D=="function"&&f.push(D)}function y(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:x.length,subscribe:g,abort:v}}function w(){d="failed",f.forEach(D=>{D(void 0,p)})}function k(){x.forEach(D=>{D.status==="pending"&&(D.status="aborted")}),x=[]}function N(D,j,L){const S=j!=="success";switch(x=x.filter(M=>M!==D),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(j==="abort"){p=L,w();return}if(S){p=L,x.length||(o.length?$():w());return}if(b(),k(),!e.random){const M=e.resources.indexOf(D.resource);M!==-1&&M!==e.index&&(e.index=M)}d="completed",f.forEach(M=>{M(L)})}function $(){if(d!=="pending")return;b();const D=o.shift();if(D===void 0){if(x.length){m=setTimeout(()=>{b(),d==="pending"&&(k(),w())},e.timeout);return}w();return}const j={status:"pending",resource:D,callback:(L,S)=>{N(j,L,S)}};x.push(j),u++,m=setTimeout($,e.rotate),n(D,s,j.callback)}return setTimeout($),y}function wi(e){const s={...su,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const p=nu(s,l,d,(m,x)=>{a(),u&&u(m,x)});return n.push(p),p}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function Ka(){}const en=Object.create(null);function au(e){if(!en[e]){const s=Kn(e);if(!s)return;const n=wi(s),a={config:s,redundancy:n};en[e]=a}return en[e]}function ru(e,s,n){let a,r;if(typeof e=="string"){const i=kn(e);if(!i)return n(void 0,424),Ka;r=i.send;const o=au(e);o&&(a=o.redundancy)}else{const i=qn(e);if(i){a=wi(i);const o=e.resources?e.resources[0]:"",l=kn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),Ka):a.query(s,r,n)().abort}function Ya(){}function iu(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Zd(e)}))}function lu(e){const s=[],n=[];return e.forEach(a=>{(a.match(bi)?s:n).push(a)}),{valid:s,invalid:n}}function Ht(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!hi(e,n).length){a();return}}catch(r){console.error(r)}a(),iu(e)}function Qa(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function ou(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Qa(e.loadIcons(r,a,n),p=>{Ht(e,r,p)});return}if(i){r.forEach(p=>{const m=i(p,a,n);Qa(m,x=>{const f=x?{prefix:a,icons:{[p]:x}}:null;Ht(e,[p],f)})});return}const{valid:o,invalid:l}=lu(r);if(l.length&&Ht(e,l,null),!o.length)return;const d=a.match(bi)?kn(n):null;if(!d){Ht(e,o,null);return}d.prepare(n,a,o).forEach(p=>{ru(n,p,m=>{Ht(e,p.icons,m)})})}))}const cu=(e,s)=>{const n=tu(e,!0,gi()),a=eu(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Ya)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:p}=d;if(p===l&&u===o)return;o=u,l=p,i.push(Tt(u,p));const m=r[u]||(r[u]=Object.create(null));m[p]||(m[p]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:p,name:m}=d,x=Tt(u,p),f=x.pendingIcons||(x.pendingIcons=new Set);f.has(m)||(f.add(m),r[u][p].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&ou(d,u)}),s?Jd(s,a,i):Ya};function du(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in yi?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const uu=/[\s,]+/;function mu(e,s){s.split(uu).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function fu(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function pu(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function xu(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function hu(e){return"data:image/svg+xml,"+xu(e)}function bu(e){return'url("'+hu(e)+'")'}let ts;function gu(){try{ts=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{ts=null}}function yu(e){return ts===void 0&&gu(),ts?ts.createHTML(e):e}const Ni={...vi,inline:!1},vu={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},ju={display:"inline-block"},Sn={backgroundColor:"currentColor"},Ci={backgroundColor:"transparent"},Za={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Xa={WebkitMask:Sn,mask:Sn,background:Ci};for(const e in Xa){const s=Xa[e];for(const n in Za)s[e+n]=Za[n]}const wu={...Ni,inline:!0};function Ja(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Nu=(e,s,n)=>{const a=s.inline?wu:Ni,r=du(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?vu:{}};if(n){const g=Vs(n,!1,!0);if(g){const y=["iconify"],w=["provider","prefix"];for(const k of w)g[k]&&y.push("iconify--"+g[k]);d.className=y.join(" ")}}for(let g in s){const y=s[g];if(y!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=y;break;case"className":d[g]=(d[g]?d[g]+" ":"")+y;break;case"inline":case"hFlip":case"vFlip":r[g]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&mu(r,y);break;case"color":o.color=y;break;case"rotate":typeof y=="string"?r[g]=fu(y):typeof y=="number"&&(r[g]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete d["aria-hidden"];break;default:a[g]===void 0&&(d[g]=y)}}const u=Td(e,r),p=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,p);let g=0,y=s.id;return typeof y=="string"&&(y=y.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:yu(zd(u.body,y?()=>y+"ID"+g++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:x,height:f}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=pu(m,{...p,width:x+"",height:f+""});return d.style={...o,"--svg":bu(v),width:Ja(p.width),height:Ja(p.height),...ju,...b?Sn:Ci,...l},h.createElement("span",d)};gi(!0);Vd("",Qd);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!Dd(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;Ud(n,r)||console.error(a)}catch{console.error(a)}}}}function ki(e){const[s,n]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(f){if(f){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const v=Wa(b);if(v)return{name:b,data:v}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const f=a.callback;f&&(f(),r({}))}function u(f){if(JSON.stringify(o)!==JSON.stringify(f))return d(),l(f),!0}function p(){var f;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const v=Wa(b);if(u({name:b,data:v}))if(v===void 0){const g=cu([b],p);r({callback:g})}else v&&((f=e.onLoad)===null||f===void 0||f.call(e,b))}h.useEffect(()=>(n(!0),d),[]),h.useEffect(()=>{s&&p()},[e.icon,s]);const{name:m,data:x}=o;return x?Nu({...Wn,...x},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const P=h.forwardRef((e,s)=>ki({...e,_ref:s}));h.forwardRef((e,s)=>ki({inline:!0,...e,_ref:s}));const O=h.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));O.displayName="Button";function Si({code:e,amount:s,onRemove:n,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:s})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(P,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function tn(e,s){return e-s*Math.floor(e/s)}const $i=1721426;function hs(e,s,n,a){s=Yn(e,s);let r=s-1,i=-2;return n<=2?i=0:Ss(s)&&(i=-1),$i-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function Ss(e){return e%4===0&&(e%100!==0||e%400===0)}function Yn(e,s){return e==="BC"?1-s:s}function Cu(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const ku={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 Us{fromJulianDay(s){let n=s,a=n-$i,r=Math.floor(a/146097),i=tn(a,146097),o=Math.floor(i/36524),l=tn(i,36524),d=Math.floor(l/1461),u=tn(l,1461),p=Math.floor(u/365),m=r*400+o*100+d*4+p+(o!==4&&p!==4?1:0),[x,f]=Cu(m),b=n-hs(x,f,1,1),v=2;n<hs(x,f,3,1)?v=0:Ss(f)&&(v=1);let g=Math.floor(((b+v)*12+373)/367),y=n-hs(x,f,g,1)+1;return new rs(x,f,g,y)}toJulianDay(s){return hs(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return ku[Ss(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return Ss(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function Su(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function Ai(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function Ei(e,s){return er(e)-er(s)}function er(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let sn=null;function Di(){return sn==null&&(sn=new Intl.DateTimeFormat().resolvedOptions().timeZone),sn}function tr(e){e=Qn(e,new Us);let s=Yn(e.era,e.year);return Li(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Li(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function sr(e,s){if(s==="UTC")return 0;if(e>0&&s===Di())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=Fi(e,s);return Li(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const nr=new Map;function Fi(e,s){let n=nr.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),nr.set(s,n));let a=n.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ar=864e5;function $u(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>Au(e,s,i))}function Au(e,s,n){let a=Fi(n,s);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function Eu(e,s,n="compatible"){let a=Ri(e);if(s==="UTC")return tr(a);if(s===Di()&&n==="compatible"){a=Qn(a,new Us);let d=new Date,u=Yn(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=tr(a),i=sr(r-ar,s),o=sr(r+ar,s),l=$u(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function _i(e,s,n="compatible"){return new Date(Eu(e,s,n))}function Ri(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new Ds(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function Qn(e,s){if(Su(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,It(a),a}function Zn(e,s){let n=e.copy(),a="hour"in n?zi(n,s):0;$n(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,An(n),Mi(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,Du(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function $n(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function An(e){for(;e.month<1;)$n(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,$n(e,1)}function Du(e){for(;e.day<1;)e.month--,An(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,An(e)}function Mi(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 It(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Mi(e)}function Pi(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function Ti(e,s){return Zn(e,Pi(s))}function Ii(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),It(n),n}function Oi(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),Bi(n),n}function Lu(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=bs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=bs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=bs(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=bs(e.hour,24),s}function Bi(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 bs(e,s){let n=e%s;return n<0&&(n+=s),n}function zi(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,Lu(e)}function Vi(e,s){let n=e.copy();return zi(n,s),n}function Fu(e,s){return Vi(e,Pi(s))}function Ui(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=gt(d,n,0,l.length-1,a?.round),r.era=l[d],It(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=gt(e.year,n,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=gt(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=gt(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),It(r),r}function Hi(e,s,n,a){let r=e.copy();switch(s){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=gt(i,n,o,l,a?.round);break}case"minute":r.minute=gt(e.minute,n,0,59,a?.round);break;case"second":r.second=gt(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=gt(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function gt(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const _u=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Ru=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Mu(e){let s=e.match(_u);if(!s)throw Ru.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new rs(nn(s[1],0,9999),nn(s[2],1,12),1);return n.day=nn(s[3],1,n.calendar.getDaysInMonth(n)),n}function nn(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function Wi(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 qi(e){let s=Qn(e,new Us),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function Pu(e){return`${qi(e)}T${Wi(e)}`}function Tu(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Xn(e,s,n){Tu(e,s),s.set(e,n)}function Gi(e){let s=typeof e[0]=="object"?e.shift():new Us,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var Iu=new WeakMap;class rs{copy(){return this.era?new rs(this.calendar,this.era,this.year,this.month,this.day):new rs(this.calendar,this.year,this.month,this.day)}add(s){return Zn(this,s)}subtract(s){return Ti(this,s)}set(s){return Ii(this,s)}cycle(s,n,a){return Ui(this,s,n,a)}toDate(s){return _i(this,s)}toString(){return qi(this)}compare(s){return Ai(this,s)}constructor(...s){Xn(this,Iu,{writable:!0,value:void 0});let[n,a,r,i,o]=Gi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,It(this)}}var Ou=new WeakMap;class Hs{copy(){return new Hs(this.hour,this.minute,this.second,this.millisecond)}add(s){return Vi(this,s)}subtract(s){return Fu(this,s)}set(s){return Oi(this,s)}cycle(s,n,a){return Hi(this,s,n,a)}toString(){return Wi(this)}compare(s){return Ei(this,s)}constructor(s=0,n=0,a=0,r=0){Xn(this,Ou,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,Bi(this)}}var Bu=new WeakMap;class Ds{copy(){return this.era?new Ds(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Ds(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return Zn(this,s)}subtract(s){return Ti(this,s)}set(s){return Ii(Oi(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return Ui(this,s,n,a);default:return Hi(this,s,n,a)}}toDate(s,n){return _i(this,s,n)}toString(){return Pu(this)}compare(s){let n=Ai(this,s);return n===0?Ei(this,Ri(s)):n}constructor(...s){Xn(this,Bu,{writable:!0,value:void 0});let[n,a,r,i,o]=Gi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,It(this)}}const zu={firstDayOfWeek:"mon",showMonthAndYearPickers:!0,markToday:!0},Vu="data-[today=true]:font-semibold data-[today=true]:ring-1 data-[today=true]:ring-inset data-[today=true]:ring-primary",Uu="Open time options",Hu=320;function En(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function rr(e,s){return s?{...e,classNames:{...e?.classNames,cellButton:En(Vu,e?.classNames?.cellButton)}}:e}function an(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Hs(s,n,a)}function Wu(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function qu(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Hs(n,a));return s}function Gu(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=Uu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...p}=e,m=l!==void 0,[x,f]=h.useState(()=>an(d)),b=m?an(l):x,v=h.useMemo(()=>qu(s),[s]),g=w=>{m||f(w),o?.(w)},y=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(te.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:v.map(w=>{const k=b?.hour===w.hour&&b?.minute===w.minute;return t.jsx(c.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(w),children:Wu(w,u)},`${w.hour}:${w.minute}`)})})})})]});return t.jsx(c.TimeInput,{...p,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,y]}),onChange:w=>g(an(w))})}function Jn(e){if(e.mode==="time")return t.jsx(Gu,{...e});if(e.mode==="datetime"){const{mode:o,granularity:l="minute",hideTimeZone:d=!0,calendarWidth:u=Hu,disableAnimation:p=!0,classNames:m,markToday:x,calendarProps:f,...b}=e;return t.jsx(c.DatePicker,{...b,calendarProps:rr(f,x),calendarWidth:u,classNames:{...m,popoverContent:En("min-w-[20rem]",m?.popoverContent),calendarContent:En("min-h-[18rem]",m?.calendarContent)},disableAnimation:p,granularity:l,hideTimeZone:d})}const{mode:s,granularity:n="day",markToday:a,calendarProps:r,...i}=e;return t.jsx(c.DatePicker,{...i,calendarProps:rr(r,a),granularity:n})}function Ku({label:e,...s}){return t.jsx("button",{...s,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function Yu(e){return e!==void 0&&e.trim()!==""}function Ki(e,s){const n=ci();if(h.isValidElement(s))return s;const a=[e,n].find(Yu);return a===void 0?void 0:t.jsx(Ku,{label:a})}const Yi=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ki(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});Yi.displayName="Drawer";const cs=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ki(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});cs.displayName="Modal";function Qu(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const it=h.forwardRef(({popoverProps:e,...s},n)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(Qu(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});it.displayName="Select";const Zu="motion-reduce:animate-none motion-reduce:transition-none motion-reduce:before:animate-none motion-reduce:before:transition-none motion-reduce:after:transition-none",oe=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Skeleton,{ref:n,...s,classNames:{...e,base:c.cn(Zu,e?.base)}}));oe.displayName="Skeleton";const Xu="text-default-600 data-[hover=true]:text-default-700",ea=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn(Xu,e?.th)}}));ea.displayName="Table";function Ju({state:e,onSubmit:s,onRemove:n,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[p,m]=h.useState(""),x=h.useId(),[f,b]=h.useState(e);e!==f&&(b(e),e==="applied"&&m(""));const v=()=>{const w=p.trim();w&&s(w)},g=w=>{w.key==="Enter"&&(w.preventDefault(),v())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(Si,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const y=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:p,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":y?x:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!p.trim(),onPress:v,children:l})]}),y&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const em={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function tm({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(it,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(te.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(it,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(te.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 sm({isLoggedIn:e,onLogin:s,onLogout:n,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:n,size:"md",children:[t.jsx(te.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:s,size:"md",children:[t.jsx(te.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function nm({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:p}){const m={...em,...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",p),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||s.length>0)&&t.jsx(tm,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(sm,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function am(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 rn;const rm=typeof document<"u"?(rn=h.useInsertionEffect)!==null&&rn!==void 0?rn:h.useLayoutEffect:()=>{};function Ot(e,s,n){let[a,r]=h.useState(e||s),i=h.useRef(a),o=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;rm(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),p=h.useCallback((m,...x)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),n?.(f,...x))},[n]);return[d,p]}function Qi(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(We.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 Zi=h.forwardRef(({color:e="primary",variant:s="default",stepsCount:n=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:p="compact",stepCounterFormat:m,onStepChange:x,currentStep:f,hideProgressBars:b=!1,stepClassName:v,className:g,isDisabled:y=!1,...w},k)=>{const[N,$]=Ot(f,a,x),D=h.useMemo(()=>{let j,L;const S=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":j="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":j="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":j="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":j="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":j="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:j="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(L),S.unshift(j),S},[e]);return t.jsxs("nav",{ref:k,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",p==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"data-testid":"stepper-root",...w,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,n):`Step ${N+1} of ${n}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",D,g),"data-testid":"stepper-list",children:Array.from({length:n})?.map((j,L)=>{const S=N===L?"active":N<L?"inactive":"complete",M=s==="activeLabel"&&S==="active"&&!!i?.[L],E=o&&S!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(c.Tooltip,{content:E?i?.[L]:void 0,isDisabled:!E,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":S==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":M},{"cursor-not-allowed opacity-50":y},v),onClick:()=>!y&&$(L),disabled:y,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(We.LazyMotion,{features:We.domAnimation,children:t.jsx(We.m.div,{animate:S,className:"relative z-10",children:t.jsx(We.m.div,{animate:S,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":M,"bg-(--complete-background-color)":S==="complete","shadow-lg":S==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:S==="complete"&&s==="default"?t.jsx(Qi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<n-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},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":L<N})})})]},L)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(N+1,n):`Step ${N+1} of ${n}`}):null]})});Zi.displayName="Stepper";function im(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function xe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Bt(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function ta(e,s,n="en-US"){const a=Bt(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function Dn(e,s,n,a){return ta(e-s,n,a)}const ir={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))"}},lm="rgb(156 163 175)",om="rgb(107 114 128)",Xi=h.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=lm,inactiveLabelColor:p=om,activeStepVariant:m="bordered",stepClassName:x,circleClassName:f,progressBarClassName:b,labelsClassName:v,labelSlotClassName:g,activeLabelClassName:y,inactiveLabelClassName:w,className:k,ariaLabel:N="Progress",invalidLabelSuffix:$=", has errors",testId:D,isStepReachable:j,...L},S){const[M,E]=Ot(i,a,r),A=ir[s]??ir.primary,R=l??A.active,T=d??A.fg,U=(G,I)=>{const q=G.ariaLabel??(typeof G.title=="string"?G.title:null)??`${I+1}`;return G.invalid?`${q}${$}`:q};return t.jsxs("nav",{...L,"aria-label":N,...D?{"data-testid":D}:{},children:[t.jsx("div",{className:c.cn("flex items-center",k),children:n?.map((G,I)=>{const se=I===M?"active":I<M?"complete":"inactive",q=j?j(I):!0;return t.jsxs(h.Fragment,{children:[t.jsx(O,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${D??"horizontal-steps"}-step-${I}`,"aria-current":se==="active"?"step":void 0,"aria-describedby":G.describedBy,"aria-label":U(G,I),"data-invalid":G.invalid?"true":void 0,isDisabled:!q,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",q?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",G.className,x),onPress:()=>{if(i===void 0){E(I);return}r?.(I)},children:t.jsx(We.LazyMotion,{features:We.domAnimation,children:t.jsx(We.m.div,{animate:se,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?T:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:se==="complete"?t.jsx(Qi,{className:"size-4",style:{color:T}}):t.jsx("span",{children:I+1})})})}),I<n.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:I<M?R:u}})]},I)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",v),children:n?.map((G,I)=>{const se=I<=M;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",se?y:w),style:{color:se?R:p},children:G.title})}),I<n.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},I)})})]})});Xi.displayName="HorizontalSteps";function re(e){return e!=null&&e!==!1&&e!==""}const Ze=e=>os[e],cm={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Ji={done:{icon:Ze("--ok"),meta:Ze("--sub")},"needs-fix":{icon:Ze("--warn"),meta:Ze("--warn")},optional:{icon:Ze("--muted"),meta:Ze("--sub")}},dm=Ze("--ink"),um={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},mm={ready:{fill:Ze("--ok-fill"),text:Ze("--ok")},fix:{fill:Ze("--warn-fill"),text:Ze("--warn")},live:{fill:Ze("--ok-fill"),text:Ze("--ok")}},nt={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Wt={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},At={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function fm({step:e,labels:s}){const n=Ji[e.status];if(e.status==="optional")return t.jsxs("span",{className:nt.meta,style:{color:n.meta},children:[s.optional,re(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const a=e.status==="needs-fix"&&re(e.reason)?e.reason:e.summary,r=e.status==="done"?s.done:s.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",re(a)?t.jsx("span",{className:nt.meta,style:{color:n.meta},children:a}):null]})}function el({steps:e,currentStep:s,defaultStep:n=0,onStepChange:a,isStepReachable:r,ariaLabel:i,statusLabels:o,header:l,maxHeight:d,className:u,style:p,"data-testid":m="vertical-steps",...x}){const[f,b]=Ot(s,n,a);return t.jsxs("div",{...x,"data-testid":m,className:c.cn(nt.root,u),style:d===void 0?p:{maxHeight:d,...p},children:[l,t.jsx("nav",{"aria-label":i,className:nt.nav,children:t.jsx("ol",{className:nt.list,children:e.map((v,g)=>{const y=g===f,w=r?r(g):!0;return t.jsx("li",{children:t.jsxs(O,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:v.testId??`${m}-step-${v.key}`,"data-state":v.status,"data-current":y?"true":void 0,"aria-current":y?"step":void 0,isDisabled:!w,className:c.cn(nt.row,y&&nt.rowCurrent),onPress:()=>b(g),children:[t.jsx(P,{"aria-hidden":!0,icon:cm[v.status],className:nt.icon,style:{color:Ji[v.status].icon}}),t.jsxs("span",{className:nt.text,children:[t.jsx("span",{className:c.cn(nt.label,y&&nt.labelCurrent),style:{color:dm},children:`${g+1}. ${v.label}`})," ",t.jsx(fm,{step:v,labels:o})]})]})},v.key)})})})]})}el.displayName="VerticalSteps";function tl({variant:e,title:s,description:n,className:a,"data-testid":r="steps-readiness"}){const i=mm[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:c.cn(Wt.root,a),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(P,{"aria-hidden":!0,icon:um[e],className:Wt.icon}),t.jsxs("span",{className:Wt.text,children:[t.jsx("span",{className:Wt.title,children:s})," ",re(n)?t.jsx("span",{className:Wt.description,children:n}):null]})]})}tl.displayName="StepsReadiness";function sl({steps:e,currentStep:s,onStepChange:n,progressLabel:a,nextLabel:r,previousLabel:i=b=>b.label,finalActionLabel:o,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":p="step-pager",previousTestId:m=`${p}-prev`,nextTestId:x=`${p}-next`,finalActionTestId:f=`${p}-final`}){const b=e[s-1],v=e[s+1],g=s===e.length-1;return t.jsxs("div",{"data-testid":p,className:c.cn(At.root,u),children:[t.jsx("div",{className:At.spacer,children:b?t.jsx(O,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:At.arrow}),onPress:()=>n(s-1),children:i(b)}):null}),t.jsx("span",{className:At.progress,children:a(s+1,e.length)}),t.jsx("div",{className:At.endSlot,children:v?t.jsx(O,{color:"primary",testId:x,endContent:t.jsx(P,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:At.arrow}),onPress:()=>n(s+1),children:r(v)}):g&&o!==void 0&&l?t.jsx(O,{color:"primary",testId:f,isDisabled:d,onPress:l,children:o}):null})]})}sl.displayName="StepPager";function pm(){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 xm=e=>{const s=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(hm,{...e},s)},hm=({allItems:e,selected:s,onSelectedChange:n,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,p]=h.useState(null),[m,x]=h.useState(null),f=h.useMemo(()=>new Set(s),[s]),b=h.useMemo(()=>new Set(e),[e]),v=h.useMemo(()=>e.filter(E=>!f.has(E)),[e,f]),g=E=>{if(E.length===0)return;const A=Array.from(new Set([...s,...E]));n(A)},y=E=>{if(E.length===0)return;const A=new Set(E);n(s.filter(R=>!A.has(R)))},w=()=>{i.length!==0&&(g(i),o([]))},k=()=>{l.length!==0&&(y(l),d([]))},N=()=>{v.length!==0&&(g(v),o([]))},$=()=>{s.length!==0&&(n([]),d([]))},D=(E,A,R)=>{const T=Math.min(A,R),U=Math.max(A,R);return E.slice(T,U+1)},j=(E,A,R)=>{if(R&&u!==null){o(D(v,u,A)),d([]),p(A);return}const T=i.includes(E);o(T?i.filter(U=>U!==E):[...i,E]),d([]),p(A)},L=(E,A,R)=>{if(R&&m!==null){d(D(s,m,A)),o([]),x(A);return}const T=l.includes(E);d(T?l.filter(U=>U!==E):[...l,E]),o([]),x(A)},S=(E,A,R)=>{const T=R==="available"?i.includes(A)?i:[A]:l.includes(A)?l:[A];E.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:T})),E.dataTransfer.effectAllowed="move"},M=(E,A)=>{E.preventDefault();const R=E.dataTransfer.getData("text/plain");if(R)try{const T=JSON.parse(R),U=(T.items||[]).filter(G=>b.has(G));if(U.length===0||T.source===A)return;A==="selected"?(g(U),o([])):(y(U),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:E=>E.preventDefault(),onDrop:E=>M(E,"available"),children:v.map((E,A)=>{const R=i.includes(E);return t.jsx("button",{type:"button",onClick:T=>{j(E,A,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),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:w,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:k,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:N,isDisabled:v.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:$,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"selected"),children:s.map((E,A)=>{const R=l.includes(E);return t.jsx("button",{type:"button",onClick:T=>{L(E,A,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>S(T,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${R?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function is(e){return typeof e=="string"?e:e.type}function jt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function Nt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const ft={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},bm={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function gm({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=ft.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:n,startContent:t.jsx(te.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(te.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:bm[o]},o))})]})}const ln={bulletList:{label:"Bullet List",icon:te.List},orderedList:{label:"Numbered List",icon:te.ListOrdered},taskList:{label:"Task List",icon:te.ListTodo}};function ym({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive(l)),i=r?ln[r].icon:te.List,o=l=>{const u=ft[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:n,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:s.map(l=>{const d=ln[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:ln[l].label},l)})})]})}function vm({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(r),className:`
|
|
7
|
+
`}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:$e.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const ut=$e.palettes.info,na={light:{content1:"#ffffff",content2:"#f4f4f5"},dark:{content1:"#18181b",content2:"#27272a"}},yr=["accent","fill","border","user-bubble","assistant-bubble","focus"],ys={light:{accent:ut[600],fill:ut[100],border:ut[200],"user-bubble":na.light.content2,"assistant-bubble":na.light.content1,focus:ut[500]},dark:{accent:ut[300],fill:ut[900],border:ut[800],"user-bubble":na.dark.content2,"assistant-bubble":na.dark.content1,focus:ut[400]}};function vr(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw new Error(`bad hex: ${e}`);return[1,3,5].map(a=>parseInt(e.slice(a,a+2),16)).join(" ")}const jr=e=>`--ai-${e}`,mn=e=>Object.fromEntries(yr.map(a=>[jr(a),vr(ys[e][a])])),fn={light:':root, .light, [data-theme="light"]',dark:".dark"};fn.light+"",mn("light"),fn.dark+"",mn("dark");Object.fromEntries(yr.map(e=>[e,`rgb(var(${jr(e)}, ${vr(ys.light[e])}) / <alpha-value>)`]));function uc({children:e,closeLabel:a,locale:s,reducedMotion:n="user"}){const r=p.useCloseLabel();return t.jsx(o.HeroUIProvider,{locale:s,reducedMotion:n,children:t.jsx(p.CloseLabelContext.Provider,{value:a??r,children:e})})}const mc="whitespace-normal overflow-visible text-clip break-words",Mt={base:"gap-x-2 sm:w-auto sm:min-w-[356px] sm:max-w-[min(32rem,calc(100vw_-_11rem))]",closeButton:"relative inset-auto self-start shrink-0 -my-3 -me-3 h-11 w-11 min-w-11 opacity-100",closeIcon:"h-6 w-6",title:`${mc} me-0`,description:"me-0"};function fc(e){return{...e,base:o.cn(Mt.base,e?.base),closeButton:o.cn(Mt.closeButton,e?.closeButton),closeIcon:o.cn(Mt.closeIcon,e?.closeIcon),title:o.cn(Mt.title,e?.title),description:o.cn(Mt.description,e?.description)}}function xc({toastProps:e,disableAnimation:a,...s}){const n=p.useReducedMotion();return t.jsx(o.ToastProvider,{...s,disableAnimation:a??(n||void 0),toastProps:{...e,classNames:fc(e?.classNames)}})}const wr=h.createContext("default");function ka(){return h.useContext(wr)}function pc(e){return ka()==="touch"?"lg":e}function hc({density:e,children:a}){return t.jsx(wr.Provider,{value:e,children:a})}function Nr({code:e,amount:a,onRemove:s,label:n="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(o.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(o.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:n}),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:a})]}),t.jsx(p.Button,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(p.Icon,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ma(e,a){return e-a*Math.floor(e/a)}const Cr=1721426;function ra(e,a,s,n){a=vs(e,a);let r=a-1,i=-2;return s<=2?i=0:ma(a)&&(i=-1),Cr-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+n)}function ma(e){return e%4===0&&(e%100!==0||e%400===0)}function vs(e,a){return e==="BC"?1-a:a}function bc(e){let a="AD";return e<=0&&(a="BC",e=1-e),[a,e]}const gc={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 Sa{fromJulianDay(a){let s=a,n=s-Cr,r=Math.floor(n/146097),i=Ma(n,146097),c=Math.floor(i/36524),l=Ma(i,36524),d=Math.floor(l/1461),u=Ma(l,1461),x=Math.floor(u/365),m=r*400+c*100+d*4+x+(c!==4&&x!==4?1:0),[b,f]=bc(m),g=s-ra(b,f,1,1),j=2;s<ra(b,f,3,1)?j=0:ma(f)&&(j=1);let y=Math.floor(((g+j)*12+373)/367),v=s-ra(b,f,y,1)+1;return new Yt(b,f,y,v)}toJulianDay(a){return ra(a.era,a.year,a.month,a.day)}getDaysInMonth(a){return gc[ma(a.year)?"leapyear":"standard"][a.month-1]}getMonthsInYear(a){return 12}getDaysInYear(a){return ma(a.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(a){return 9999}getEras(){return["BC","AD"]}isInverseEra(a){return a.era==="BC"}balanceDate(a){a.year<=0&&(a.era=a.era==="BC"?"AD":"BC",a.year=1-a.year)}constructor(){this.identifier="gregory"}}function yc(e,a){var s,n,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,a))!==null&&r!==void 0?r:(n=a.isEqual)===null||n===void 0?void 0:n.call(a,e))!==null&&i!==void 0?i:e.identifier===a.identifier}function kr(e,a){return e.calendar.toJulianDay(e)-a.calendar.toJulianDay(a)}function Sr(e,a){return xn(e)-xn(a)}function xn(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Ba=null;function $r(){return Ba==null&&(Ba=new Intl.DateTimeFormat().resolvedOptions().timeZone),Ba}function pn(e){e=js(e,new Sa);let a=vs(e.era,e.year);return Ar(a,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Ar(e,a,s,n,r,i,c){let l=new Date;return l.setUTCHours(n,r,i,c),l.setUTCFullYear(e,a-1,s),l.getTime()}function hn(e,a){if(a==="UTC")return 0;if(e>0&&a===$r())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:n,day:r,hour:i,minute:c,second:l}=Dr(e,a);return Ar(s,n,r,i,c,l,0)-Math.floor(e/1e3)*1e3}const bn=new Map;function Dr(e,a){let s=bn.get(a);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:a,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),bn.set(a,s));let n=s.formatToParts(new Date(e)),r={};for(let i of n)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 gn=864e5;function vc(e,a,s,n){return(s===n?[s]:[s,n]).filter(i=>jc(e,a,i))}function jc(e,a,s){let n=Dr(s,a);return e.year===n.year&&e.month===n.month&&e.day===n.day&&e.hour===n.hour&&e.minute===n.minute&&e.second===n.second}function wc(e,a,s="compatible"){let n=Lr(e);if(a==="UTC")return pn(n);if(a===$r()&&s==="compatible"){n=js(n,new Sa);let d=new Date,u=vs(n.era,n.year);return d.setFullYear(u,n.month-1,n.day),d.setHours(n.hour,n.minute,n.second,n.millisecond),d.getTime()}let r=pn(n),i=hn(r-gn,a),c=hn(r+gn,a),l=vc(n,a,r-i,r-c);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-c);case"compatible":case"later":return Math.max(r-i,r-c);case"reject":throw new RangeError("No such absolute time found")}}function Er(e,a,s="compatible"){return new Date(wc(e,a,s))}function Lr(e,a){let s=0,n=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:n,second:r,millisecond:i}=e);else if("hour"in e&&!a)return e;return a&&({hour:s,minute:n,second:r,millisecond:i}=a),new pa(e.calendar,e.era,e.year,e.month,e.day,s,n,r,i)}function js(e,a){if(yc(e.calendar,a))return e;let s=a.fromJulianDay(e.calendar.toJulianDay(e)),n=e.copy();return n.calendar=a,n.era=s.era,n.year=s.year,n.month=s.month,n.day=s.day,Ft(n),n}function ws(e,a){let s=e.copy(),n="hour"in s?Pr(s,a):0;ss(s,a.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=a.months||0,ns(s),Fr(s),s.day+=(a.weeks||0)*7,s.day+=a.days||0,s.day+=n,Nc(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,c;let d=(i=(c=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(c,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,a){var s,n;!((s=(n=e.calendar).isInverseEra)===null||s===void 0)&&s.call(n,e)&&(a=-a),e.year+=a}function ns(e){for(;e.month<1;)ss(e,-1),e.month+=e.calendar.getMonthsInYear(e);let a=0;for(;e.month>(a=e.calendar.getMonthsInYear(e));)e.month-=a,ss(e,1)}function Nc(e){for(;e.day<1;)e.month--,ns(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,ns(e)}function Fr(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 Ft(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Fr(e)}function _r(e){let a={};for(let s in e)typeof e[s]=="number"&&(a[s]=-e[s]);return a}function Rr(e,a){return ws(e,_r(a))}function Ir(e,a){let s=e.copy();return a.era!=null&&(s.era=a.era),a.year!=null&&(s.year=a.year),a.month!=null&&(s.month=a.month),a.day!=null&&(s.day=a.day),Ft(s),s}function Mr(e,a){let s=e.copy();return a.hour!=null&&(s.hour=a.hour),a.minute!=null&&(s.minute=a.minute),a.second!=null&&(s.second=a.second),a.millisecond!=null&&(s.millisecond=a.millisecond),Br(s),s}function Cc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ia(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ia(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ia(e.minute,60);let a=Math.floor(e.hour/24);return e.hour=ia(e.hour,24),a}function Br(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 ia(e,a){let s=e%a;return s<0&&(s+=a),s}function Pr(e,a){return e.hour+=a.hours||0,e.minute+=a.minutes||0,e.second+=a.seconds||0,e.millisecond+=a.milliseconds||0,Cc(e)}function Tr(e,a){let s=e.copy();return Pr(s,a),s}function kc(e,a){return Tr(e,_r(a))}function Or(e,a,s,n){let r=e.copy();switch(a){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=ft(d,s,0,l.length-1,n?.round),r.era=l[d],Ft(r);break}case"year":var i,c;!((i=(c=r.calendar).isInverseEra)===null||i===void 0)&&i.call(c,r)&&(s=-s),r.year=ft(e.year,s,-1/0,9999,n?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ft(e.month,s,1,e.calendar.getMonthsInYear(e),n?.round);break;case"day":r.day=ft(e.day,s,1,e.calendar.getDaysInMonth(e),n?.round);break;default:throw new Error("Unsupported field "+a)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Ft(r),r}function zr(e,a,s,n){let r=e.copy();switch(a){case"hour":{let i=e.hour,c=0,l=23;if(n?.hourCycle===12){let d=i>=12;c=d?12:0,l=d?23:11}r.hour=ft(i,s,c,l,n?.round);break}case"minute":r.minute=ft(e.minute,s,0,59,n?.round);break;case"second":r.second=ft(e.second,s,0,59,n?.round);break;case"millisecond":r.millisecond=ft(e.millisecond,s,0,999,n?.round);break;default:throw new Error("Unsupported field "+a)}return r}function ft(e,a,s,n,r=!1){if(r){e+=Math.sign(a),e<s&&(e=n);let i=Math.abs(a);a>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>n&&(e=s)}else e+=a,e<s?e=n-(s-e-1):e>n&&(e=s+(e-n-1));return e}const Sc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,$c=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Ac(e){let a=e.match(Sc);if(!a)throw $c.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new Yt(Pa(a[1],0,9999),Pa(a[2],1,12),1);return s.day=Pa(a[3],1,s.calendar.getDaysInMonth(s)),s}function Pa(e,a,s){let n=Number(e);if(n<a||n>s)throw new RangeError(`Value out of range: ${a} <= ${n} <= ${s}`);return n}function Vr(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 Ur(e){let a=js(e,new Sa),s;return a.era==="BC"?s=a.year===1?"0000":"-"+String(Math.abs(1-a.year)).padStart(6,"00"):s=String(a.year).padStart(4,"0"),`${s}-${String(a.month).padStart(2,"0")}-${String(a.day).padStart(2,"0")}`}function Dc(e){return`${Ur(e)}T${Vr(e)}`}function Ec(e,a){if(a.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ns(e,a,s){Ec(e,a),a.set(e,s)}function Hr(e){let a=typeof e[0]=="object"?e.shift():new Sa,s;if(typeof e[0]=="string")s=e.shift();else{let c=a.getEras();s=c[c.length-1]}let n=e.shift(),r=e.shift(),i=e.shift();return[a,s,n,r,i]}var Lc=new WeakMap;class Yt{copy(){return this.era?new Yt(this.calendar,this.era,this.year,this.month,this.day):new Yt(this.calendar,this.year,this.month,this.day)}add(a){return ws(this,a)}subtract(a){return Rr(this,a)}set(a){return Ir(this,a)}cycle(a,s,n){return Or(this,a,s,n)}toDate(a){return Er(this,a)}toString(){return Ur(this)}compare(a){return kr(this,a)}constructor(...a){Ns(this,Lc,{writable:!0,value:void 0});let[s,n,r,i,c]=Hr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,Ft(this)}}var Fc=new WeakMap;class $a{copy(){return new $a(this.hour,this.minute,this.second,this.millisecond)}add(a){return Tr(this,a)}subtract(a){return kc(this,a)}set(a){return Mr(this,a)}cycle(a,s,n){return zr(this,a,s,n)}toString(){return Vr(this)}compare(a){return Sr(this,a)}constructor(a=0,s=0,n=0,r=0){Ns(this,Fc,{writable:!0,value:void 0}),this.hour=a,this.minute=s,this.second=n,this.millisecond=r,Br(this)}}var _c=new WeakMap;class pa{copy(){return this.era?new pa(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new pa(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(a){return ws(this,a)}subtract(a){return Rr(this,a)}set(a){return Ir(Mr(this,a),a)}cycle(a,s,n){switch(a){case"era":case"year":case"month":case"day":return Or(this,a,s,n);default:return zr(this,a,s,n)}}toDate(a,s){return Er(this,a,s)}toString(){return Dc(this)}compare(a){let s=kr(this,a);return s===0?Sr(this,Lr(a)):s}constructor(...a){Ns(this,_c,{writable:!0,value:void 0});let[s,n,r,i,c]=Hr(a);this.calendar=s,this.era=n,this.year=r,this.month=i,this.day=c,this.hour=a.shift()||0,this.minute=a.shift()||0,this.second=a.shift()||0,this.millisecond=a.shift()||0,Ft(this)}}const Rc={firstDayOfWeek:"mon",showMonthAndYearPickers:!0,markToday:!0},Ic="data-[today=true]:font-semibold data-[today=true]:ring-1 data-[today=true]:ring-inset data-[today=true]:ring-primary",Mc="Open time options",Bc=320;function rs(e,a){return typeof a=="string"&&a.length>0?`${e} ${a}`:e}function yn(e,a){return a?{...e,classNames:{...e?.classNames,cellButton:rs(Ic,e?.classNames?.cellButton)}}:e}function Ta(e){if(!e)return null;const a="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,n="second"in e&&typeof e.second=="number"?e.second:0;return new $a(a,s,n)}function Pc(e,a){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:a===12}).format(s)}function Tc(e){const a=[];for(let s=0;s<24;s+=1)for(let n=0;n<60;n+=e)a.push(new $a(s,n));return a}function Oc(e){const{minuteStep:a=15,timeListClassName:s,timeListLabel:n=Mc,selectorButtonProps:r,endContent:i,onChange:c,value:l,defaultValue:d,hourCycle:u=12,...x}=e,m=l!==void 0,[b,f]=h.useState(()=>Ta(d)),g=m?Ta(l):b,j=h.useMemo(()=>Tc(a),[a]),y=C=>{m||f(C),c?.(C)},v=t.jsxs(o.Popover,{placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(o.Button,{isIconOnly:!0,variant:"light","aria-label":n,...r,onPress:void 0,children:t.jsx(ee.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(o.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(o.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(C=>{const S=g?.hour===C.hour&&g?.minute===C.minute;return t.jsx(o.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>y(C),children:Pc(C,u)},`${C.hour}:${C.minute}`)})})})})]});return t.jsx(o.TimeInput,{...x,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,v]}),onChange:C=>y(Ta(C))})}function Cs(e){if(e.mode==="time")return t.jsx(Oc,{...e});if(e.mode==="datetime"){const{mode:c,granularity:l="minute",hideTimeZone:d=!0,calendarWidth:u=Bc,disableAnimation:x=!0,classNames:m,markToday:b,calendarProps:f,...g}=e;return t.jsx(o.DatePicker,{...g,calendarProps:yn(f,b),calendarWidth:u,classNames:{...m,popoverContent:rs("min-w-[20rem]",m?.popoverContent),calendarContent:rs("min-h-[18rem]",m?.calendarContent)},disableAnimation:x,granularity:l,hideTimeZone:d})}const{mode:a,granularity:s="day",markToday:n,calendarProps:r,...i}=e;return t.jsx(o.DatePicker,{...i,calendarProps:yn(r,n),granularity:s})}function zc({state:e,onSubmit:a,onRemove:s,appliedCredit:n,errorMessage:r,label:i="Gift Card",placeholder:c="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[x,m]=h.useState(""),b=h.useId(),[f,g]=h.useState(e);e!==f&&(g(e),e==="applied"&&m(""));const j=()=>{const C=x.trim();C&&a(C)},y=C=>{C.key==="Enter"&&(C.preventDefault(),j())};if(e==="applied"&&n)return t.jsx("div",{"data-testid":u,children:t.jsx(Nr,{code:n.code,amount:n.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const v=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(o.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:c,value:x,onValueChange:m,onKeyDown:y,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":v?b:void 0}),t.jsx(p.Button,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!x.trim(),onPress:j,children:l})]}),v&&t.jsx("p",{id:b,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Vc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Uc({languages:e,selectedLanguage:a,onLanguageChange:s,label:n}){const r=e.find(i=>i.code===a);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(p.Select,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":n,selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:n,startContent:t.jsx(ee.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||n}),size:"md",radius:"full",children:e.map(i=>t.jsx(o.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(p.Select,{"aria-label":n,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:a?[a]:[],onSelectionChange:i=>{const c=Array.from(i)[0]||a;s?.(c)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(ee.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(o.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Hc({isLoggedIn:e,onLogin:a,onLogout:s,labels:n}){return e?t.jsxs(p.Button,{"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(ee.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.logout})]}):t.jsxs(p.Button,{"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:a,size:"md",children:[t.jsx(ee.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:n.login})]})}function Wc({logo:e,languages:a=[],selectedLanguage:s,onLanguageChange:n,isLoggedIn:r,onLogin:i,onLogout:c,hasLanguages:l,hasAuth:d,labels:u={},className:x}){const m={...Vc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:o.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",x),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||a.length>0)&&t.jsx(Uc,{languages:a,selectedLanguage:s,onLanguageChange:n,label:m.selectLanguage}),d&&t.jsx(Hc,{isLoggedIn:r,onLogin:i,onLogout:c,labels:m})]})]})}function qc(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(o.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 Oa;const Gc=typeof document<"u"?(Oa=h.useInsertionEffect)!==null&&Oa!==void 0?Oa:h.useLayoutEffect:()=>{};function _t(e,a,s){let[n,r]=h.useState(e||a),i=h.useRef(n),c=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=c.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),c.current=l},[l]);let d=l?e:n;Gc(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),x=h.useCallback((m,...b)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),s?.(f,...b))},[s]);return[d,x]}function Wr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(ze.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const qr=h.forwardRef(({color:e="primary",variant:a="default",stepsCount:s=3,defaultStep:n=0,label:r,stepLabels:i,showStepLabelTooltip:c=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:x="compact",stepCounterFormat:m,onStepChange:b,currentStep:f,hideProgressBars:g=!1,stepClassName:j,className:y,isDisabled:v=!1,...C},S)=>{const[k,$]=_t(f,n,b),_=h.useMemo(()=>{let N,F;const A=["[--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)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":N="[--step-color:var(--heroui-secondary)]",F="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":N="[--step-color:var(--heroui-success)]",F="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":N="[--step-color:var(--heroui-warning)]",F="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":N="[--step-color:var(--heroui-danger)]",F="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":N="[--step-color:var(--heroui-default)]",F="[--step-fg-color:var(--heroui-default-foreground)]";break;default:N="[--step-color:var(--heroui-primary)]",F="[--step-fg-color:var(--heroui-primary-foreground)]";break}return A.unshift(F),A.unshift(N),A},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:o.cn("flex items-center overflow-x-auto",x==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",y),"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(k+1,s):`Step ${k+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:o.cn("flex flex-row flex-nowrap gap-x-3",_,y),"data-testid":"stepper-list",children:Array.from({length:s})?.map((N,F)=>{const A=k===F?"active":k<F?"inactive":"complete",M=a==="activeLabel"&&A==="active"&&!!i?.[F],E=c&&A!=="active"&&!!i?.[F];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${F}`,children:[t.jsx(o.Tooltip,{content:E?i?.[F]:void 0,isDisabled:!E,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":A==="active"?"step":void 0,className:o.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":v},j),onClick:()=>!v&&$(F),disabled:v,"data-testid":`stepper-step-btn-${F}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:A,className:"relative z-10",children:t.jsx(ze.m.div,{animate:A,className:o.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)":A==="complete","shadow-lg":A==="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:A==="complete"&&a==="default"?t.jsx(Wr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${F}`}):t.jsx("span",{children:F+1})})})})})}),M?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${F}`,children:i[F]}):null]},F)}),F<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":F},children:t.jsx("div",{className:o.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":F<k})})})]},F)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(k+1,s):`Step ${k+1} of ${s}`}):null]})});qr.displayName="Stepper";function Kc(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(o.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 me(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Rt(e,a="en-US"){try{const s=new Intl.NumberFormat(a,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function ks(e,a,s="en-US"){const n=Rt(a,s),r=Math.pow(10,n);return Math.round(e*r)/r}function is(e,a,s,n){return ks(e-a,s,n)}const vn={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))"}},Yc="rgb(156 163 175)",Zc="rgb(107 114 128)",Gr=h.forwardRef(function({color:a="primary",steps:s=[],defaultStep:n=0,onStepChange:r,currentStep:i,hideProgressBars:c=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Yc,inactiveLabelColor:x=Zc,activeStepVariant:m="bordered",stepClassName:b,circleClassName:f,progressBarClassName:g,labelsClassName:j,labelSlotClassName:y,activeLabelClassName:v,inactiveLabelClassName:C,className:S,ariaLabel:k="Progress",invalidLabelSuffix:$=", has errors",testId:_,isStepReachable:N,...F},A){const[M,E]=_t(i,n,r),D=vn[a]??vn.primary,I=l??D.active,B=d??D.fg,V=(q,P)=>{const W=q.ariaLabel??(typeof q.title=="string"?q.title:null)??`${P+1}`;return q.invalid?`${W}${$}`:W};return t.jsxs("nav",{...F,"aria-label":k,..._?{"data-testid":_}:{},children:[t.jsx("div",{className:o.cn("flex items-center",S),children:s?.map((q,P)=>{const te=P===M?"active":P<M?"complete":"inactive",W=N?N(P):!0;return t.jsxs(h.Fragment,{children:[t.jsx(p.Button,{ref:A,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${_??"horizontal-steps"}-step-${P}`,"aria-current":te==="active"?"step":void 0,"aria-describedby":q.describedBy,"aria-label":V(q,P),"data-invalid":q.invalid?"true":void 0,isDisabled:!W,className:o.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",W?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",q.className,b),onPress:()=>{if(i===void 0){E(P);return}r?.(P)},children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:te,className:o.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?I:"transparent",borderColor:I,borderWidth:"1.5px",color:m==="solid"?B:I},complete:{backgroundColor:I,borderColor:I,borderWidth:"1.5px",color:I}},children:te==="complete"?t.jsx(Wr,{className:"size-4",style:{color:B}}):t.jsx("span",{children:P+1})})})}),P<s.length-1&&!c&&t.jsx("div",{"aria-hidden":!0,className:o.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:P<M?I:u}})]},P)})}),t.jsx("div",{className:o.cn("mt-2.5 hidden md:flex",j),children:s?.map((q,P)=>{const te=P<=M;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:o.cn("relative flex w-8 shrink-0 justify-center overflow-visible",y),children:t.jsx("span",{className:o.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",te?v:C),style:{color:te?I:x},children:q.title})}),P<s.length-1&&!c&&t.jsx("div",{className:o.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},P)})})]})});Gr.displayName="HorizontalSteps";const Ge=e=>Xt[e],Qc={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Kr={done:{icon:Ge("--ok"),meta:Ge("--sub")},"needs-fix":{icon:Ge("--warn"),meta:Ge("--warn")},optional:{icon:Ge("--muted"),meta:Ge("--sub")}},Xc=Ge("--ink"),Jc={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},ed={ready:{fill:Ge("--ok-fill"),text:Ge("--ok")},fix:{fill:Ge("--warn-fill"),text:Ge("--warn")},live:{fill:Ge("--ok-fill"),text:Ge("--ok")}},Je={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Bt={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},Nt={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function td({step:e,labels:a}){const s=Kr[e.status];if(e.status==="optional")return t.jsxs("span",{className:Je.meta,style:{color:s.meta},children:[a.optional,p.hasContent(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const n=e.status==="needs-fix"&&p.hasContent(e.reason)?e.reason:e.summary,r=e.status==="done"?a.done:a.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",p.hasContent(n)?t.jsx("span",{className:Je.meta,style:{color:s.meta},children:n}):null]})}function Yr({steps:e,currentStep:a,defaultStep:s=0,onStepChange:n,isStepReachable:r,ariaLabel:i,statusLabels:c,header:l,maxHeight:d,className:u,style:x,"data-testid":m="vertical-steps",...b}){const[f,g]=_t(a,s,n);return t.jsxs("div",{...b,"data-testid":m,className:o.cn(Je.root,u),style:d===void 0?x:{maxHeight:d,...x},children:[l,t.jsx("nav",{"aria-label":i,className:Je.nav,children:t.jsx("ol",{className:Je.list,children:e.map((j,y)=>{const v=y===f,C=r?r(y):!0;return t.jsx("li",{children:t.jsxs(p.Button,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:j.testId??`${m}-step-${j.key}`,"data-state":j.status,"data-current":v?"true":void 0,"aria-current":v?"step":void 0,isDisabled:!C,className:o.cn(Je.row,v&&Je.rowCurrent),onPress:()=>g(y),children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:Qc[j.status],className:Je.icon,style:{color:Kr[j.status].icon}}),t.jsxs("span",{className:Je.text,children:[t.jsx("span",{className:o.cn(Je.label,v&&Je.labelCurrent),style:{color:Xc},children:`${y+1}. ${j.label}`})," ",t.jsx(td,{step:j,labels:c})]})]})},j.key)})})})]})}Yr.displayName="VerticalSteps";function Zr({variant:e,title:a,description:s,className:n,"data-testid":r="steps-readiness"}){const i=ed[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:o.cn(Bt.root,n),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:Jc[e],className:Bt.icon}),t.jsxs("span",{className:Bt.text,children:[t.jsx("span",{className:Bt.title,children:a})," ",p.hasContent(s)?t.jsx("span",{className:Bt.description,children:s}):null]})]})}Zr.displayName="StepsReadiness";function Qr({steps:e,currentStep:a,onStepChange:s,progressLabel:n,nextLabel:r,previousLabel:i=g=>g.label,finalActionLabel:c,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":x="step-pager",previousTestId:m=`${x}-prev`,nextTestId:b=`${x}-next`,finalActionTestId:f=`${x}-final`}){const g=e[a-1],j=e[a+1],y=a===e.length-1;return t.jsxs("div",{"data-testid":x,className:o.cn(Nt.root,u),children:[t.jsx("div",{className:Nt.spacer,children:g?t.jsx(p.Button,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:Nt.arrow}),onPress:()=>s(a-1),children:i(g)}):null}),t.jsx("span",{className:Nt.progress,children:n(a+1,e.length)}),t.jsx("div",{className:Nt.endSlot,children:j?t.jsx(p.Button,{color:"primary",testId:b,endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:Nt.arrow}),onPress:()=>s(a+1),children:r(j)}):y&&c!==void 0&&l?t.jsx(p.Button,{color:"primary",testId:f,isDisabled:d,onPress:l,children:c}):null})]})}Qr.displayName="StepPager";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 sd=e=>{const a=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(nd,{...e},a)},nd=({allItems:e,selected:a,onSelectedChange:s,titleLeft:n,titleRight:r})=>{const[i,c]=h.useState([]),[l,d]=h.useState([]),[u,x]=h.useState(null),[m,b]=h.useState(null),f=h.useMemo(()=>new Set(a),[a]),g=h.useMemo(()=>new Set(e),[e]),j=h.useMemo(()=>e.filter(E=>!f.has(E)),[e,f]),y=E=>{if(E.length===0)return;const D=Array.from(new Set([...a,...E]));s(D)},v=E=>{if(E.length===0)return;const D=new Set(E);s(a.filter(I=>!D.has(I)))},C=()=>{i.length!==0&&(y(i),c([]))},S=()=>{l.length!==0&&(v(l),d([]))},k=()=>{j.length!==0&&(y(j),c([]))},$=()=>{a.length!==0&&(s([]),d([]))},_=(E,D,I)=>{const B=Math.min(D,I),V=Math.max(D,I);return E.slice(B,V+1)},N=(E,D,I)=>{if(I&&u!==null){c(_(j,u,D)),d([]),x(D);return}const B=i.includes(E);c(B?i.filter(V=>V!==E):[...i,E]),d([]),x(D)},F=(E,D,I)=>{if(I&&m!==null){d(_(a,m,D)),c([]),b(D);return}const B=l.includes(E);d(B?l.filter(V=>V!==E):[...l,E]),c([]),b(D)},A=(E,D,I)=>{const B=I==="available"?i.includes(D)?i:[D]:l.includes(D)?l:[D];E.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:B})),E.dataTransfer.effectAllowed="move"},M=(E,D)=>{E.preventDefault();const I=E.dataTransfer.getData("text/plain");if(I)try{const B=JSON.parse(I),V=(B.items||[]).filter(q=>g.has(q));if(V.length===0||B.source===D)return;D==="selected"?(y(V),c([])):(v(V),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:n}),t.jsx(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"available"),children:j.map((E,D)=>{const I=i.includes(E);return t.jsx("button",{type:"button",onClick:B=>{N(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(p.Button,{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(p.Button,{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:S,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(p.Button,{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:k,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(p.Button,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:$,"data-testid":"move-all-to-available",isDisabled:a.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(o.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(o.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:E=>E.preventDefault(),onDrop:E=>M(E,"selected"),children:a.map((E,D)=>{const I=l.includes(E);return t.jsx("button",{type:"button",onClick:B=>{F(E,D,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>A(B,E,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:E},E)})})})]})]})};function Zt(e){return typeof e=="string"?e:e.type}function ht({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(o.Divider,{orientation:"vertical"})})}function gt({icon:e,label:a,isActive:s=!1,isDisabled:n=!1,onClick:r,shortcut:i,iconSize:c=16,className:l}){const d=i?`${a} (${i})`:a;return t.jsx(o.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:n,onPress:r,"aria-label":a,className:l,children:t.jsx(e,{size:c})})})}const ot={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:a})=>{const s=a?.type==="textColor"?a.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:a})=>{const s=a?.type==="highlight"?a.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:a})=>{const s=a?.type==="link"?a.href:"";if(s){const n=a?.type==="link"?a.target:void 0,r=a?.type==="link"?a.rel:void 0;e.chain().focus().setLink({href:s,target:n,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:a})=>{const s=a?.type==="heading"?a.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,a)=>{const s=a?.type==="heading"?a.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,a)=>a?.type==="heading"?e.isActive("heading",{level:a.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:a})=>{const s=a?.type==="textAlign"?a.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,a)=>a?.type==="textAlign"?e.isActive({textAlign:a.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"}},rd={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function id({editor:e,levels:a=[1,2,3,4,5,6],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const c=()=>n(l=>l+1);return e.on("selectionUpdate",c),e.on("transaction",c),()=>{e.off("selectionUpdate",c),e.off("transaction",c)}},[e]);const r=a.find(c=>e.isActive("heading",{level:c})),i=c=>{const l=Number(c),d=ot.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(ee.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(o.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:a.map(c=>t.jsx(o.DropdownItem,{startContent:e.isActive("heading",{level:c})?t.jsx(ee.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:rd[c]},c))})]})}const za={bulletList:{label:"Bullet List",icon:ee.List},orderedList:{label:"Numbered List",icon:ee.ListOrdered},taskList:{label:"Task List",icon:ee.ListTodo}};function ld({editor:e,types:a=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,n]=h.useState(0);h.useEffect(()=>{const l=()=>n(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=a.find(l=>e.isActive(l)),i=r?za[r].icon:ee.List,c=l=>{const u=ot[l];u&&u.execute({editor:e})};return t.jsxs(o.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{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(o.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:c,children:a.map(l=>{const d=za[l].icon;return t.jsx(o.DropdownItem,{startContent:t.jsx(d,{size:16}),children:za[l].label},l)})})]})}function od({colors:e,selectedColor:a,onColorSelect:s,columns:n=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:e.map(r=>{const i=a===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
|
|
13
|
+
`,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const cd=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],dd=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Va(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Me={min:50,max:200,step:10,default:100},jn={lineHeight:24,toolbarHeight:60},ud={bold:ee.Bold,italic:ee.Italic,strike:ee.Strikethrough,underline:ee.Underline,code:ee.Code,textColor:ee.Palette,highlight:ee.Highlighter,link:ee.Link2,paragraph:ee.FileText,heading:ee.Heading,bulletList:ee.List,orderedList:ee.ListOrdered,taskList:ee.ListTodo,codeBlock:ee.CodeSquare,blockquote:ee.Quote,horizontalRule:ee.Minus,clearMarks:ee.Eraser,clearNodes:ee.Eraser,undo:ee.Undo2,redo:ee.Redo2,hardBreak:ee.CornerDownLeft,textAlign:ee.AlignLeft},md={left:ee.AlignLeft,center:ee.AlignCenter,right:ee.AlignRight,justify:ee.AlignJustify};function Et(e){return ud[e]}function fd({value:e,onChange:a,onApply:s,placeholder:n="#000000"}){const[r,i]=h.useState(""),c=u=>{const x=u.target.value;a(x),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Va(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(o.Input,{type:"text",value:e,onChange:c,onKeyDown:d,placeholder:n,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:Va(e)?e:"transparent"}})}),t.jsx(p.Button,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Va(e),children:t.jsx(ee.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function wn({editor:e,type:a,allowCustomColor:s=!0,label:n,isDisabled:r=!1}){const[i,c]=h.useState(!1),[l,d]=h.useState(""),u=a==="textColor"?cd:dd,x=j=>{const y=ot[a];y&&y.execute({editor:e,config:{type:a,color:j}}),c(!1),d("")},m=j=>{x(j)},b=()=>{const j=ot[a];j&&j.execute({editor:e,config:{type:a,color:""}}),c(!1)},f=a==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=a==="textColor"?ee.Palette:ee.Highlighter;return t.jsxs(o.Popover,{isOpen:i,onOpenChange:c,placement:"top",offset:10,showArrow:!0,children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":n,children:t.jsx(g,{size:16})})}),t.jsx(o.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:n}),t.jsx(p.Button,{size:"sm",variant:"light",isIconOnly:!0,onPress:b,"aria-label":"Clear color",children:t.jsx(ee.X,{size:16})})]}),t.jsx(od,{colors:u,onColorSelect:x}),s&&t.jsxs(t.Fragment,{children:[t.jsx(o.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(fd,{value:l,onChange:d,onApply:m})]})]})]})})]})}function xd({zoom:e,onZoomChange:a,min:s=Me.min,max:n=Me.max,step:r=Me.step}){const i=()=>{const m=Math.max(s,e-r);a(m)},c=()=>{const m=Math.min(n,e+r);a(m)},l=()=>{a(Me.default)},d=e<=s,u=e>=n,x=e===Me.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(o.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(ee.ZoomOut,{size:16})})}),t.jsx(o.Tooltip,{content:x?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:x,className:`
|
|
14
14
|
text-xs text-default-500 min-w-[3ch] text-center px-2
|
|
15
|
-
${
|
|
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(te.ZoomIn,{size:16})})})]})}function $m({editor:e,isDisabled:s=!1}){const[n,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),p=e.isActive("link"),m=f=>{if(f){const{from:b,to:v}=e.state.selection,g=e.isActive("link");let y="";if(g){const k=e.schema.marks.link,N=e.state.doc.resolve(b),$=Oa.getMarkRange(N,k);$&&(y=e.state.doc.textBetween($.from,$.to,""))}else y=e.state.doc.textBetween(b,v,"");const w=e.getAttributes("link").href||"";i(y),l(w),u(g)}a(f)},x=()=>{if(o.trim()){const{from:f,to:b}=e.state.selection,v=e.schema.marks.link,g=e.state.doc.resolve(f),y=Oa.getMarkRange(g,v),w=y?.from??f,k=y?.to??b,N=e.state.doc.textBetween(w,k,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:w,to:k}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(te.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:f=>i(f.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:x,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function Am({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function nl(e,s){const n=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>is(l)))).forEach(l=>{const d=ft[l];if(d)try{const u=d.canExecute?.(e)??!0,p=d.isActive?.(e)??!1;i[l]={isActive:p,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[a,r]=h.useState(n);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>is(d)))).forEach(d=>{const u=ft[d];if(u)try{const p=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!p,canExecute:p}}catch(p){console.warn(`Extension not available for modifier: ${d}`,p),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,n]),a}function al(e,s){const n=h.useCallback((o,l)=>{if(!e)return;const d=ft[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=h.useCallback(o=>{n(o)},[n]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=ft[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=ft[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:n,toggleModifier:a,canExecute:r,isActive:i}}function Em(e=Be.default){const[s,n]=h.useState(e),a=h.useCallback((l=Be.step)=>{n(d=>Math.min(Be.max,d+l))},[]),r=h.useCallback((l=Be.step)=>{n(d=>Math.max(Be.min,d-l))},[]),i=h.useCallback(()=>{n(Be.default)},[]),o=h.useCallback(l=>{const d=Math.max(Be.min,Math.min(Be.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Be.min,isMaxZoom:s>=Be.max,isDefaultZoom:s===Be.default}}const Dm=["bold","italic","strike","underline","code"];function Lm({editor:e,modifiers:s,onToolbarAction:n}){const a=nl(e,s),{toggleModifier:r}=al(e,n);if(!e)return null;const i=s.map(o=>is(o)).filter(o=>Dm.includes(o));return i.length===0?null:t.jsx(Am,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Mt(o);return t.jsx(Nt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Fm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=nl(e,s),{toggleModifier:d,executeCommand:u}=al(e,o);if(!e)return null;const p=s.map(j=>is(j)),m=p.some(j=>["bold","italic","strike","underline","code"].includes(j)),x=p.some(j=>["textColor","highlight"].includes(j)),f=p.includes("heading"),b=p.includes("textAlign"),v=p.some(j=>["bulletList","orderedList","taskList"].includes(j)),g=p.includes("blockquote"),y=p.includes("codeBlock"),w=p.includes("link"),k=p.includes("horizontalRule"),N=p.some(j=>["undo","redo"].includes(j)),$=n!==void 0&&a!==void 0,D=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${D} ${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(Lm,{editor:e,modifiers:s,onToolbarAction:o}),(x||f||b||v||g||y||w||k||N||$)&&t.jsx(jt,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("textColor")&&t.jsx(or,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),p.includes("highlight")&&t.jsx(or,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||b||v||g||y||w||k||N||$)&&t.jsx(jt,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(gm,{editor:e}),(b||v||g||y||w||k||N||$)&&t.jsx(jt,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(j=>{const L=Cm[j],S=e.isActive({textAlign:j});return t.jsx(Nt,{icon:L,label:`Align ${j}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:j})},j)})}),(v||g||y||w||k||N||$)&&t.jsx(jt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(ym,{editor:e,types:p.filter(j=>["bulletList","orderedList","taskList"].includes(j))}),(g||y||w||k||N||$)&&t.jsx(jt,{})]}),(g||y||w||k)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(Nt,{icon:Mt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),y&&t.jsx(Nt,{icon:Mt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),w&&t.jsx($m,{editor:e,isDisabled:l.link?.isDisabled}),k&&t.jsx(Nt,{icon:Mt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(N||$)&&t.jsx(jt,{})]}),N&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("undo")&&t.jsx(Nt,{icon:Mt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),p.includes("redo")&&t.jsx(Nt,{icon:Mt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(jt,{})]}),$&&t.jsx(Sm,{zoom:n,onZoomChange:j=>{a?.(j),o?.({type:"zoom",modifier:`${j}%`})}})]})})}const qt={bold:{category:"mark",extension:Vc.Bold,priority:100},italic:{category:"mark",extension:Uc.Italic,priority:100},strike:{category:"mark",extension:Hc.Strike,priority:100},underline:{category:"mark",extension:Wc.Underline,priority:100},code:{category:"mark",extension:qc.Code,priority:100},textColor:{category:"mark",extension:Gc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Kc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Yc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Zc.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Jc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:ed.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:td.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:ad.CodeBlock,priority:100},blockquote:{category:"node",extension:rd.Blockquote,priority:100},horizontalRule:{category:"node",extension:id.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ld.HardBreak,priority:100},undo:{category:"extension",extension:Ba.History,priority:50},redo:{category:"extension",extension:Ba.History,priority:50},textAlign:{category:"extension",extension:od.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}},_m=[cd.Document,dd.Text,Xc.Paragraph,Qc.TextStyle.configure({HTMLAttributes:{}}),nd.ListItem.configure({HTMLAttributes:{}}),sd.TaskItem.configure({nested:!0}),ud.Dropcursor,md.Gapcursor];function Rm(e){const s=[],n=new Set,a=new Set;_m.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>is(l)),i=new Set;return r.forEach(l=>{const d=qt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=qt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=qt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(qt).find(f=>f?.extension?.name===l.name),p=Object.values(qt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(p?.priority??100)-m})}const rl={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"]},Mm={h1:`font-size: ${we.fontSize["4xl"]}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h2:`font-size: ${we.fontSize["2xl"]}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h3:`font-size: ${we.fontSize.xl}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h4:`font-size: ${we.fontSize.lg}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h5:`font-size: ${we.fontSize.base}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,h6:`font-size: ${we.fontSize.sm}; font-weight: ${we.fontWeight.semibold}; line-height: ${we.lineHeight.tight}; margin: ${be.md} 0 ${be.sm} 0;`,p:`min-height: ${we.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${be.xl}; margin: ${be.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${be.xl}; margin: ${be.md} 0;`,li:`display: list-item; margin: ${be.xs} 0;`,strong:`font-weight: ${we.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Le.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${we.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${we.fontFamily.mono};`,pre:`background: ${Le.neutral.gray[800]}; border-radius: ${be.sm}; color: ${Le.neutral.gray[100]}; font-family: ${we.fontFamily.mono}; margin: ${be.lg} 0; padding: 0.75rem ${be.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Le.neutral.gray[300]}; margin: ${be.lg} 0; padding-left: ${be.md}; color: ${Le.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Le.neutral.gray[200]}; margin: ${be.xl} 0;`,a:`color: ${Le.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Le.palettes.warning[200]}; border-radius: ${be.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${be.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Pm={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 Tm(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(Pm)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries(Mm)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return s}const Im=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=Vn.useCurrentEditor();return t.jsx(Fm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},Om=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=Vn.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},Ln=h.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=rl.full,variant:u="bordered",initialContent:p,content:m,onContentChange:x,onUpdate:f,onToolbarAction:b,isReadOnly:v=!1,isDisabled:g=!1,includeInlineStyles:y=!0,...w}=e,{zoom:k,setZoom:N}=Em(),$=lr.lineHeight,D=n*$,j=r?void 0:a*$,L=h.useMemo(()=>Rm(d),[d]),{Component:S,label:M,shouldLabelBeOutside:E,getBaseProps:A,getLabelProps:R,getInputWrapperProps:T}=c.useInput({...w,variant:u,ref:s,isMultiline:!0}),U=M?t.jsx("label",{...R(),children:M}):null,G=h.useCallback(({editor:I})=>{const se=I.getHTML(),q=y?Tm(se):se,Q=I.getJSON(),Y=I.getText(),ce=Y.length,ne=Y.split(/\s+/).filter(ie=>ie.length>0).length,X={html:q,json:Q,text:Y,characters:ce,words:ne};if(x?.(X),f?.(X),"onChange"in w&&typeof w.onChange=="function"){const ie={target:{value:q},currentTarget:{value:q}};w.onChange(ie)}},[x,f,w,y]);return t.jsxs(S,{...A(),children:[E?U:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:j?`${j+lr.toolbarHeight}px`:void 0,overflow:j?"auto":void 0},children:t.jsx(Vn.EditorProvider,{editable:!v&&!g,slotBefore:l?t.jsx(Im,{modifiers:d,zoom:k,onZoomChange:N,onToolbarAction:b}):void 0,slotAfter:t.jsx(Om,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${D}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:m||p||e.defaultValue||"",onUpdate:G})})]})});Ln.displayName="TipTapEditor";const il=h.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx(Ln,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx(Ln,{...r,variant:a,ref:s}))});il.displayName="RichTextArea";function cr(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function Bm(e="en-US",s="USD"){try{const n=new Intl.NumberFormat(e,{style:"currency",currency:s,currencyDisplay:"symbol"}),a=n.formatToParts(1),r=a.findIndex(d=>d.type==="currency"),i=a.findIndex(d=>d.type==="integer"),{minimumFractionDigits:o,maximumFractionDigits:l}=n.resolvedOptions();return{symbol:a[r]?.value??s,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:l}}}catch(n){return console.warn(`Invalid currency formatting: ${n}`),{symbol:s,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const dr=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,ur=`border bg-white shadow-none ${ke}`,zm={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${dr} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${ur} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${dr} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${ur} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},Et={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},Vm={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},mr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Um={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},ll=({presetAmounts:e=mr,selectedDonation:s,defaultSelectedDonation:n=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:p,mobileColumns:m=2,desktopColumns:x=3,isDisabled:f=!1,buttonVariant:b="bordered",buttonColor:v="default",inputVariant:g="bordered",size:y="md",className:w="",showCard:k=!0,variant:N="pill",customAmountPlacement:$="below",isRequired:D=!1})=>{const j={...Um,...p},L=h.useId(),S=`${L}-title`,M=`${L}-custom`,E=Array.isArray(e)?e:mr,A={2:"grid-cols-2",3:"grid-cols-3"},R={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},T=`${A[m]} ${R[x]}`,[U,G]=Ot(s,n,a),[I,se]=h.useState(""),[q,Q]=h.useState(!1),[Y,ce]=h.useState(0),ne=h.useCallback(ae=>{if(f)return;const je={amount:ae.amount,isCustom:!1,presetId:ae.id};G(je),se(""),Q(!1),ce(Re=>Re+1),r?.(je)},[f,G,r]),X=h.useCallback(ae=>{if(f)return;if(se(ae!==void 0?String(ae):""),r){G(null);return}if(Q(!1),ae===void 0||isNaN(ae)){G(null);return}G({amount:ae,isCustom:!0})},[f,G,r]),ie=h.useCallback(()=>{if(f)return;const ae=I!==""?parseFloat(I):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[f,I,r]),V=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),z=h.useMemo(()=>Bm(o,i),[o,i]),Z=ae=>U!==null&&!U.isCustom&&U.presetId===ae.id,Ie=(ae,je)=>{const Re=U?.isCustom===!0,et=!r&&q,ge=N==="tile"&&$==="inline",Me=ge?t.jsx("span",{className:Et.affix,"data-testid":"donation-amounts-custom-symbol",children:z.symbol}):void 0,ue=t.jsxs("div",{className:c.cn("flex items-start gap-3",ge&&Et.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(c.NumberInput,{id:M,placeholder:j.customAmountPlaceholder,"aria-label":ge?j.customAmountLabel??j.customAmountAriaLabel:j.customAmountLabel?void 0:j.customAmountAriaLabel,onInput:r?()=>{G(null),Q(!0)}:()=>Q(!0),onBlur:r?void 0:()=>Q(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ge?z.formatOptions:V,startContent:z.position==="start"?Me:void 0,endContent:z.position==="end"?Me:void 0,value:I!==""?parseFloat(I):void 0,onValueChange:X,isDisabled:f,className:"flex-1",classNames:{inputWrapper:c.cn(ae.inputWrapper,je.wrapper,ge&&Et.inputWrapper,(Re||et)&&ae.inputWrapperActive),input:c.cn(ae.input,je.input,ge&&Et.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:U?.isCustom===!1?U.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!q,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]}),ye=l&&(ge?ue:t.jsxs("div",{className:c.cn("flex flex-col",ae.inputBase),children:[j.customAmountLabel&&t.jsx("label",{htmlFor:M,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:j.customAmountLabel}),ue]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":N,"data-custom-placement":ge?"inline":void 0,children:[j.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:j.eyebrow}),j.title&&t.jsxs("p",{id:S,className:ae.title,"data-testid":"donation-amounts-title",children:[j.title,D&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),j.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:j.caption}),(E.length>0||ge&&ye)&&t.jsxs("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:ge?Et.row:c.cn(ae.grid,N==="tile"&&T),"data-testid":"donation-amounts-presets",children:[E.map(J=>{const C=Z(J)&&!et;return t.jsxs(O,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":C,className:c.cn(ae.preset,ge&&Et.preset,C?ae.presetSelected:ae.presetIdle),onPress:()=>ne(J),isDisabled:f,"data-selected":C||void 0,"data-testid":`donation-amounts-preset-${J.id}`,children:[t.jsx("span",{className:c.cn(ae.amount,C&&ae.amountSelected),children:J.label||cr(J.amount,o,i,N!=="pos")}),J.sublabel&&" ",J.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${J.id}-sublabel`,children:J.sublabel})]},J.id)}),ge&&ye]}),!ge&&ye]})},Fe=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{id:S,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),E.length>0&&t.jsx("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:c.cn("grid gap-3",T),"data-testid":"donation-amounts-presets",children:E.map(ae=>{const je=U!==null&&!U.isCustom&&U.presetId===ae.id;return t.jsx(O,{color:je?"primary":v,variant:je?"solid":b,className:"w-full","aria-pressed":je,onPress:()=>ne(ae),isDisabled:f,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||cr(ae.amount,o,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{G(null),Q(!0)}:void 0,variant:g,radius:"full",size:y,minValue:d,maxValue:u,step:.01,formatOptions:V,value:I!==""?parseFloat(I):void 0,onValueChange:X,isDisabled:f,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:U?.isCustom===!1?U.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!q,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]}),_e=N==="pill"?Fe:Ie(zm[N],Vm[N][y]);return k?t.jsx(c.Card,{className:c.cn("w-full",w),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:_e})}):t.jsx("div",{className:c.cn("w-full",w),"data-testid":"donation-amounts-plain",children:_e})};ll.displayName="DonationAmounts";const Hm=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},Wm=e=>{switch(e){case"warning":return te.Clock;case"error":return te.AlertCircle;case"success":return te.CheckCircle;default:return te.Clock}},qm=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"}},ol=h.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:p=!0,formatTime:m=Hm,className:x,...f},b)=>{const[v,g]=Ot(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),y=h.useRef(null),w=h.useRef(!1);h.useEffect(()=>()=>{y.current&&clearInterval(y.current)},[]),h.useEffect(()=>{if(!p||v<=0){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{g(D=>D<=1?(y.current&&(clearInterval(y.current),y.current=null),w.current||(w.current=!0,a?.()),0):D-1)},1e3),()=>{y.current&&(clearInterval(y.current),y.current=null)}},[p,v,g,a]),h.useEffect(()=>{v>0&&(w.current=!1)},[v]);const k=d||Wm(r),N=qm(i),$={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":`${o} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",N,$[u],x),...f,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(k,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});ol.displayName="ExpireCartTimer";const Dt=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(P,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),Gm=({classes:e="",name:s,imageUrl:n,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:p="eager",showMoreButtonClassName:m,labels:x})=>{const[f,b]=h.useState(!1),[v,g]=h.useState(!1),y=h.useRef(null);return h.useEffect(()=>{const w=()=>{if(y.current){const k=y.current.scrollHeight>y.current.clientHeight;g(k)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&n&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:x.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Dt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Dt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Dt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(P,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?x.showLess||"Hide":x.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&n&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:x.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Dt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Dt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Dt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(P,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?x.showLess||"Hide":x.showMore||"Show"})})]})]})]})};function Fn(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Km(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Ym={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"},Lt=e=>typeof e=="number"&&!isNaN(e),Ls=({offer:e,quantity:s,defaultQuantity:n=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:p="default",showCard:m=!0,showDescription:x=!0,showPeopleCount:f=!0,showPrice:b=!0,priceDisplay:v,classNames:g={},"data-testid":y,selectedColor:w="default",selectionMode:k="stepper",compact:N=!1,isSoldOut:$,isMaxReached:D,isRuleBlocked:j,statusTone:L="default",statusLabel:S,disabledReason:M,disabled:E})=>{const A=h.useMemo(()=>({...Ym,...o}),[o]),[R,T]=h.useState(n),U=s!==void 0?s:R,G=!!(d||E),I=N||!!e.compact,se=k==="press-to-add",q=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Lt(e.totalTicketsSold)||!Lt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Q=h.useMemo(()=>typeof D=="boolean"?D:typeof e.isMaxReached=="boolean"?e.isMaxReached:q||!Lt(e.ticketsAllowed)?!1:U>=e.ticketsAllowed-(e.totalTicketsSold??0),[D,e.isMaxReached,q,e.ticketsAllowed,e.totalTicketsSold,U]),Y=h.useMemo(()=>typeof j=="boolean"?j:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[j,e.isRuleBlocked]),ce=M||e.disabledReason,ne=G||q||Y,X=ue=>{if(ne||ue>0&&Q)return;const ye=Math.max(0,U+ue);s===void 0&&T(ye),a?.(e.id,ye)},ie=h.useMemo(()=>{if(q)return"soldOut";if(Y)return"ruleBlocked";if(G)return"disabled"},[q,Y,G]),V=h.useMemo(()=>L||(q||Y?"danger":Q?"warning":"default"),[L,q,Y,Q]),z=h.useMemo(()=>{if(ie)return ie==="ruleBlocked"?S||ce||A.ruleBlocked:ie==="soldOut"?S||ce||A.soldOut:ie==="disabled"?S||ce||A.disabled:S||A.maxReached},[ie,S,ce,A]),Z={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=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",I&&"text-sm",g.name),children:e.name}),_e=()=>{if(!b)return null;const ue=v?.price??e.price,ye=v?.originalPrice,J=Fn(ue,i,r);if(l?.renderPrice)return l.renderPrice(ue,J,e);if(Lt(ye)&&Lt(ue)&&ye>ue){const F=Fn(ye,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",I&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",F,", discounted price ",J]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",I&&"text-xs",g.originalPrice),children:F}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",I&&"text-sm",g.discountedPrice),children:J})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",I&&"text-sm mt-0.5",g.price),children:J})},ae=()=>!x||!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",I&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),je=()=>{if(!f||!Lt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ue=e.numberOfPeople===1?A.person:A.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",I&&"mt-1 text-xs",g.peopleCount),children:[t.jsx(P,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",ue]})},Re=()=>{const ue=U===0||ne,ye=Q||ne;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:U,onIncrement:()=>X(1),onDecrement:()=>X(-1),isDecrementDisabled:ue,isIncrementDisabled:ye,isDisabled:ne}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>X(-1),isDisabled:ue,variant:u,color:U>0?w:p,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(P,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",I&&"text-sm"),children:U}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>X(1),isDisabled:ye,variant:u,color:U>0?w:p,radius:"full",isIconOnly:!0,size:I?"md":"sm","aria-label":"Increase quantity",children:t.jsx(P,{icon:"gravity-ui:plus",width:16})})]})},et=(ue,ye)=>l?.renderDisabledState?l.renderDisabledState(ue,ye):ue==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(ye):ue==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(ye):t.jsx(c.Chip,{"data-testid":Ie[ue],color:Z[ue],variant:ue==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ue==="maxReached"?"h-8":"h-10",ue==="soldOut"&&g.soldOut,ue==="maxReached"&&g.maxReachedAlert,I&&"h-8"),startContent:t.jsx(P,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ye})}),ge=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",I?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ne||Q?"opacity-50 pointer-events-none select-none":""),children:[Fe(),_e(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",I?"mb-1":"mb-2"),children:[je(),ae()]})]}),!se&&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",I&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:ie&&z?et(ie,z):Re()})]}),Me=Q&&!q&&!Y&&!G?t.jsx(We.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:et("maxReached",z||A.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",se&&!ne&&!Q&&"cursor-pointer",I&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,isPressable:se&&!ne&&!Q,onPress:se&&!ne&&!Q?()=>X(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",g.body),children:ge}),t.jsx(We.AnimatePresence,{children:Me&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",g.footer),children:Me})})]}):t.jsxs("div",{className:c.cn("w-full",I&&g.compact,g.base),"data-testid":y||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",I?"pb-0.5":"",g.body),children:ge}),t.jsx(We.AnimatePresence,{children:Me&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",I?"pt-1":"",g.footer),children:Me})})]})};Ls.displayName="OfferCard";const cl=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(P,{"data-testid":"offer-card-empty-icon",icon:s,width:n,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};cl.displayName="OfferCardEmpty";const Qm={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},dl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Qm,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};dl.displayName="OfferCardError";const Zm={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},ul=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=Zm[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(oe,{"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(oe,{"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(oe,{"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(oe,{"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(oe,{"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(oe,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(oe,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(oe,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};ul.displayName="OfferCardSkeleton";const ml={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},fl={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"}}},Xm={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},pl=({offers:e=[],mapOffer:s,selection:n,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:p=!1,buttonVariant:m="bordered",buttonColor:x="default",showCard:f=!0,animated:b=!0,gap:v=2,compact:g=!1,classNames:y={}})=>{const[w,k]=h.useState(a),N=n!==void 0?n:w,$=h.useCallback((E,A)=>{const R={...N,[E]:Math.max(0,A)};n===void 0&&k(R),r?.(R),i?.(E,R[E])},[N,n,r,i]),D=[...e].sort((E,A)=>(E.position??0)-(A.position??0)),j=E=>{const A=s?s(E):E,R=(N??{})[A.id]||0;return{offer:A,quantity:R,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:x,showCard:f,compact:g}},L=Xm[v],S=c.cn("grid mx-auto pt-2",L,y.base),M=E=>{const A=j(E);return t.jsx(Ls,{offer:A.offer,quantity:A.quantity,onQuantityChange:A.onQuantityChange,currency:A.currency,locale:A.locale,labels:A.labels,slots:A.slots,isDisabled:A.isDisabled,buttonVariant:A.buttonVariant,buttonColor:A.buttonColor,showCard:A.showCard,compact:A.compact,classNames:y.card},A.offer.id)};return b?t.jsx(We.motion.div,{"data-testid":"offer-card-list",className:S,variants:ml,initial:"hidden",animate:"show",children:t.jsx(We.AnimatePresence,{children:D.map(E=>{const A=j(E);return t.jsx(We.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:y.cardWrapper,variants:fl,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Ls,{offer:A.offer,quantity:A.quantity,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:x,showCard:f,compact:g||A.offer.compact,classNames:y.card})},A.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:D.map(M)})};pl.displayName="OfferCardList";var ds=e=>e.type==="checkbox",kt=e=>e instanceof Date,Ke=e=>e==null;const xl=e=>typeof e=="object";var De=e=>!Ke(e)&&!Array.isArray(e)&&xl(e)&&!kt(e),hl=e=>De(e)&&e.target?ds(e.target)?e.target.checked:e.target.value:e,Jm=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,bl=(e,s)=>e.has(Jm(s)),ef=e=>{const s=e.constructor&&e.constructor.prototype;return De(s)&&s.hasOwnProperty("isPrototypeOf")},sa=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function $e(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(sa&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(De(e)&&ef(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=$e(e[r]));return a}var Ws=e=>/^\w*$/.test(e),ve=e=>e===void 0,na=e=>Array.isArray(e)?e.filter(Boolean):[],aa=e=>na(e.replace(/["|']|\]/g,"").split(/\.|\[/)),K=(e,s,n)=>{if(!s||!De(e))return n;const a=(Ws(s)?[s]:aa(s)).reduce((r,i)=>Ke(r)?r:r[i],e);return ve(a)||a===e?ve(e[s])?n:e[s]:a},Qe=e=>typeof e=="boolean",He=e=>typeof e=="function",he=(e,s,n)=>{let a=-1;const r=Ws(s)?[s]:aa(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=De(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const Fs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},at={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ct={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},gl=h.createContext(null);gl.displayName="HookFormControlContext";const ra=()=>h.useContext(gl);var yl=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==at.all&&(s._proxyFormState[o]=!a||at.all),n&&(n[o]=!0),e[o]}});return r};const ia=typeof window<"u"?h.useLayoutEffect:h.useEffect;function tf(e){const s=ra(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(n._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ia(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),h.useMemo(()=>yl(o,n,d.current,!1),[o,n])}var Xe=e=>typeof e=="string",_n=(e,s,n,a,r)=>Xe(e)?(a&&s.watch.add(e),K(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),K(n,i))):(a&&(s.watchAll=!0),n),Rn=e=>Ke(e)||!xl(e);function rt(e,s,n=new WeakSet){if(Rn(e)||Rn(s))return Object.is(e,s);if(kt(e)&&kt(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(kt(o)&&kt(l)||De(o)&&De(l)||Array.isArray(o)&&Array.isArray(l)?!rt(o,l,n):!Object.is(o,l))return!1}}return!0}function sf(e){const s=ra(),{control:n=s,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),p=h.useRef(void 0),m=h.useRef(n),x=h.useRef(a);u.current=l;const[f,b]=h.useState(()=>{const N=n._getWatch(a,d.current);return u.current?u.current(N):N}),v=h.useCallback(N=>{const $=_n(a,n._names,N||n._formValues,!1,d.current);return u.current?u.current($):$},[n._formValues,n._names,a]),g=h.useCallback(N=>{if(!i){const $=_n(a,n._names,N||n._formValues,!1,d.current);if(u.current){const D=u.current($);rt(D,p.current)||(b(D),p.current=D)}else b($)}},[n._formValues,n._names,i,a]);ia(()=>((m.current!==n||!rt(x.current,a))&&(m.current=n,x.current=a,g()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{g(N.values)}})),[n,o,a,g]),h.useEffect(()=>n._removeUnmounted());const y=m.current!==n,w=x.current,k=h.useMemo(()=>{if(i)return null;const N=!y&&!rt(w,a);return y||N?v():null},[i,y,a,w,v]);return k!==null?k:f}function nf(e){const s=ra(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=bl(r._names.array,n),u=h.useMemo(()=>K(r._formValues,n,K(r._defaultValues,n,o)),[r,n,o]),p=sf({control:r,name:n,defaultValue:u,exact:l}),m=tf({control:r,name:n,exact:l}),x=h.useRef(e),f=h.useRef(void 0),b=h.useRef(r.register(n,{...e.rules,value:p,...Qe(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const v=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!K(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!K(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!K(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!K(m.validatingFields,n)},error:{enumerable:!0,get:()=>K(m.errors,n)}}),[m,n]),g=h.useCallback(N=>b.current.onChange({target:{value:hl(N),name:n},type:Fs.CHANGE}),[n]),y=h.useCallback(()=>b.current.onBlur({target:{value:K(r._formValues,n),name:n},type:Fs.BLUR}),[n,r._formValues]),w=h.useCallback(N=>{const $=K(r._fields,n);$&&$._f&&N&&($._f.ref={focus:()=>He(N.focus)&&N.focus(),select:()=>He(N.select)&&N.select(),setCustomValidity:D=>He(N.setCustomValidity)&&N.setCustomValidity(D),reportValidity:()=>He(N.reportValidity)&&N.reportValidity()})},[r._fields,n]),k=h.useMemo(()=>({name:n,value:p,...Qe(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:g,onBlur:y,ref:w}),[n,a,m.disabled,g,y,w,p]);return h.useEffect(()=>{const N=r._options.shouldUnregister||i,$=f.current;$&&$!==n&&!d&&r.unregister($),r.register(n,{...x.current.rules,...Qe(x.current.disabled)?{disabled:x.current.disabled}:{}});const D=(j,L)=>{const S=K(r._fields,j);S&&S._f&&(S._f.mount=L)};if(D(n,!0),N){const j=$e(K(r._options.defaultValues,n,x.current.defaultValue));he(r._defaultValues,n,j),ve(K(r._formValues,n))&&he(r._formValues,n,j)}return!d&&r.register(n),f.current=n,()=>{(d?N&&!r._state.action:N)?r.unregister(n):D(n,!1)}},[n,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),h.useMemo(()=>({field:k,formState:m,fieldState:v}),[k,m,v])}const af=h.createContext(null);af.displayName="HookFormContext";var rf=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},ss=e=>Array.isArray(e)?e:[e],fr=()=>{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 vl(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&De(r)&&i){const o=vl(r,i);De(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Ue=e=>De(e)&&!Object.keys(e).length,la=e=>e.type==="file",_s=e=>{if(!sa)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},jl=e=>e.type==="select-multiple",oa=e=>e.type==="radio",lf=e=>oa(e)||ds(e),cn=e=>_s(e)&&e.isConnected;function of(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=ve(e)?a++:e[s[a++]];return e}function cf(e){for(const s in e)if(e.hasOwnProperty(s)&&!ve(e[s]))return!1;return!0}function Ae(e,s){const n=Array.isArray(s)?s:Ws(s)?[s]:aa(s),a=n.length===1?e:of(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(De(a)&&Ue(a)||Array.isArray(a)&&cf(a))&&Ae(e,n.slice(0,-1)),e}var df=e=>{for(const s in e)if(He(e[s]))return!0;return!1};function wl(e){return Array.isArray(e)||De(e)&&!df(e)}function Mn(e,s={}){for(const n in e){const a=e[n];wl(a)?(s[n]=Array.isArray(a)?[]:{},Mn(a,s[n])):ve(a)||(s[n]=!0)}return s}function Pt(e,s,n){n||(n=Mn(s));for(const a in e){const r=e[a];if(wl(r))ve(s)||Rn(n[a])?n[a]=Mn(r,Array.isArray(r)?[]:{}):Pt(r,Ke(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!rt(r,i)}}return n}const pr={value:!1,isValid:!1},xr={value:!0,isValid:!0};var Nl=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||e[0].value===""?xr:{value:e[0].value,isValid:!0}:xr:pr}return pr},Cl=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>ve(e)?e:s?e===""?NaN:e&&+e:n&&Xe(e)?new Date(e):a?a(e):e;const hr={isValid:!1,value:null};var kl=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,hr):hr;function br(e){const s=e.ref;return la(s)?s.files:oa(s)?kl(e.refs).value:jl(s)?[...s.selectedOptions].map(({value:n})=>n):ds(s)?Nl(e.refs).value:Cl(ve(s.value)?e.ref.value:s.value,e)}var uf=(e,s,n,a)=>{const r={};for(const i of e){const o=K(s,i);o&&he(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},Rs=e=>e instanceof RegExp,Gt=e=>ve(e)?e:Rs(e)?e.source:De(e)?Rs(e.value)?e.value.source:e.value:e,gr=e=>({isOnSubmit:!e||e===at.onSubmit,isOnBlur:e===at.onBlur,isOnChange:e===at.onChange,isOnAll:e===at.all,isOnTouch:e===at.onTouched});const yr="AsyncFunction";var mf=e=>!!e&&!!e.validate&&!!(He(e.validate)&&e.validate.constructor.name===yr||De(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===yr)),ff=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),vr=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ns=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=K(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(ns(l,s))break}else if(De(l)&&ns(l,s))break}}};function jr(e,s,n){const a=K(e,n);if(a||Ws(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=K(s,i),l=K(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:n}}var pf=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Ue(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||at.all))},xf=(e,s,n)=>!e||!s||e===s||ss(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),hf=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,bf=(e,s)=>!na(K(e,s)).length&&Ae(e,s),gf=(e,s,n)=>{const a=ss(K(e,n));return he(a,"root",s[n]),he(e,n,a),e};function wr(e,s,n="validate"){if(Xe(e)||Array.isArray(e)&&e.every(Xe)||Qe(e)&&!e)return{type:n,message:Xe(e)?e:"",ref:s}}var Ft=e=>De(e)&&!Rs(e)?e:{value:e,message:""},Nr=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:p,min:m,max:x,pattern:f,validate:b,name:v,valueAsNumber:g,mount:y}=e._f,w=K(n,v);if(!y||s.has(v))return{};const k=l?l[0]:o,N=A=>{r&&k.reportValidity&&(k.setCustomValidity(Qe(A)?"":A||""),k.reportValidity())},$={},D=oa(o),j=ds(o),L=D||j,S=(g||la(o))&&ve(o.value)&&ve(w)||_s(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,M=rf.bind(null,v,a,$),E=(A,R,T,U=ct.maxLength,G=ct.minLength)=>{const I=A?R:T;$[v]={type:A?U:G,message:I,ref:o,...M(A?U:G,I)}};if(i?!Array.isArray(w)||!w.length:d&&(!L&&(S||Ke(w))||Qe(w)&&!w||j&&!Nl(l).isValid||D&&!kl(l).isValid)){const{value:A,message:R}=Xe(d)?{value:!!d,message:d}:Ft(d);if(A&&($[v]={type:ct.required,message:R,ref:k,...M(ct.required,R)},!a))return N(R),$}if(!S&&(!Ke(m)||!Ke(x))){let A,R;const T=Ft(x),U=Ft(m);if(!Ke(w)&&!isNaN(w)){const G=o.valueAsNumber||w&&+w;Ke(T.value)||(A=G>T.value),Ke(U.value)||(R=G<U.value)}else{const G=o.valueAsDate||new Date(w),I=Q=>new Date(new Date().toDateString()+" "+Q),se=o.type=="time",q=o.type=="week";Xe(T.value)&&w&&(A=se?I(w)>I(T.value):q?w>T.value:G>new Date(T.value)),Xe(U.value)&&w&&(R=se?I(w)<I(U.value):q?w<U.value:G<new Date(U.value))}if((A||R)&&(E(!!A,T.message,U.message,ct.max,ct.min),!a))return N($[v].message),$}if((u||p)&&!S&&(Xe(w)||i&&Array.isArray(w))){const A=Ft(u),R=Ft(p),T=!Ke(A.value)&&w.length>+A.value,U=!Ke(R.value)&&w.length<+R.value;if((T||U)&&(E(T,A.message,R.message),!a))return N($[v].message),$}if(f&&!S&&Xe(w)){const{value:A,message:R}=Ft(f);if(Rs(A)&&!w.match(A)&&($[v]={type:ct.pattern,message:R,ref:o,...M(ct.pattern,R)},!a))return N(R),$}if(b){if(He(b)){const A=await b(w,n),R=wr(A,k);if(R&&($[v]={...R,...M(ct.validate,R.message)},!a))return N(R.message),$}else if(De(b)){let A={};for(const R in b){if(!Ue(A)&&!a)break;const T=wr(await b[R](w,n),k,R);T&&(A={...T,...M(R,T.message)},N(T.message),a&&($[v]=A))}if(!Ue(A)&&($[v]={ref:k,...A},!a))return $}}return N(!0),$};const yf={mode:at.onSubmit,reValidateMode:at.onChange,shouldFocusError:!0};function vf(e={}){let s={...yf,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:He(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=De(s.defaultValues)||De(s.values)?$e(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:$e(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 p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p};let x={...m};const f={array:fr(),state:fr()},b=s.criteriaMode===at.all,v=C=>F=>{clearTimeout(u),u=setTimeout(C,F)},g=async C=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||x.isValid||C)){let F;s.resolver?(F=Ue((await L()).errors),y()):F=await M(a,!0),F!==n.isValid&&f.state.next({isValid:F})}},y=(C,F)=>{!s.disabled&&(m.isValidating||m.validatingFields||x.isValidating||x.validatingFields)&&((C||Array.from(l.mount)).forEach(_=>{_&&(F?he(n.validatingFields,_,F):Ae(n.validatingFields,_))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Ue(n.validatingFields)}))},w=(C,F=[],_,W,H=!0,B=!0)=>{if(W&&_&&!s.disabled){if(o.action=!0,B&&Array.isArray(K(a,C))){const ee=_(K(a,C),W.argA,W.argB);H&&he(a,C,ee)}if(B&&Array.isArray(K(n.errors,C))){const ee=_(K(n.errors,C),W.argA,W.argB);H&&he(n.errors,C,ee),bf(n.errors,C)}if((m.touchedFields||x.touchedFields)&&B&&Array.isArray(K(n.touchedFields,C))){const ee=_(K(n.touchedFields,C),W.argA,W.argB);H&&he(n.touchedFields,C,ee)}(m.dirtyFields||x.dirtyFields)&&(n.dirtyFields=Pt(r,i)),f.state.next({name:C,isDirty:A(C,F),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else he(i,C,F)},k=(C,F)=>{he(n.errors,C,F),f.state.next({errors:n.errors})},N=C=>{n.errors=C,f.state.next({errors:n.errors,isValid:!1})},$=(C,F,_,W)=>{const H=K(a,C);if(H){const B=K(i,C,ve(_)?K(r,C):_);ve(B)||W&&W.defaultChecked||F?he(i,C,F?B:br(H._f)):U(C,B),o.mount&&!o.action&&g()}},D=(C,F,_,W,H)=>{let B=!1,ee=!1;const fe={name:C};if(!s.disabled){if(!_||W){(m.isDirty||x.isDirty)&&(ee=n.isDirty,n.isDirty=fe.isDirty=A(),B=ee!==fe.isDirty);const pe=rt(K(r,C),F);ee=!!K(n.dirtyFields,C),pe?Ae(n.dirtyFields,C):he(n.dirtyFields,C,!0),fe.dirtyFields=n.dirtyFields,B=B||(m.dirtyFields||x.dirtyFields)&&ee!==!pe}if(_){const pe=K(n.touchedFields,C);pe||(he(n.touchedFields,C,_),fe.touchedFields=n.touchedFields,B=B||(m.touchedFields||x.touchedFields)&&pe!==_)}B&&H&&f.state.next(fe)}return B?fe:{}},j=(C,F,_,W)=>{const H=K(n.errors,C),B=(m.isValid||x.isValid)&&Qe(F)&&n.isValid!==F;if(s.delayError&&_?(d=v(()=>k(C,_)),d(s.delayError)):(clearTimeout(u),d=null,_?he(n.errors,C,_):Ae(n.errors,C)),(_?!rt(H,_):H)||!Ue(W)||B){const ee={...W,...B&&Qe(F)?{isValid:F}:{},errors:n.errors,name:C};n={...n,...ee},f.state.next(ee)}},L=async C=>(y(C,!0),await s.resolver(i,s.context,uf(C||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),S=async C=>{const{errors:F}=await L(C);if(y(C),C)for(const _ of C){const W=K(F,_);W?he(n.errors,_,W):Ae(n.errors,_)}else n.errors=F;return F},M=async(C,F,_={valid:!0})=>{for(const W in C){const H=C[W];if(H){const{_f:B,...ee}=H;if(B){const fe=l.array.has(B.name),pe=H._f&&mf(H._f);pe&&m.validatingFields&&y([B.name],!0);const ze=await Nr(H,l.disabled,i,b,s.shouldUseNativeValidation&&!F,fe);if(pe&&m.validatingFields&&y([B.name]),ze[B.name]&&(_.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(K(ze,B.name)?fe?gf(n.errors,ze,B.name):he(n.errors,B.name,ze[B.name]):Ae(n.errors,B.name))}!Ue(ee)&&await M(ee,F,_)}}return _.valid},E=()=>{for(const C of l.unMount){const F=K(a,C);F&&(F._f.refs?F._f.refs.every(_=>!cn(_)):!cn(F._f.ref))&&Z(C)}l.unMount=new Set},A=(C,F)=>!s.disabled&&(C&&F&&he(i,C,F),!rt(Y(),r)),R=(C,F,_)=>_n(C,l,{...o.mount?i:ve(F)?r:Xe(C)?{[C]:F}:F},_,F),T=C=>na(K(o.mount?i:r,C,s.shouldUnregister?K(r,C,[]):[])),U=(C,F,_={})=>{const W=K(a,C);let H=F;if(W){const B=W._f;B&&(!B.disabled&&he(i,C,Cl(F,B)),H=_s(B.ref)&&Ke(F)?"":F,jl(B.ref)?[...B.ref.options].forEach(ee=>ee.selected=H.includes(ee.value)):B.refs?ds(B.ref)?B.refs.forEach(ee=>{(!ee.defaultChecked||!ee.disabled)&&(Array.isArray(H)?ee.checked=!!H.find(fe=>fe===ee.value):ee.checked=H===ee.value||!!H)}):B.refs.forEach(ee=>ee.checked=ee.value===H):la(B.ref)?B.ref.value="":(B.ref.value=H,B.ref.type||f.state.next({name:C,values:$e(i)})))}(_.shouldDirty||_.shouldTouch)&&D(C,H,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&Q(C)},G=(C,F,_)=>{for(const W in F){if(!F.hasOwnProperty(W))return;const H=F[W],B=C+"."+W,ee=K(a,B);(l.array.has(C)||De(H)||ee&&!ee._f)&&!kt(H)?G(B,H,_):U(B,H,_)}},I=(C,F,_={})=>{const W=K(a,C),H=l.array.has(C),B=$e(F);he(i,C,B),H?(f.array.next({name:C,values:$e(i)}),(m.isDirty||m.dirtyFields||x.isDirty||x.dirtyFields)&&_.shouldDirty&&f.state.next({name:C,dirtyFields:Pt(r,i),isDirty:A(C,B)})):W&&!W._f&&!Ke(B)?G(C,B,_):U(C,B,_),vr(C,l)?f.state.next({...n,name:C,values:$e(i)}):f.state.next({name:o.mount?C:void 0,values:$e(i)})},se=async C=>{o.mount=!0;const F=C.target;let _=F.name,W=!0;const H=K(a,_),B=pe=>{W=Number.isNaN(pe)||kt(pe)&&isNaN(pe.getTime())||rt(pe,K(i,_,pe))},ee=gr(s.mode),fe=gr(s.reValidateMode);if(H){let pe,ze;const vt=F.type?br(H._f):hl(C),pt=C.type===Fs.BLUR||C.type===Fs.FOCUS_OUT,Oc=!ff(H._f)&&!s.resolver&&!K(n.errors,_)&&!H._f.deps||hf(pt,K(n.touchedFields,_),n.isSubmitted,fe,ee),Zs=vr(_,l,pt);he(i,_,vt),pt?(!F||!F.readOnly)&&(H._f.onBlur&&H._f.onBlur(C),d&&d(0)):H._f.onChange&&H._f.onChange(C);const Xs=D(_,vt,pt),Bc=!Ue(Xs)||Zs;if(!pt&&f.state.next({name:_,type:C.type,values:$e(i)}),Oc)return(m.isValid||x.isValid)&&(s.mode==="onBlur"?pt&&g():pt||g()),Bc&&f.state.next({name:_,...Zs?{}:Xs});if(!pt&&Zs&&f.state.next({...n}),s.resolver){const{errors:Ta}=await L([_]);if(y([_]),B(vt),W){const zc=jr(n.errors,a,_),Ia=jr(Ta,a,zc.name||_);pe=Ia.error,_=Ia.name,ze=Ue(Ta)}}else y([_],!0),pe=(await Nr(H,l.disabled,i,b,s.shouldUseNativeValidation))[_],y([_]),B(vt),W&&(pe?ze=!1:(m.isValid||x.isValid)&&(ze=await M(a,!0)));W&&(H._f.deps&&(!Array.isArray(H._f.deps)||H._f.deps.length>0)&&Q(H._f.deps),j(_,ze,pe,Xs))}},q=(C,F)=>{if(K(n.errors,F)&&C.focus)return C.focus(),1},Q=async(C,F={})=>{let _,W;const H=ss(C);if(s.resolver){const B=await S(ve(C)?C:H);_=Ue(B),W=C?!H.some(ee=>K(B,ee)):_}else C?(W=(await Promise.all(H.map(async B=>{const ee=K(a,B);return await M(ee&&ee._f?{[B]:ee}:ee)}))).every(Boolean),!(!W&&!n.isValid)&&g()):W=_=await M(a);return f.state.next({...!Xe(C)||(m.isValid||x.isValid)&&_!==n.isValid?{}:{name:C},...s.resolver||!C?{isValid:_}:{},errors:n.errors}),F.shouldFocus&&!W&&ns(a,q,C?H:l.mount),W},Y=(C,F)=>{let _={...o.mount?i:r};return F&&(_=vl(F.dirtyFields?n.dirtyFields:n.touchedFields,_)),ve(C)?_:Xe(C)?K(_,C):C.map(W=>K(_,W))},ce=(C,F)=>({invalid:!!K((F||n).errors,C),isDirty:!!K((F||n).dirtyFields,C),error:K((F||n).errors,C),isValidating:!!K(n.validatingFields,C),isTouched:!!K((F||n).touchedFields,C)}),ne=C=>{C&&ss(C).forEach(F=>Ae(n.errors,F)),f.state.next({errors:C?n.errors:{}})},X=(C,F,_)=>{const W=(K(a,C,{_f:{}})._f||{}).ref,H=K(n.errors,C)||{},{ref:B,message:ee,type:fe,...pe}=H;he(n.errors,C,{...pe,...F,ref:W}),f.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&W&&W.focus&&W.focus()},ie=(C,F)=>He(C)?f.state.subscribe({next:_=>"values"in _&&C(R(void 0,F),_)}):R(C,F,!0),V=C=>f.state.subscribe({next:F=>{xf(C.name,F.name,C.exact)&&pf(F,C.formState||m,ue,C.reRenderRoot)&&C.callback({values:{...i},...n,...F,defaultValues:r})}}).unsubscribe,z=C=>(o.mount=!0,x={...x,...C.formState},V({...C,formState:{...p,...C.formState}})),Z=(C,F={})=>{for(const _ of C?ss(C):l.mount)l.mount.delete(_),l.array.delete(_),F.keepValue||(Ae(a,_),Ae(i,_)),!F.keepError&&Ae(n.errors,_),!F.keepDirty&&Ae(n.dirtyFields,_),!F.keepTouched&&Ae(n.touchedFields,_),!F.keepIsValidating&&Ae(n.validatingFields,_),!s.shouldUnregister&&!F.keepDefaultValue&&Ae(r,_);f.state.next({values:$e(i)}),f.state.next({...n,...F.keepDirty?{isDirty:A()}:{}}),!F.keepIsValid&&g()},Ie=({disabled:C,name:F})=>{if(Qe(C)&&o.mount||C||l.disabled.has(F)){const H=l.disabled.has(F)!==!!C;C?l.disabled.add(F):l.disabled.delete(F),H&&o.mount&&!o.action&&g()}},Fe=(C,F={})=>{let _=K(a,C);const W=Qe(F.disabled)||Qe(s.disabled);return he(a,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...F}}),l.mount.add(C),_?Ie({disabled:Qe(F.disabled)?F.disabled:s.disabled,name:C}):$(C,!0,F.value),{...W?{disabled:F.disabled||s.disabled}:{},...s.progressive?{required:!!F.required,min:Gt(F.min),max:Gt(F.max),minLength:Gt(F.minLength),maxLength:Gt(F.maxLength),pattern:Gt(F.pattern)}:{},name:C,onChange:se,onBlur:se,ref:H=>{if(H){Fe(C,F),_=K(a,C);const B=ve(H.value)&&H.querySelectorAll&&H.querySelectorAll("input,select,textarea")[0]||H,ee=lf(B),fe=_._f.refs||[];if(ee?fe.find(pe=>pe===B):B===_._f.ref)return;he(a,C,{_f:{..._._f,...ee?{refs:[...fe.filter(cn),B,...Array.isArray(K(r,C))?[{}]:[]],ref:{type:B.type,name:C}}:{ref:B}}}),$(C,!1,void 0,B)}else _=K(a,C,{}),_._f&&(_._f.mount=!1),(s.shouldUnregister||F.shouldUnregister)&&!(bl(l.array,C)&&o.action)&&l.unMount.add(C)}}},_e=()=>s.shouldFocusError&&ns(a,q,l.mount),ae=C=>{Qe(C)&&(f.state.next({disabled:C}),ns(a,(F,_)=>{const W=K(a,_);W&&(F.disabled=W._f.disabled||C,Array.isArray(W._f.refs)&&W._f.refs.forEach(H=>{H.disabled=W._f.disabled||C}))},0,!1))},je=(C,F)=>async _=>{let W;_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist());let H=$e(i);if(f.state.next({isSubmitting:!0}),s.resolver){const{errors:B,values:ee}=await L();y(),n.errors=B,H=$e(ee)}else await M(a);if(l.disabled.size)for(const B of l.disabled)Ae(H,B);if(Ae(n.errors,"root"),Ue(n.errors)){f.state.next({errors:{}});try{await C(H,_)}catch(B){W=B}}else F&&await F({...n.errors},_),_e(),setTimeout(_e);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(n.errors)&&!W,submitCount:n.submitCount+1,errors:n.errors}),W)throw W},Re=(C,F={})=>{K(a,C)&&(ve(F.defaultValue)?I(C,$e(K(r,C))):(I(C,F.defaultValue),he(r,C,$e(F.defaultValue))),F.keepTouched||Ae(n.touchedFields,C),F.keepDirty||(Ae(n.dirtyFields,C),n.isDirty=F.defaultValue?A(C,$e(K(r,C))):A()),F.keepError||(Ae(n.errors,C),m.isValid&&g()),f.state.next({...n}))},et=(C,F={})=>{const _=C?$e(C):r,W=$e(_),H=Ue(C),B=H?r:W;if(F.keepDefaultValues||(r=_),!F.keepValues){if(F.keepDirtyValues){const ee=new Set([...l.mount,...Object.keys(Pt(r,i))]);for(const fe of Array.from(ee)){const pe=K(n.dirtyFields,fe),ze=K(i,fe),vt=K(B,fe);pe&&!ve(ze)?he(B,fe,ze):!pe&&!ve(vt)&&I(fe,vt)}}else{if(sa&&ve(C))for(const ee of l.mount){const fe=K(a,ee);if(fe&&fe._f){const pe=Array.isArray(fe._f.refs)?fe._f.refs[0]:fe._f.ref;if(_s(pe)){const ze=pe.closest("form");if(ze){ze.reset();break}}}}if(F.keepFieldsRef)for(const ee of l.mount)I(ee,K(B,ee));else a={}}i=s.shouldUnregister?F.keepDefaultValues?$e(r):{}:$e(B),f.array.next({values:{...B}}),f.state.next({values:{...B}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!s.shouldUnregister&&!Ue(B),o.watch=!!s.shouldUnregister,o.keepIsValid=!!F.keepIsValid,o.action=!1,F.keepErrors||(n.errors={}),f.state.next({submitCount:F.keepSubmitCount?n.submitCount:0,isDirty:H?!1:F.keepDirty?n.isDirty:!!(F.keepDefaultValues&&!rt(C,r)),isSubmitted:F.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:H?{}:F.keepDirtyValues?F.keepDefaultValues&&i?Pt(r,i):n.dirtyFields:F.keepDefaultValues&&C?Pt(r,C):F.keepDirty?n.dirtyFields:{},touchedFields:F.keepTouched?n.touchedFields:{},errors:F.keepErrors?n.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ge=(C,F)=>et(He(C)?C(i):C,{...s.resetOptions,...F}),Me=(C,F={})=>{const _=K(a,C),W=_&&_._f;if(W){const H=W.refs?W.refs[0]:W.ref;H.focus&&setTimeout(()=>{H.focus(),F.shouldSelect&&He(H.select)&&H.select()})}},ue=C=>{n={...n,...C}},J={control:{register:Fe,unregister:Z,getFieldState:ce,handleSubmit:je,setError:X,_subscribe:V,_runSchema:L,_updateIsValidating:y,_focusError:_e,_getWatch:R,_getDirty:A,_setValid:g,_setFieldArray:w,_setDisabledField:Ie,_setErrors:N,_getFieldArray:T,_reset:et,_resetDefaultValues:()=>He(s.defaultValues)&&s.defaultValues().then(C=>{ge(C,s.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:ae,_subjects:f,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return r},get _names(){return l},set _names(C){l=C},get _formState(){return n},get _options(){return s},set _options(C){s={...s,...C}}},subscribe:z,trigger:Q,register:Fe,handleSubmit:je,watch:ie,setValue:I,getValues:Y,reset:ge,resetField:Re,clearErrors:ne,unregister:Z,setError:X,setFocus:Me,getFieldState:ce};return{...J,formControl:J}}function jf(e={}){const s=h.useRef(void 0),n=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:He(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:He(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!He(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=vf(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,ia(()=>{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&&!rt(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=h.useMemo(()=>yl(a,i),[i,a]),s.current}function wf(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function Nf(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Cf(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function kf(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Sf(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function ca(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ca();const $f={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:"$"},dn=()=>({id:ca(),amount:0,glAccount:null,isTaxDeductible:!1}),Sl=({distribution:e,defaultDistribution:s,glAccounts:n=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:p=!0,canEditTaxDeductible:m=!0,isDisabled:x=!1,labels:f,classNames:b={},"data-testid":v,control:g,name:y,rules:w})=>{const k={...$f,...f},N=g!==void 0&&y!==void 0,$=jf({defaultValues:{_internal:s||dn()}}),D=nf({control:N?g:$.control,name:N?y:"_internal",rules:N?w:void 0}),[j,L]=h.useState(s||dn()),S=N?D.field.value??dn():e??j,M=N&&!!D.fieldState?.error,E=N&&(D.fieldState?.isTouched??!1),A=M||E,R=A&&(!S.amount||S.amount<=0),T=A&&!S.glAccount,[U,G]=h.useState(S.glAccount?.name||""),I=h.useCallback(X=>{const ie={...S,...X};N&&D.field.onChange(ie),!N&&e===void 0&&L(ie),i?.(ie)},[S,e,i,N,D]),se=h.useCallback(X=>{const ie=X||0;I({amount:ie}),o?.(ie)},[I,o]),q=h.useCallback(X=>{G(X),r?.(X)},[r]),Q=h.useCallback(X=>{if(X===null){I({glAccount:null}),l?.(null);return}const V=n.find(z=>String(z.id)===String(X))||null;I({glAccount:V}),l?.(V)},[n,I,l]),Y=h.useCallback(()=>{G(""),I({glAccount:null}),l?.(null)},[I,l]),ce=h.useCallback(X=>{I({isTaxDeductible:X}),d?.(X)},[I,d]),ne=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"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":`${v||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,t.jsx(c.Tooltip,{content:k.amountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:se,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:x,isInvalid:R,errorMessage:R?"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:k.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,t.jsx(c.Tooltip,{content:k.glAccountTooltip,children:t.jsx(P,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:S.glAccount?.name??U,selectedKey:S.glAccount?.id??null,isDisabled:x,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:q,onSelectionChange:Q,onClear:Y,className:b.glAccountInput,children:X=>t.jsx(c.AutocompleteItem,{textValue:X.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:X.name}),X.code&&t.jsx("span",{className:"text-xs text-default-400",children:X.code})]})},X.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":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:ce,isDisabled:x||!m,className:b.taxDeductibleCheckbox,children:k.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(O,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!p,onPress:ne,startContent:t.jsx(P,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:k.deleteButton})})]})})};Sl.displayName="RevenueDistributionCard";const $l=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(P,{icon:s,width:n,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};$l.displayName="RevenueDistributionEmpty";const Af={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Al=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Af,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};Al.displayName="RevenueDistributionError";const El=({rows:e=1,showCard:s=!0,classNames:n={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(oe,{className:"h-4 w-14 rounded-md"}),t.jsx(oe,{className:"h-4 w-4 rounded-full"})]}),t.jsx(oe,{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(oe,{className:"h-4 w-20 rounded-md"}),t.jsx(oe,{className:"h-4 w-4 rounded-full"})]}),t.jsx(oe,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(oe,{className:"h-5 w-5 rounded-full"}),t.jsx(oe,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(oe,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>r(i))})};El.displayName="RevenueDistributionSkeleton";function da({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:p}){return t.jsx(cs,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[n&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(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:s.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:p,children:s.confirm})]})]})})}const Ef=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Cr(e){return!e.fund&&Number(e.percentage||0)<=0}function Df({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const Lf={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"},Dl={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"},Kt={...Dl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Ff={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"},_f={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 Rf(){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 Mf=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Pf=e=>e.fund!==null;function Tf({assignments:e,funds:s,labels:n,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:p,footer:m,onAssignmentsChange:x,onOpenFundPicker:f,onCloseFundPicker:b,onCollapseChange:v,onSave:g}){const[y,w]=h.useState(null),k=p??y??void 0,N={...Lf,...n},$=e.filter(V=>!Cr(V)),j=$.filter(Pf).length>0,L=h.useMemo(()=>e.filter(V=>!Cr(V)).reduce((V,z)=>V+Number(z.percentage||0),0),[e]),S=Math.round(L*100)/100,M=$.some(V=>!V.fund||Number(V.percentage||0)<=0),E=j&&(S!==100||M),A=`${N.totalError} (${N.total} ${Number(L.toFixed(2))}%)`,R=Df({mode:"split",assignments:e}),T=j&&S>=100,[U,G]=h.useState(!1),[I,se]=h.useState(!1),q=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Rf,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:N.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:N.saved}):null]}),Q=(V,z)=>{x(e.map(Z=>Z.id===V?{...Z,...z}:Z))},Y=()=>{T||x([...e,Ef()])},ce=V=>{e.length<=1||x(e.filter(z=>z.id!==V))},ne=()=>{if(!r){if(!R){se(!0);return}if(!i){g();return}G(!0)}},X=()=>{G(!1),g()},ie=V=>{const z=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;z&&(x(e.map(Z=>Z.id===z?{...Z,fund:V}:Z)),b())};return t.jsxs("div",{ref:w,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!p&&"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=>v?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":N.title,title:q,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!j&&t.jsx(c.Alert,{icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Dl,color:"default",variant:"flat",title:N.emptySplit}),j&&t.jsx(If,{assignments:e,labels:N,total:L,hasTotalError:I&&!R||E,validationMessage:A,onSelectFund:V=>f(V),onRemoveFund:ce,onPercentageChange:(V,z)=>Q(V,{percentage:Mf(z)})}),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(te.Plus,{className:"size-5",strokeWidth:2}),isDisabled:T,onPress:()=>j?Y():f(),children:N.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(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!R||r,onPress:ne,children:N.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Of,{funds:s,labels:N,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:k,onSelect:ie,onClose:b}),t.jsx(da,{isOpen:U,labels:{title:N.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:N.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:N.modifyAssignedFundsWarning})]}),cancel:N.modifyAssignedFundsCancel,confirm:N.modifyAssignedFundsConfirm},icon:t.jsx(P,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:k,shouldBlockScroll:!1,classNames:_f,onClose:()=>G(!1),onConfirm:X})]})}function If({assignments:e,labels:s,total:n,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(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(te.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:p=>l(d.id,Number(p.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Ff})}),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":s.removeFund,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(P,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Kt,base:c.cn(Kt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Kt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Kt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Kt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function Of({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const p=o.trim().toLowerCase();return p?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(p):!0});return t.jsx(cs,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:o,placeholder:s.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(P,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(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:s.select})]},u.id))]})]})]})})}function Bf(){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(oe,{className:"h-7 w-56 rounded-lg"}),t.jsx(oe,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(oe,{className:"h-10 w-72 rounded-full"}),t.jsx(oe,{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(oe,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(oe,{className:"h-8 w-full rounded-xl"})]}),t.jsx(oe,{className:"h-11 w-40 rounded-full"})]})}const zf={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Vf({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...zf,...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(un,{label:l.totalAmount,value:d.format(e)}),t.jsx(un,{label:l.remainingBalance,value:d.format(s)}),t.jsx(un,{label:l.amountReceived,value:d.format(n)})]})})}function un({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const Uf={monthly:1,quarterly:3,annual:12},Ll=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},Hf=(e,s)=>new Date(e,s+1,0).getDate(),Wf=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},qf=(e,s)=>{const{year:n,month:a,day:r}=Ll(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Hf(o,l));return new Date(o,l,d)},Gf=(e,s)=>{const{year:n,month:a,day:r}=Ll(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function Fl(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=Uf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?Gf(s.firstInstallmentDate,d*7):qf(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:Wf(u),amount:(r+(d===0?i:0))/100}})}function Kf(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function Yf(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:Kf(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Qf(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Zf(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const Xf=new Set(["paid","partially_refunded","refunded"]);function St(e){return e!==void 0&&Xf.has(e)}const Jf={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."},ep=["weekly","monthly","quarterly","annual"],tp=Array.from({length:31},(e,s)=>s+1),sp=["numberOfInstallments","frequency","firstInstallmentDate"],kr=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),Ms=e=>Math.round(e*100)/100,np=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},qs=e=>{if(!e)return null;try{return Mu(e)}catch{return null}},ap=e=>qs(e)?.day??1,rp=(e,s)=>new Date(e,s,0).getDate(),ip=(e,s)=>{const n=qs(e);if(!n)return e;const a=Math.min(s,rp(n.year,n.month));return n.set({day:a}).toString()},Sr=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function lp({mode:e,donationAmount:s,currency:n="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:p=!0,inputs:m=sp,startDate:x,firstInstallmentDateOverride:f,labels:b,classNames:v,isSaving:g=!1,showSavedIndicator:y=!1,isModeSwitchDisabled:w=!1,onModeChange:k,onAutomaticSettingsChange:N,onInstallmentsChange:$,onSave:D,onCancel:j}){const[L,S]=h.useState(o),M={...Jf,...b},E=e??L,A=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),R=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,m,x]),T=E==="automatic"?Zf(Fl(s,R),m.includes("firstInstallmentDate")?void 0:f):r,U=h.useMemo(()=>Ms(T.reduce((Z,Ie)=>Z+Number(Ie.amount||0),0)),[T]),G=Math.abs(U-s)>.009,I=Ms(s-U)<=0,se=h.useMemo(()=>Yf(r),[r]),q=E==="manual"&&Qf(se),Q=G||q,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te.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}),y?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ce=Z=>{Z!==E&&(e||S(Z),k?.(Z),Z==="manual"&&r.length===0&&$([kr()]))},ne=(Z,Ie)=>{const Fe=r.find(_e=>_e.id===Z);St(Fe?.status)||$(r.map(_e=>_e.id===Z?{..._e,...Ie}:_e))},X=()=>{$([...r,kr()])},ie=Z=>{const Ie=r.find(Fe=>Fe.id===Z);St(Ie?.status)||$(r.filter(Fe=>Fe.id!==Z))},V=()=>{g||Q||D?.()},z=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.content),children:[p||u||j?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[p?t.jsx(op,{mode:E,labels:M,onModeChange:ce,isDisabled:w,className:v?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:j,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:g?void 0:t.jsx(P,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||Q,onPress:V,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.preview),children:[E==="automatic"&&t.jsx(cp,{settings:R,inputs:m,labels:M,className:v?.controls,onSettingsChange:N}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?M.emptyAutomatic:M.emptyManual}),T.length>0&&t.jsx(dp,{mode:E,installments:T,rowErrors:se,labels:M,formatter:A,locale:a,onUpdateInstallment:ne,onRemoveInstallment:ie}),E==="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(te.Plus,{className:"size-5",strokeWidth:2}),isDisabled:I,onPress:X,children:M.addInstallment})}),t.jsx(pp,{total:U,donationAmount:s,hasTotalMismatch:G,mode:E,installments:T,formatter:A,labels:M,className:v?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":M.title,title:Y,children:z},"installment-schedule")}):z})}function op({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function cp({settings:e,inputs:s,labels:n,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:n.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(it,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:ep.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(ap(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(it,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:ip(e.firstInstallmentDate,u)})},children:tp.map(d=>t.jsx(c.SelectItem,{textValue:Sr(d),children:Sr(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Jn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:qs(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(P,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function dp({mode:e,installments:s,rowErrors:n,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:np(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const p=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),x=n.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Jn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:St(d.status),isInvalid:p||m,errorMessage:p?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:qs(d.dueDate),onChange:f=>o(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(mp,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:St(d.status),isInvalid:x,errorMessage:a.amountGreaterThanZeroError,onAmountChange:f=>o(d.id,{amount:f})})}),t.jsx(fp,{isDisabled:s.length<=1,isPaid:St(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const up=/^\d*(?:[.,]\d{0,2})?$/;function mp({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!up.test(u))return;l(u);const p=Number(u.replace(",","."));i(Ms(Number.isFinite(p)?p:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function fp({isDisabled:e,isPaid:s,label:n,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||s,onPress:a,"aria-label":n,children:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function pp({total:e,donationAmount:s,hasTotalMismatch:n,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,p=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(p*100),x=Ms(s-e),f=Math.max(x,0),b=Math.max(-x,0),v=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(p)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}),g=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${o.remaining}: ${i.format(f)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:v})}function xp(){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(oe,{className:"h-7 w-56 rounded-lg"}),t.jsx(oe,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(oe,{className:"h-10 w-72 rounded-full"}),t.jsx(oe,{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(oe,{className:"h-4 w-36 rounded-md"}),t.jsx(oe,{className:"h-9 w-full rounded-xl"})]}),t.jsx(oe,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(oe,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(oe,{className:"h-8 w-full rounded-xl"})]},s))})]})}const $r={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"},_l={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"},hp={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:_l.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."},bp={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},gp=[];function yp({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=gp,showSavedIndicator:d=!1,labels:u,isSaving:p=!1,onEditInstallments:m,onPayInstallment:x,onDeleteInstallment:f}){const[b,v]=h.useState(null),g={...hp,...u},[y,w]=h.useState(""),k=new Intl.NumberFormat(n,{style:"currency",currency:s}),N=e.some(S=>Rl(S)!==null),$=e.some(S=>S.status==="partially_refunded"),D=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(te.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,j=h.useMemo(()=>{const S=y.trim().toLowerCase();if(!S)return e;const M=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(E=>{const A=E.status??"scheduled";return[mn(E),E.id,E.amount,E.dueDate,$s(E.dueDate,n),fn(E,g.paidOn,n),pn(E,g.refundedAmount,M),A,xn(A,g.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[n,s,e,y,g.paidOn,g.refundedAmount,g.partiallyRefunded]),L=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:y,placeholder:g.searchPlaceholder,onChange:S=>w(S.target.value),startContent:t.jsx(P,{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(P,{icon:"solar:pen-outline",className:"size-4"}),isLoading:p,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",j.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((S,M)=>{const E=S.status??"scheduled",A=mn(S),R=fn(S,g.paidOn,n),T=pn(S,g.refundedAmount,k);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:A||`PMT-${M+1}`})]}),t.jsx(Ar,{status:E,label:xn(E,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:k.format(S.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:$s(S.dueDate,n)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(Er,{status:E,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:x,onDeleteInstallment:f})]})},S.id)}),j.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",j.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:N?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:$?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children: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:[j.map((S,M)=>{const E=S.status??"scheduled",A=mn(S),R=fn(S,g.paidOn,n),T=pn(S,g.refundedAmount,k);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:A||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[k.format(S.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[$s(S.dueDate,n),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ar,{status:E,label:xn(E,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Er,{status:E,installment:S,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:x,onDeleteInstallment:f})})]},S.id)}),j.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":g.title,title:D,children:L},"installment-table")}):L})}function mn(e){return e.name?.trim()||e.id}function fn(e,s,n){return!St(e.status)||!e.fulfilledAt?null:`${s} ${$s(e.fulfilledAt,n)}`}function Rl(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function pn(e,s,n){const a=Rl(e);return a===null?null:`${s} ${n.format(a)}`}function xn(e,s){return e==="partially_refunded"?s:_l[e]??e}function Ar({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",$r[e]??$r.scheduled),startContent:t.jsx(jp,{status:e}),children:s})}function Er({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=St(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(P,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(s),children:n.payNow}):null,t.jsx(vp,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function vp({isFulfilled:e,showDelete:s,labels:n,portalContainer:a,onDelete:r}){const[i,o]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(P,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(P,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(P,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(da,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(P,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:bp,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function jp({status:e}){return e==="paid"?t.jsx(P,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(P,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(P,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(P,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(P,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(P,{icon:"solar:calendar-outline",className:"size-3"})}const wp=/^\d{4}-\d{2}-\d{2}$/;function $s(e,s){const n=wp.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const Np={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},Cp=({cards:e,locale:s,currency:n,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:p,className:m=""})=>{const x=Array.isArray(e)?e:[],[f,b]=h.useState(l),[v,g]=h.useState(o),y={...Np,...r};h.useEffect(()=>{b(l)},[l]);const w=N=>{if(N===f){d&&p?.(N);return}b(N),p?.(N)},k=N=>{g(N),u?.(N)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:y.title}),i&&t.jsx(Bl,{title:y.renewalTitle,description:y.renewalDescription,value:v,onValueChange:k}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:x.map(N=>t.jsx(Ml,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:s,currency:n,isSelected:f===N.id,onSelect:w},N.id))})]})},Ml=({itemKey:e,name:s,type:n,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:p=!1,disabledReason:m,statusLabel:x,statusTone:f="default",className:b=""})=>{const v=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),g=!!d&&!p,y=m||x,w=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:w,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",p?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":l,isDisabled:p,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),n&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:n})}),y&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:y})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},Dr="w-full bg-gray-100",Lr={variant:"light",color:"default"},Pl=({id:e,title:s,media:n,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:p,onPress:m,isPressable:x=!1,isDisabled:f=!1,compact:b=!1,className:v="",bodyClassName:g="",footerClassName:y="",dataTestId:w})=>{const k=!!(d&&d.value),N=!!u?.label,$=x&&!!m&&!N,D=!$,j=N?{variant:u?.variant??Lr.variant,color:u?.color??Lr.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(P,{icon:u.icon,width:16}):void 0}:null,L=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,Dr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,Dr,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(P,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":w||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",v),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),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:s}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((S,M)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(P,{icon:S.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:S.label})]},`${S.label}-${M}`))}):null,(k||N)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",y),children:[k?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}),N&&D?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:j?.variant,color:j?.color,size:j?.size,startContent:j?.startContent,isDisabled:j?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),p?t.jsx("div",{className:"pt-1",children:p}):null]})]})};Pl.displayName="CatalogItemCard";const kp={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Tl({title:e,subtitle:s,price:n,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(P,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:kp[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}Tl.displayName="ProgramListItem";const Sp={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},$p={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Ap={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Ep={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Dp={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},Lp={card:"mt-1",panel:"mt-[22px]"},Fp="bg-acct-page border-acct-border text-acct-muted",_p={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Rp={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"},Mp={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"},Pp={empty:"status",error:"alert",success:"status",loading:"status"},Tp={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Ip(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:_p[e];return r?t.jsx(P,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function Il({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=Pp[e],ariaLive:d=Tp[e],iconSize:u=24,className:p,classNames:m={},"data-testid":x="feedback-state",referenceCode:f,referenceCodeLabel:b="Reference code:"}){const v=Ip(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",Sp[s],s==="card"?Rp[e]:"bg-transparent",p,m.base),children:[v?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",$p[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?Fp:Mp[e],m.iconWrapper),children:v}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${x}-title`,className:c.cn(Ap[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(Ep[s],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${x}-reference-code`,className:c.cn(Dp[s],m.referenceCode),children:[b," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),o?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Lp[s],m.actions),children:o}):null]})}function us(e){return t.jsx(Il,{...e})}function ua(e){return t.jsx(us,{...e,variant:"empty"})}function ma(e){return t.jsx(Il,{...e,variant:"error"})}function fa(e){return t.jsx(us,{...e,variant:"loading"})}function Ol(e){return t.jsx(us,{...e,variant:"success"})}us.displayName="FeedbackState";ua.displayName="EmptyState";ma.displayName="ErrorState";fa.displayName="LoadingState";Ol.displayName="SuccessState";const Bl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},Op={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"},Bp=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),zl=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),zp=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),pa=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),Fr=(e,s,n)=>{const a={};let r=n?s??zp(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of pa(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},_r=(e,s,n)=>`${e}::${s}::${n}`,Vp=(e,s,n)=>{const a=zl(s);for(const{exhibition:r,dateGroup:i,ticket:o}of pa(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},Up=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),p=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},x=()=>{r||i<=s||a?.(i-1)},f=N=>{if(r)return;l(N.target.value);const $=parseInt(N.target.value,10);isNaN($)||a?.(Math.max(s,Math.min(n,$)))},b=N=>{const $=parseInt(N.target.value,10);if(u(!1),isNaN($)){a?.(s);return}const D=Math.max(s,Math.min(n,$));D!==$?a?.(D):l(String(D))},v=i<=s,g=i>=n,y="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",w="bg-primary hover:bg-primary/80",k="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:x,disabled:r||v,className:c.cn(y,r||v?k:w),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:p,onChange:f,onFocus:()=>u(!0),onBlur:b,disabled:r,min:s,max:n,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||g,className:c.cn(y,r||g?k:w),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Hp=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Wp=({item:e,quantity:s,onChange:n,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",p=Bp(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:p.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:p.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(Up,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},qp=({exhibitionId:e,dateGroup:s,isLast:n=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!n&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,p)=>t.jsxs("div",{children:[t.jsx(Wp,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),p<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Gp=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,p]=h.useState(d),m=s.dates.reduce((f,b)=>f+b.tickets.reduce((v,g)=>v+a(s.id,b.id,g.id),0),0),x=s.dates.some(f=>f.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>p(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(P,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:x?s.dates.map((f,b)=>t.jsx(qp,{exhibitionId:s.id,dateGroup:f,isLast:b===s.dates.length-1,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},f.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Kp=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...Op,...n},[u,p]=h.useState(()=>Fr(l,s,!0)),m=h.useRef(!1),x=h.useMemo(()=>{const w=pa(l).map(({exhibition:k,dateGroup:N,ticket:$})=>[_r(k.id,N.id,$.id),$]);return new Map(w)},[l]),f=Vp(l,u,s),b=(w,k,N)=>u[w]?.[k]?.[N]?.selectedQuantity??0,v=()=>zl(u),g=(w,k,N,$)=>{const D=b(w,k,N),j=v()-D;if(s!==void 0&&j+$>s)return;const L=x.get(_r(w,k,N));if(!L)return;const S={...u,[w]:{...u[w],[k]:{...u[w]?.[k],[N]:{id:N,selectedQuantity:$,originalPrice:L.originalPrice,discountedPrice:L.price}}}};p(S),o?.(S)},y=w=>{const k=Fr(l,s,w);p(k),o?.(k)};return h.useEffect(()=>{!m.current&&f&&(o?.(u),m.current=!0)},[f,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(Hp,{label:d.selectAllButtonLabel,checked:f,onChange:y})]}),l.map(w=>t.jsx(Gp,{title:w.exhibitionName,exhibition:w,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:v,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},w.id))]})},hn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},bn=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},Yp=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},Qp=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Vl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:p,onClear:m,appliedCount:x,countAriaLabel:f,countDisplay:b="badge",confirmLabel:v=hn.confirm,clearLabel:g=hn.clear,isOpen:y,defaultOpen:w=!1,onOpenChange:k,isDisabled:N=!1,closeOnConfirm:$=!0,keepOpenAfterClear:D=!1})=>{const[j,L]=h.useState(w),[S,M]=h.useState(()=>bn(u)),E=y??j,A=x??u.filter(Y=>Qp(Y)).length,R=Y=>{Y&&M(bn(u)),y||L(Y),k?.(Y)},T=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce}))},U=(Y,ce)=>{M(ne=>({...ne,[Y.id]:ce?[ce]:[]}))},G=async()=>{M(bn(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),D||R(!1)},I=async()=>{const Y=Yp(S,u);await p(Y),$&&R(!1)},se=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:ne=>T(Y,ne),children:Y.options.map(ne=>t.jsx(c.Checkbox,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id);const ce=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:ce,onValueChange:ne=>U(Y,ne||null),children:Y.options.map(ne=>t.jsx(c.Radio,{value:ne.value,isDisabled:ne.isDisabled,children:ne.label},ne.value))},Y.id)},q=h.useMemo(()=>A>0?f?.(A)||`${A} filters applied`:void 0,[f,A]),Q=h.useMemo(()=>A===0?e||hn.noLabel:f?f(A):`${e} (${A})`,[A,e,f]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:E,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(P,{icon:n,width:16}),t.jsx("span",{children:e}),b==="badge"&&A>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":q,children:A}):b==="summary"&&Q!==e?t.jsx("span",{className:"text-xs",children:Q}):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=>se(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:G,children:g}),t.jsx(O,{color:"primary",size:"sm",onPress:I,children:v})]})]})})]})})};Vl.displayName="FilterPopover";const Zp="No sessions available for this date",Xp=e=>e==="sold-out"||e==="closed"?"danger":"success",Jp=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Rr=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",ex=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,Ul=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Zp,statusLabel:u,statusTone:p,sessionAriaLabel:m,dayButtonClassName:x,calendarSlot:f,dayGroupAriaLabel:b,sessionGridAriaLabel:v,className:g,headingClassName:y,subheadingClassName:w})=>{const k=ex(n,a),N=n.find(S=>S.date===k),$=i??n.map(S=>({date:S.date,label:S.label})),D=N?.sessions??[],j=S=>S===k?"solid":"bordered",L=S=>{if(!Rr(S)){if(S.id===o){l(null);return}l(S.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",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",y),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",w),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[$.map(S=>t.jsx(O,{size:"sm",variant:j(S.date),color:"default",className:c.cn("rounded-full",x),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":v||"Sessions",children:[D.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,D.map(S=>{const M=Rr(S),E=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{L(S)},"aria-disabled":M,"aria-pressed":M?void 0:E,className:c.cn("w-full",M?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:E,isUnavailable:M}):M?`${S.startTime} ${S.endTime} sold out`:`${S.startTime} ${S.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[S.startTime," – ",S.endTime]}),t.jsx(c.Chip,{size:"sm",color:p?p(S):Xp(S.status),variant:"flat",children:u?u(S):Jp(S)})]})})},S.id)})]})]})};Ul.displayName="SessionTimeline";const Pn=16,mt=e=>`${e/Pn}rem`;function tx(){if(typeof document>"u"||typeof getComputedStyle!="function")return Pn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Pn}const ms=(e,s)=>e>=s*tx(),sx=1120;function zt(){const e=h.useRef(null),[s,n]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:s}}const nx=48,tt={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"},ax=(e,s)=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,Hl=({title:e,subtitle:s,eyebrow:n,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:p,narrow:m,headerRef:x})=>{const f=ax(a,r);return t.jsxs("header",{ref:x,"data-testid":u,"data-variant":p?"list":void 0,"data-size":p?m?"narrow":"wide":void 0,className:c.cn(p?c.cn(tt.base,m?tt.baseNarrow:tt.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:p?tt.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{className:p?tt.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(p?m?tt.titleNarrow:tt.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(p?m?tt.subtitleNarrow:tt.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(p?m?tt.actionsNarrow:tt.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},rx=e=>{const{ref:s,width:n}=zt(),a=n>0&&!ms(n,nx);return t.jsx(Hl,{...e,list:!0,narrow:a,headerRef:s})},Wl=e=>e.variant==="list"?t.jsx(rx,{...e}):t.jsx(Hl,{...e,list:!1,narrow:!1});Wl.displayName="PageHeader";const Je={ok:{fg:de.ok,bg:de["ok-fill"]},warn:{fg:de.warn,bg:de["warn-fill"]},danger:{fg:de.danger,bg:de["danger-fill"]},info:{fg:de.info,bg:de["info-fill"]},violet:{fg:de.violet,bg:de["violet-fill"]},neutral:{fg:de.neutral,bg:de["neutral-fill"]}};function fs(e){if(e==="positive")return{color:de.ok};if(e==="negative")return{color:de.danger}}const ix={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Tn={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:Je.info,violet:Je.violet},lx={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},ox={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]"},cx={info:Tn.info,violet:Tn.violet},ql=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Je[lx[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",ox[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=Tn[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:cx[e];return t.jsx(c.Chip,{color:r??ix[e],variant:n,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};ql.displayName="StatusChip";const dx={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"},gs={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"},Gs=({label:e,value:s,size:n="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(gs.base,gs[n],r),children:[t.jsx("span",{className:gs.label,children:e}),t.jsx("span",{className:gs.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",dx[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Gs.displayName="KeyValueChip";const Gl=({columns:e,rows:s=6,label:n="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,p)=>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,x)=>{const f=x===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:c.cn(Ns,l.bar),style:{height:mt(a),width:m==="fill"?"60%":mt(m),maxWidth:"100%"}})},x)})},p):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,x)=>{const f=x===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",Hn,l.bar),style:{height:a,width:m==="fill"?"60%":m}})},x)})},p))})]});Gl.displayName="TableSkeleton";const xa="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",ha="px-4 text-[13.5px] text-acct-ink2 align-middle",ba="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",ga="w-full",Kl="border-t border-acct-border px-5 py-3.5",ys={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 ${ke}`,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"},Yl=({columns:e,children:s,emptyContent:n,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&ys.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(ea,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(ga,l.table),th:c.cn(u?ys.th:xa,l.th),tr:c.cn(u?ys.tr:ba,l.tr),td:c.cn(u?ys.td:ha,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:p=>t.jsx(c.TableColumn,{align:p.align==="right"?"end":"start",width:p.width,children:p.label},p.key)}),t.jsx(c.TableBody,{emptyContent:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Kl,l.footer),children:a}):null]})};Yl.displayName="AdminTable";const ux={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},ya=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(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",ux[s]),children:r.icon},r.key))});ya.displayName="RowActions";const mx=Le.palettes.warning[50],fx="solar:alt-arrow-down-outline",px="solar:pen-2-outline",xx={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},Ne={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:ga,th:xa,alignRight:"text-right",thActions:"w-px",row:ba,rowOpen:"bg-acct-page hover:bg-acct-page",td:c.cn(ha,"py-3"),tdActions:"w-px whitespace-nowrap py-2 pl-2 pr-3 align-middle",actions:"flex items-center justify-end gap-0.5",toggle:"gap-1.5 text-acct-ink2 data-[hover=true]:bg-acct-hair",toggleOpen:"bg-acct-surface shadow-sm ring-1 ring-acct-border data-[hover=true]:bg-acct-surface",chevron:`size-4 shrink-0 transition-transform duration-150 ${ke}`,chevronOpen:"rotate-180",panelRow:"bg-acct-page",panelCell:"px-4 pb-4 pt-0",panel:"rounded-xl border border-acct-border bg-acct-surface p-4 shadow-sm",panelTitle:"mb-4 flex items-center gap-1.5 border-b border-acct-hair pb-3 text-xs font-semibold uppercase tracking-wide text-acct-sub",panelTitleIcon:"size-3.5 shrink-0",panelFooter:"mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-acct-hair pt-3",done:"border-acct-border bg-acct-surface",empty:"px-4 py-10 text-center text-sm text-acct-sub"},hx=new Set(["text","search","email","tel","url","number","password"]);function bx(e){return e instanceof HTMLInputElement&&hx.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function Mr(e){return c.cn(e.align==="right"&&Ne.alignRight,e.hideBelow&&xx[e.hideBelow])}function Ql({ariaLabel:e,columns:s,rows:n,getRowKey:a,getRowLabel:r,renderCell:i,renderExpanded:o,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:p,defaultExpandedKeys:m,onExpandedChange:x,labels:f,emptyContent:b,className:v,"data-testid":g="expandable-table"}){const y=h.useId(),w=p!==void 0,[k,N]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>w?new Set(p):k,[w,p,k]),D=h.useRef(new Map),j=h.useRef(null),L=(E,A,R)=>{if($.has(E)===A)return;const T=new Set($);A?T.add(E):T.delete(E),w||N(T),x?.(T,{key:E,expanded:A,reason:R})};h.useLayoutEffect(()=>{const E=j.current;if(E===null||$.has(E))return;j.current=null;const A=document.activeElement;(A===null||A===document.body)&&D.current.get(E)?.focus()});const S=E=>A=>{if(A.defaultPrevented||A.nativeEvent.isComposing)return;const R=A.key==="Escape"?"escape":A.key==="Enter"&&bx(A.target)?"enter":null;R!==null&&(A.preventDefault(),A.stopPropagation(),L(E,!1,R))},M=s.length+1;return t.jsx("div",{"data-testid":g,className:c.cn(Ne.root,v),children:t.jsxs("table",{"aria-label":e,className:Ne.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[s.map(E=>t.jsx("th",{scope:"col",className:c.cn(Ne.th,Mr(E)),style:E.width===void 0?void 0:{width:E.width},children:E.label},E.key)),t.jsx("th",{scope:"col",className:c.cn(Ne.th,Ne.thActions),children:t.jsx("span",{className:"sr-only",children:f.actions})})]})}),n.length===0&&re(b)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:Ne.empty,"data-testid":`${g}-empty`,children:b})})}):null,n.map((E,A)=>{const R=a(E),T=$.has(R),U=u?.(E)??!1,G=f.toggleRow(r(E)),I=`${y}-panel-${A}`,se=d?.(E,A)??[],q={rowIndex:A,close:()=>L(R,!1,"done")};return t.jsxs("tbody",{"data-testid":`${g}-row-${R}`,"data-expanded":T?"true":"false","data-needs-fix":U?"true":void 0,children:[t.jsxs("tr",{className:c.cn(Ne.row,T&&Ne.rowOpen),style:U&&!T?{backgroundColor:mx}:void 0,children:[s.map(Q=>t.jsx("td",{className:c.cn(Ne.td,Mr(Q)),children:i(E,Q.key,A)},Q.key)),t.jsx("td",{className:Ne.tdActions,children:t.jsxs("div",{className:Ne.actions,children:[t.jsx(O,{ref:Q=>{Q?D.current.set(R,Q):D.current.delete(R)},variant:"light",color:"default",size:"sm",testId:`${g}-toggle-${R}`,"aria-label":G,"aria-expanded":T,"aria-controls":T?I:void 0,className:c.cn(Ne.toggle,T&&Ne.toggleOpen),endContent:t.jsx(P,{"aria-hidden":!0,icon:fx,className:c.cn(Ne.chevron,T&&Ne.chevronOpen)}),onPress:()=>L(R,!T,"toggle"),children:f.toggle}),se.length>0?t.jsx(ya,{actions:se,"data-testid":`${g}-actions-${R}`}):null]})})]}),T?t.jsx("tr",{className:Ne.panelRow,children:t.jsx("td",{colSpan:M,className:Ne.panelCell,children:t.jsxs("div",{role:"region",id:I,"aria-label":G,"data-testid":`${g}-panel-${R}`,className:Ne.panel,onKeyDown:S(R),onFocus:()=>{j.current=R},onBlur:Q=>{const Y=Q.relatedTarget;Y&&!Q.currentTarget.contains(Y)&&(j.current=null)},children:[re(f.panelTitle)?t.jsxs("p",{className:Ne.panelTitle,children:[t.jsx(P,{"aria-hidden":!0,icon:px,className:Ne.panelTitleIcon}),f.panelTitle]}):null,o(E,q),t.jsxs("div",{className:Ne.panelFooter,children:[l?.(E,q),t.jsx(O,{variant:"bordered",color:"default",size:"sm",testId:`${g}-done-${R}`,className:Ne.done,onPress:q.close,children:f.done})]})]})})}):null]},R)})]})})}Ql.displayName="ExpandableTable";const gx=os["--warn"],Pr={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function va({label:e,className:s,"data-testid":n="needs-fix-dot"}){return t.jsxs("span",{"data-testid":n,className:c.cn(Pr.root,s),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${n}-mark`,className:Pr.dot,style:{backgroundColor:gx}}),t.jsx("span",{className:"sr-only",children:e})]})}va.displayName="NeedsFixDot";function yx(e,s){return e.find(n=>n.needsFix&&!n.isDisabled)?.key??s}const Yt={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"},vx={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},jx=48,lt={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"},Tr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},Ps={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Ir={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Or={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Zl=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const p=h.useRef(null),m=o==="lg",x=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),p.current?.focus()},className:c.cn(Ir.button,Or[o].button),testId:`${l}-search-clear`,children:t.jsx(P,{icon:"lucide:x","aria-hidden":"true",className:Or[o].icon})}):void 0;return t.jsx(c.Input,{ref:p,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:x,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&Ps.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&Ps.input,r&&Ir.input)}})},wx=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:p,className:m,"data-testid":x="admin-toolbar"})=>{const{ref:f,width:b}=zt(),v=b>0&&!ms(b,jx),g=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":x,"data-variant":"framed","data-size":v?"narrow":"wide",className:c.cn(lt.base,v&<.narrow,m),children:[l,t.jsx("div",{"data-testid":`${x}-search-slot`,className:g?lt.searchFill:v?lt.searchNarrow:lt.searchWide,children:t.jsx(Zl,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:x,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-search-icon`,className:c.cn(lt.icon,p==="lg"&&Ps.icon),children:r??t.jsx(P,{icon:"lucide:search"})}),classNames:{base:g?Tr.fill:v?lt.inputBaseNarrow:Tr[u],inputWrapper:lt.inputWrapper,innerWrapper:lt.innerWrapper,input:lt.input}})}),d]})},Xl=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:p="md",variant:m="default",className:x,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(wx,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:p,className:x,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn(Yt.base,x),children:[t.jsx(Zl,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Yt.icon,p==="lg"&&Ps.icon),children:r}):void 0,classNames:{base:vx[u],inputWrapper:Yt.inputWrapper,input:Yt.input}}),l,d?t.jsx("div",{className:Yt.trailing,children:d}):null]});Xl.displayName="AdminToolbar";const Nx="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",Cx="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",kx="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",Jl=h.forwardRef(function({icon:s,children:n,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(P,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Cx,children:a})]}):t.jsxs(O,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(kx,i),...l,children:[t.jsx(P,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Nx,children:a})]})});Jl.displayName="ToolbarButton";const gn="w-full mb-4 border-b border-pos-line",yn=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",ke].join(" "),Sx={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${ke}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${ke}`},lg:{base:gn,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${yn} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${ke}`},"sm-primary":{base:gn,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${yn} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${ke}`},"sm-secondary":{base:gn,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${yn} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${ke}`}},Br={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},$x="inline-flex items-center gap-1.5",Ax="data-[animated=true]:transition-none";function eo({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",showDivider:o=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const p=Bs(),m=Sx[r==="sm"?`sm-${i}`:r],x=r!=="md",f=e.filter(b=>b.isDisabled).map(b=>b.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:b=>n(String(b)),disabledKeys:f,disableCursorAnimation:x,"data-testid":u,"data-size":r,classNames:{...m,base:c.cn(m.base,!o&&Br.base,d),tabList:c.cn(m.tabList,!o&&Br.tabList),cursor:c.cn(m.cursor,p&&Ax),panel:"p-0"},children:e.map(b=>{const v=`${u}-${b.key}`;return t.jsx(c.Tab,{title:b.needsFix?t.jsxs("span",{className:$x,children:[b.label," ",t.jsx(va,{label:l??"","data-testid":`${v}-needs-fix`})]}):b.label,titleValue:b.hint,"data-testid":v,"data-needs-fix":b.needsFix?"true":void 0,children:b.content},b.key)})})}eo.displayName="UnderlineTabs";const ja="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",to="font-normal normal-case tracking-normal",so="ms-0.5 text-acct-danger",no="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",ao="after:content-none",ro="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",io="size-4",lo="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",oo=["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(" "),co="text-[13.5px] text-acct-ink",uo="bg-acct-page text-acct-muted cursor-default",mo="mt-[5px] text-xs text-acct-sub",fo="mt-[5px] text-xs text-acct-danger";function Ex({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:so,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function Dx({help:e,label:s,labelledBy:n,testId:a}){const r=s?{"aria-label":s}:{"aria-labelledby":n};return t.jsxs(c.Popover,{placement:"top",showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:a,className:ro,children:t.jsx(P,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:io})})}),t.jsx(c.PopoverContent,{...r,"data-testid":`${a}-content`,className:lo,children:e})]})}function po(e,s,n,a){return t.jsxs(t.Fragment,{children:[e,s?t.jsxs("span",{className:to,children:[" ",s]}):null,n?t.jsx(Ex,{label:a}):null]})}const wa=({children:e,suffix:s,htmlFor:n,id:a,isRequired:r,requiredLabel:i,help:o,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const p=h.useId(),m=po(e,s,r,i),x=re(o),f=a??(x?p:void 0);return t.jsxs("div",{"data-testid":u,className:c.cn(ja,d),children:[n?t.jsx("label",{id:f,htmlFor:n,children:m}):f?t.jsx("span",{id:f,children:m}):m,x&&f?t.jsx(Dx,{help:o,label:l,labelledBy:f,testId:`${u}-help`}):null]})};wa.displayName="AdminFieldLabel";const xo=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:p=!1,isRequired:m=!1,requiredLabel:x,help:f,helpLabel:b,className:v,"data-testid":g="admin-text-field"})=>{const y=h.useId(),w=h.useId(),k=re(e),N=k&&re(f),$=t.jsx(c.Input,{labelPlacement:k&&!N?"outside":void 0,label:k&&!N?po(e,s,m,x):void 0,id:N?y:void 0,"aria-labelledby":N?w:void 0,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:p,isRequired:k&&m,validationBehavior:"aria",description:!p&&u?u:void 0,errorMessage:p?u:void 0,onValueChange:a,"data-testid":g,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",!N&&v),label:c.cn(ja,ao),inputWrapper:oo,input:c.cn(co,(l||o)&&"font-mono",o&&uo),description:mo,errorMessage:fo}});return N?t.jsxs("div",{className:c.cn("w-full",v),children:[t.jsx(wa,{id:w,htmlFor:y,suffix:s,isRequired:m,requiredLabel:x,help:f,helpLabel:b,className:no,"data-testid":`${g}-label`,children:e}),$]}):$};xo.displayName="AdminTextField";const Lx=1440,yt=e=>String(e).padStart(2,"0"),ho=e=>e.toLowerCase().replace(/[\s.]/g,"");function Ts(e){const[s=0,n=0]=e.split(":").map(Number);return s*60+n}function Fx(e){return`${yt(Math.floor(e/60))}:${yt(e%60)}`}function In(e){const s=/^(\d{1,2}):?(\d{2})?(?:(a|p)m?)?$/.exec(ho(e));if(!s)return null;let n=Number(s[1]);const a=Number(s[2]??0),r=s[3];if(a>59)return null;if(r){if(n<1||n>12)return null;n=n%12+(r==="p"?12:0)}else{if(n>23)return null;n>=1&&n<=6&&(n+=12)}return`${yt(n)}:${yt(a)}`}function _x(e,s,n){const a=Math.floor(n);if(!(a>=1))return[];const r=[],i=Math.min(Ts(s),Lx-1);for(let o=Ts(e);o<=i;o+=a)r.push(Fx(o));return r}function zr(e,s){return s.includes(":")?e.startsWith(s):e.replace(":","").startsWith(s)}function Rx(e,s){const n=/^([\d:]*)(?:(a|p)m?)?$/.exec(ho(s));if(!n)return!1;const[,a="",r]=n,[i=0,o=0]=e.split(":").map(Number),l=`${i%12||12}:${yt(o)}`;return r?r==="p"!=i>=12?!1:zr(l,a):[l,`${yt(i)}:${yt(o)}`,`${i}:${yt(o)}`].some(d=>zr(d,a))}const Vr=new Map;function Ur(e,s){let n=Vr.get(s);n||(n=new Intl.DateTimeFormat(s,{hour:"numeric",minute:"2-digit"}),Vr.set(s,n));const[a=0,r=0]=e.split(":").map(Number);return n.format(new Date(2e3,0,1,a,r)).replace(/[\u00a0\u202f]/g," ")}const Qt=(e,s)=>s===void 0||Ts(e)>=Ts(s);function bo({value:e,defaultValue:s=null,onChange:n,label:a,"aria-label":r,placeholder:i,emptyContent:o,invalidMessage:l,minTime:d,minTimeMessage:u,listStart:p="07:00",listEnd:m="21:00",listStep:x=30,locale:f="en-US",isRequired:b=!1,isDisabled:v=!1,isInvalid:g=!1,errorMessage:y,isClearable:w=!1,clearLabel:k,onBlur:N,size:$,variant:D="bordered",labelPlacement:j="outside-top",className:L,inputProps:S,popoverProps:M,"data-testid":E="time-field"}){const[A,R]=Ot(e,s,n),T=J=>J?Ur(J,f):"",U=T(A),[G,I]=h.useState(U),[se,q]=h.useState(null),[Q,Y]=h.useState(!1),[ce,ne]=h.useState(U);U!==ce&&(ne(U),I(U),q(null));const X=G.trim()!==""&&G!==U,ie=X?In(G):null,V=X?"typed":G.trim()===""&&!Q?"none":"all",z=X?G:"",Z=h.useMemo(()=>_x(p,m,x),[p,m,x]),Ie=h.useMemo(()=>{const J=Z.filter(F=>Qt(F,d));let C;if(V==="typed"){const F=J.filter(W=>Rx(W,z)),_=In(z);C=_!==null&&Qt(_,d)?[_,...F.filter(W=>W!==_)]:F}else V==="none"?C=[]:A!==null&&Qt(A,d)&&!J.includes(A)?C=[...J,A].sort():C=J;return C.map(F=>({key:F,label:Ur(F,f)}))},[Z,d,V,z,A,f]),Fe=h.useCallback(J=>t.jsx(c.AutocompleteItem,{textValue:J.label,"data-testid":`${E}-option-${J.key}`,children:J.label},J.key),[E]),_e=!X&&A!==null&&Ie.some(J=>J.key===A)?A:null,ae=J=>{q(null),R(J),I(T(J))},je=()=>{if(G.trim()===""){w?ae(null):(I(U),q(null));return}X&&(ie===null?q("invalid"):Qt(ie,d)?ae(ie):q("min"))},Re=h.useRef(!1),et=J=>{J!==null&&(Re.current=!0,queueMicrotask(()=>{Re.current=!1}),ae(String(J)))},ge=A!==null&&!Qt(A,d),Me=se??(ge?"min":null),ue=Me!==null||g,ye=Me==="invalid"?l:Me==="min"?u??l:y;return t.jsx(c.Autocomplete,{label:a,"aria-label":r,labelPlacement:j,placeholder:i,size:$,variant:D,className:L,"data-testid":E,allowsCustomValue:!0,isClearable:w,onClear:w?()=>ae(null):void 0,clearButtonProps:w&&k?{"aria-label":k}:void 0,isRequired:b,isDisabled:v,isInvalid:ue,errorMessage:ue?ye:void 0,validationBehavior:"aria",items:Ie,inputValue:G,onInputChange:J=>{I(J),Y(!1),se&&q(null)},selectedKey:_e,onSelectionChange:et,onOpenChange:(J,C)=>Y(J&&(C==="focus"||C==="manual")),onBlur:J=>{je(),N?.(J)},onKeyDown:J=>{J.key==="Enter"&&!Re.current&&je(),(J.key==="ArrowDown"||J.key==="ArrowUp")&&Y(!0),"continuePropagation"in J&&J.continuePropagation()},inputProps:S,popoverProps:M,listboxProps:{emptyContent:o},children:Fe})}bo.displayName="TimeField";const go=({children:e,placeholder:s="Select…",onOpen:n,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":p="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":p,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:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${p}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${p}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};go.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",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Mx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Px={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"}},yo={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"}},Tx={md:void 0,lg:"min-h-12 text-base"},Ix={none:"",sm:"gap-1",md:"gap-2"},vo="m-0 flex list-none flex-col p-0",_t={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"]},jo=h.createContext(!1),Ox=()=>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"})}),Bx=()=>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 zx(e){const s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}const wo=({title:e,subtitle:s,leading:n,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:p,actions:m,actionsLabel:x,actionsIcon:f,size:b,variant:v="plain",isDisabled:g=!1,as:y,className:w,"data-testid":k="entity-row"})=>{const N=h.useContext(jo),$=zs(),D=b??($==="touch"?"lg":"md"),j=yo[D],L=Px[v],S=y??(N?"li":"div"),M=h.useId(),E=h.useId(),A=h.useId(),R=h.useId(),T=i!==void 0||r!==void 0,U=a!==void 0&&a.length>0,G=re(s),I=m!==void 0&&m.length>0,se=typeof e=="string"?e:void 0,q=I&&m.some(z=>re(z.description)),Q=I?m.filter(z=>z.isDisabled===!0&&re(z.description)).map(z=>`${z.label}: ${z.description}`).join(" "):"",Y=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:j.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??se,getInitials:n.initials!==void 0?z=>z:zx,showFallback:n.src!==void 0,classNames:{base:Pe.avatar},"data-testid":`${k}-leading`}):null,ce=t.jsxs(t.Fragment,{children:[Y,t.jsxs("span",{className:Pe.text,children:[t.jsxs("span",{className:Pe.titleLine,children:[t.jsx("span",{id:M,className:c.cn(Pe.title,j.title),title:se,children:e}),U&&t.jsx("span",{id:E,className:Pe.tags,children:a.map(z=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:z.tone??"default",className:Mx[z.tone??"default"],"data-testid":`${k}-tag-${z.key}`,children:z.label},z.key))})]}),G&&t.jsx("span",{id:A,className:c.cn(Pe.subtitle,j.subtitle),children:s})]})]}),ne=[U?E:null,G?A:null].filter(Boolean).join(" "),X={"aria-labelledby":M,"aria-describedby":ne===""?void 0:ne,isDisabled:g,className:c.cn(Pe.pressTarget,L.overlay,j.content)},ie=`${k}-trigger`;let V;return i!==void 0?V=t.jsx(c.Link,{...X,"data-testid":ie,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:ce}):r!==void 0?V=t.jsx(O,{...X,testId:ie,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ce}):V=t.jsx("div",{className:c.cn(Pe.content,j.content),children:ce}),t.jsxs(S,{"data-testid":k,"data-size":D,"data-disabled":g||void 0,className:c.cn(Pe.base,L.row,j.row,T&&!g&&L.hover,w),children:[V,(re(d)||I)&&t.jsxs("div",{className:Pe.side,children:[d,I&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:j.control,variant:"light",color:"default",radius:"full",isDisabled:g,"aria-label":x,"aria-describedby":Q===""?void 0:R,testId:`${k}-menu-trigger`,className:Pe.menuTrigger,children:f??t.jsx(Bx,{})})}),t.jsx(c.DropdownMenu,{"aria-label":x,"data-testid":`${k}-menu`,className:q?Pe.menuWithDescriptions:void 0,disabledKeys:m.filter(z=>z.isDisabled).map(z=>z.key),onAction:z=>{m.find(Z=>Z.key===z)?.onAction()},items:m,children:z=>{const Z=z.isDisabled===!0&&re(z.description);return t.jsx(c.DropdownItem,{textValue:z.label,description:z.description,color:z.tone==="danger"?"danger":"default",className:c.cn(z.tone==="danger"&&Pe.dangerItem,Tx[D],Z&&Pe.menuItemDisabledWithDescription),classNames:{title:Z?Pe.menuItemDimmed:void 0,description:c.cn(Pe.menuItemDescription,j.subtitle)},startContent:Z&&z.icon!==void 0?t.jsx("span",{className:Pe.menuItemDimmedIcon,children:z.icon}):z.icon,"data-testid":z["data-testid"]??`${k}-menu-${z.key}`,children:z.label},z.key)}})]}),Q!==""&&t.jsx("span",{id:R,hidden:!0,"data-testid":`${k}-menu-trigger-description`,children:Q})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Pe.chevron,"data-testid":`${k}-chevron`,children:p??t.jsx(Ox,{})})]})};wo.displayName="EntityRow";const No=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(vo,Ix[a],r),children:t.jsx(jo.Provider,{value:!0,children:e})});No.displayName="EntityList";const Co=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=zs(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=_t;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:vo,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(_t.row,yo[o].row),children:[t.jsx(oe,{className:_t.avatar[o]}),t.jsxs("span",{className:_t.lines,children:[t.jsx(oe,{className:c.cn(_t.title,l[u%l.length])}),t.jsx(oe,{className:_t.subtitle})]})]},u))})]})};Co.displayName="EntityListSkeleton";function ko(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const So=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:p}=ko(e,s,n),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:p,total:n}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${p}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};So.displayName="PaginationSummary";const Ks="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",dt={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"},Vx={card:Ks,flat:""},Ux={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]"},Hx={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:""}},$o=({isLoading:e=!1,isError:s=!1,isEmpty:n=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:p,emptyTitle:m="Nothing here yet",emptyDescription:x,emptyIcon:f,emptyActions:b,emptyContent:v,children:g,toolbar:y,variant:w="default",className:k,classNames:N={},"data-testid":$="list-panel"})=>{const D=w==="framed",j={base:c.cn("border-0 bg-transparent py-12",N.state)},L=D?{base:c.cn("px-6 py-[3.625rem]",N.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:j;let S;return e?S=r??t.jsx(fa,{title:a,classNames:j,"data-testid":`${$}-loading`}):s?S=p??t.jsx(ma,{title:i,description:o,classNames:j,"data-testid":`${$}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?S=v??t.jsx(ua,{surface:D?"panel":void 0,title:m,description:x,icon:f,actions:b,classNames:L,"data-testid":`${$}-empty`}):S=g,t.jsxs("section",{"data-testid":$,"data-variant":D?"framed":void 0,className:c.cn(D?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Ks}`:"rounded-xl bg-white p-2 shadow-sm",k,N.base),children:[y,S]})};$o.displayName="ListPanel";const Na=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),ls=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},Ao=(e,s)=>{const[n,a]=h.useState(()=>s(e)),r=(ls(n)??0)===(e??0)?n:s(e),i=h.useCallback(()=>{a(o=>{const l=ls(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},Wx=/^[\d.,]+$/,Eo=(e,s=Object.is)=>{const n=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{n.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=h.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},Do=(e,s)=>{const n=h.useRef(null),a=h.useRef(s);return h.useLayoutEffect(()=>{a.current=s},[s]),h.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&Wx.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),n},qx=350,Gx={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}"},Kx=7,Yx=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,Kx),Qx=(e,s,n)=>{if(!Number.isInteger(e))return xe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return xe(e,s,n)}},Zx=(e,s)=>(e??0)===(s??0),Zt=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),Xx=({dueAmount:e,received:s,defaultReceived:n=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:p=!1,className:m,"data-testid":x="cash-tender-form"})=>{const f={...Gx,...i},b=Bt(e.currency,r),v=s!==void 0,[g,y]=h.useState(n??null),w=v?s:g,{draft:k,setDraft:N,normalize:$}=Ao(w,V=>V==null?"":String(V)),{isUntouched:D,markEdited:j,markUntouched:L}=Eo(w,Zx),S=h.useMemo(()=>{const V=typeof w=="number"&&Number.isFinite(w)?w:0,z=Dn(V,e.value,e.currency,r);return{received:V,change:z>0?z:0,isValid:V>=e.value&&V>0}},[w,e.value,e.currency,r]),M=h.useCallback(V=>{const z=V.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),E=h.useCallback(V=>{v||y(V);const z=typeof V=="number"&&Number.isFinite(V)?V:0,Z=Dn(z,e.value,e.currency,r);a?.({received:z,change:Z>0?Z:0,isValid:z>=e.value&&z>0})},[v,e.value,e.currency,r,a]),A=h.useCallback(V=>{if(o)return;const z=V.replace(/[^\d.,]/g,"");if(!Na(z,b))return;const Z=ls(z);Z!==null&&l!==void 0&&Z>l||(N(z),j(Z),E(Z))},[o,l,N,j,b,E]),R=Do(D,A),T=h.useMemo(()=>Yx(d),[d]),U=V=>l!==void 0&&V>l,G=()=>{o||U(e.value)||(N(String(e.value)),L(),E(e.value))},I=V=>{if(o)return;const z=D()||typeof w!="number"||!Number.isFinite(w)?0:w,Z=ta(z+V,e.currency,r);U(Z)||(N(String(Z)),j(Z),E(Z))},se=S.isValid&&S.change>0,q=!S.isValid&&S.received>0,Q=xe(S.change,r,e.currency),Y=xe(e.value,r,e.currency),[ce,ne]=h.useState(""),X=h.useRef(null);h.useEffect(()=>{X.current&&clearTimeout(X.current);const V=se?Zt(f.changeMessageTemplate,{change:Q}):"",z=se?qx:0;return X.current=setTimeout(()=>ne(V),z),()=>{X.current&&clearTimeout(X.current)}},[se,Q,f.changeMessageTemplate]);const ie=`${x}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":x,children:[t.jsx(c.Input,{ref:R,id:ie,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:b===0?"numeric":"decimal",pattern:b===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:k,onChange:V=>A(V.target.value),onFocus:M,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:o,isInvalid:q,errorMessage:q?Zt(f.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${x}-received-input`}),T.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${x}-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":Zt(f.exactAmountAriaTemplate,{amount:Y}),onPress:G,"data-testid":`${x}-quick-amount-exact`,children:[f.exactAmountLabel," ",Y]}),T.map(V=>{const z=Qx(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":Zt(f.quickAmountAriaTemplate,{amount:z}),onPress:()=>I(V),"data-testid":`${x}-quick-amount-${V}`,children:z},V)})]})}),se&&t.jsx(c.Alert,{"data-testid":`${x}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Zt(f.changeMessageTemplate,{change:Q}),icon:t.jsx(P,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:ce})]})},Jx={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Hr=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},Lo=({dueAmount:e,value:s,defaultValue:n,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:p=!1,className:m,"data-testid":x="check-tender-form"})=>{const f={...Jx,...r},b=s!==void 0,[v,g]=h.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Hr()}),[y,w]=h.useState(!!n?.checkNumber),k=h.useMemo(()=>b?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Hr()}:v,[b,s,v]),N=h.useCallback(E=>{b||g(E);const A=E.checkNumber.trim(),R={amount:e.value,checkNumber:A,bankName:E.bankName.trim()||void 0,date:i?void 0:E.date,isValid:A.length>0&&e.value>0};a?.(R)},[b,e.value,i,a]),$=h.useCallback(E=>A=>{l||(E==="checkNumber"&&A.length>0&&w(!0),N({...k,[E]:A}))},[k,N,l]),D=h.useCallback(()=>{l||w(!0)},[l]),j=y&&k.checkNumber.trim()==="",L=`${x}-check-number`,S=`${x}-bank-name`,M=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":x,children:[t.jsx(c.Input,{id:L,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:E=>$("checkNumber")(E.target.value),onBlur:D,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:j,errorMessage:j?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${x}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:E=>$("bankName")(E.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:M,label:f.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:E=>$("date")(E.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};Lo.displayName="CheckTenderForm";const eh={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},th=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Fo=({dueAmount:e,methodOptions:s=th,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const p={...eh,...i},m=n!==void 0,[x,f]=h.useState({method:a?.method??"",reference:a?.reference??""}),b=h.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:x,[m,n,x]),v=h.useCallback($=>s.find(D=>D.value===$)?.label??"",[s]),g=h.useCallback($=>{m||f($);const D=v($.method),j={amount:e.value,method:$.method,description:D,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(j)},[m,e.value,r,v]),y=h.useCallback($=>{if(l)return;const D=typeof $=="string"?$:Array.from($)[0]?.toString()??"";g({...b,method:D})},[b,g,l]),w=h.useCallback($=>{l||g({...b,reference:$})},[b,g,l]),k=`${u}-method`,N=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(it,{id:k,label:p.methodLabel,labelPlacement:"outside",placeholder:p.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:y,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map($=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),o&&t.jsx(c.Input,{id:N,label:p.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:$=>w($.target.value),placeholder:p.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Fo.displayName="OtherTenderForm";const sh={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},nh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},ah={pending:"warning",recorded:"success",failed:"danger"},rh=e=>e==="pending"||e==="recorded",ih=e=>`#${e+1}`,_o=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...sh,...r},{collected:p,remaining:m,isComplete:x}=h.useMemo(()=>{const b=s.reduce((g,y)=>rh(y.status)?g+y.amount:g,0),v=Math.max(e.value-b,0);return{collected:b,remaining:v,isComplete:b>=e.value&&e.value>0}},[s,e.value]),f=b=>b==="pending"?u.statusPending:b==="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:x?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(x?p: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:x?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(x?p:m,a,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((b,v)=>t.jsx(lh,{index:v,tender:b,locale:a,currency:e.currency,removable:!!n&&b.status!=="recorded",onRemove:n?()=>n(b.id):void 0,statusLabel:f(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${v}`},b.id))]})]})};_o.displayName="SplitPaymentSummary";const lh=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const p=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(P,{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:ih(e)}),t.jsx(P,{icon:nh[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:ah[s.status],startContent:s.status==="recorded"?t.jsx(P,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(P,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),p&&(r?p:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:p})}))]})},oh=`
|
|
15
|
+
${x?"cursor-default":"cursor-pointer hover:text-primary"}
|
|
16
|
+
`,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(o.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(p.Button,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:c,"aria-label":"Zoom in",children:t.jsx(ee.ZoomIn,{size:16})})})]})}function pd({editor:e,isDisabled:a=!1}){const[s,n]=h.useState(!1),[r,i]=h.useState(""),[c,l]=h.useState(""),[d,u]=h.useState(!1),x=e.isActive("link"),m=f=>{if(f){const{from:g,to:j}=e.state.selection,y=e.isActive("link");let v="";if(y){const S=e.schema.marks.link,k=e.state.doc.resolve(g),$=dn.getMarkRange(k,S);$&&(v=e.state.doc.textBetween($.from,$.to,""))}else v=e.state.doc.textBetween(g,j,"");const C=e.getAttributes("link").href||"";i(v),l(C),u(y)}n(f)},b=()=>{if(c.trim()){const{from:f,to:g}=e.state.selection,j=e.schema.marks.link,y=e.state.doc.resolve(f),v=dn.getMarkRange(y,j),C=v?.from??f,S=v?.to??g,k=e.state.doc.textBetween(C,S,"");r.trim()&&r!==k?e.chain().focus().setTextSelection({from:C,to:S}).deleteSelection().insertContent(`<a href="${c.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:c.trim()}).run()}n(!1)};return t.jsxs(o.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:a,"aria-label":"Link",children:t.jsx(ee.Link,{size:16})})}),t.jsx(o.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(o.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:f=>i(f.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(o.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:c,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&b(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(p.Button,{size:"sm",color:"primary",onPress:b,isDisabled:!c.trim(),children:d?"Update":"Apply"})]})})]})}function hd({children:e,id:a,label:s,className:n,useButtonGroup:r=!0}){return r?t.jsx(o.ButtonGroup,{size:"sm",id:a,"aria-label":s,className:n,children:e}):t.jsx("div",{id:a,role:"group","aria-label":s,className:`flex items-center gap-2 ${n||""}`,children:e})}function Xr(e,a){const s=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(a.map(l=>Zt(l)))).forEach(l=>{const d=ot[l];if(d)try{const u=d.canExecute?.(e)??!0,x=d.isActive?.(e)??!1;i[l]={isActive:x,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,a]),[n,r]=h.useState(s);return h.useEffect(()=>{if(!e)return;const i=()=>{const c={};Array.from(new Set(a.map(d=>Zt(d)))).forEach(d=>{const u=ot[d];if(u)try{const x=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;c[d]={isActive:m,isDisabled:!x,canExecute:x}}catch(x){console.warn(`Extension not available for modifier: ${d}`,x),c[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(c)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,a,s]),n}function Jr(e,a){const s=h.useCallback((c,l)=>{if(!e)return;const d=ot[c];if(d)try{d.execute({editor:e,config:l}),a?.({type:"toggle",modifier:c})}catch(u){console.warn(`Failed to execute command for modifier: ${c}`,u)}},[e,a]),n=h.useCallback(c=>{s(c)},[s]),r=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${c}`,u),!1}},[e]),i=h.useCallback((c,l)=>{if(!e)return!1;const d=ot[c];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${c}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:n,canExecute:r,isActive:i}}function bd(e=Me.default){const[a,s]=h.useState(e),n=h.useCallback((l=Me.step)=>{s(d=>Math.min(Me.max,d+l))},[]),r=h.useCallback((l=Me.step)=>{s(d=>Math.max(Me.min,d-l))},[]),i=h.useCallback(()=>{s(Me.default)},[]),c=h.useCallback(l=>{const d=Math.max(Me.min,Math.min(Me.max,l));s(d)},[]);return{zoom:a,setZoom:c,zoomIn:n,zoomOut:r,resetZoom:i,isMinZoom:a<=Me.min,isMaxZoom:a>=Me.max,isDefaultZoom:a===Me.default}}const gd=["bold","italic","strike","underline","code"];function yd({editor:e,modifiers:a,onToolbarAction:s}){const n=Xr(e,a),{toggleModifier:r}=Jr(e,s);if(!e)return null;const i=a.map(c=>Zt(c)).filter(c=>gd.includes(c));return i.length===0?null:t.jsx(hd,{id:"text-formatting",label:"Text formatting",children:i.map(c=>{const l=n[c],d=Et(c);return t.jsx(gt,{icon:d,label:c.charAt(0).toUpperCase()+c.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(c)},c)})})}function vd({editor:e,modifiers:a,zoom:s=100,onZoomChange:n,sticky:r=!0,className:i,onToolbarAction:c}){const l=Xr(e,a),{toggleModifier:d,executeCommand:u}=Jr(e,c);if(!e)return null;const x=a.map(N=>Zt(N)),m=x.some(N=>["bold","italic","strike","underline","code"].includes(N)),b=x.some(N=>["textColor","highlight"].includes(N)),f=x.includes("heading"),g=x.includes("textAlign"),j=x.some(N=>["bulletList","orderedList","taskList"].includes(N)),y=x.includes("blockquote"),v=x.includes("codeBlock"),C=x.includes("link"),S=x.includes("horizontalRule"),k=x.some(N=>["undo","redo"].includes(N)),$=s!==void 0&&n!==void 0,_=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${_} ${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(yd,{editor:e,modifiers:a,onToolbarAction:c}),(b||f||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("textColor")&&t.jsx(wn,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),x.includes("highlight")&&t.jsx(wn,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(id,{editor:e}),(g||j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(N=>{const F=md[N],A=e.isActive({textAlign:N});return t.jsx(gt,{icon:F,label:`Align ${N}`,isActive:A,onClick:()=>u("textAlign",{type:"textAlign",alignment:N})},N)})}),(j||y||v||C||S||k||$)&&t.jsx(ht,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(ld,{editor:e,types:x.filter(N=>["bulletList","orderedList","taskList"].includes(N))}),(y||v||C||S||k||$)&&t.jsx(ht,{})]}),(y||v||C||S)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[y&&t.jsx(gt,{icon:Et("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),v&&t.jsx(gt,{icon:Et("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),C&&t.jsx(pd,{editor:e,isDisabled:l.link?.isDisabled}),S&&t.jsx(gt,{icon:Et("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(k||$)&&t.jsx(ht,{})]}),k&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("undo")&&t.jsx(gt,{icon:Et("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),x.includes("redo")&&t.jsx(gt,{icon:Et("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(ht,{})]}),$&&t.jsx(xd,{zoom:s,onZoomChange:N=>{n?.(N),c?.({type:"zoom",modifier:`${N}%`})}})]})})}const Pt={bold:{category:"mark",extension:Bo.Bold,priority:100},italic:{category:"mark",extension:Po.Italic,priority:100},strike:{category:"mark",extension:To.Strike,priority:100},underline:{category:"mark",extension:Oo.Underline,priority:100},code:{category:"mark",extension:zo.Code,priority:100},textColor:{category:"mark",extension:Vo.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Uo.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Ho.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:qo.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ko.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Yo.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Zo.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Jo.CodeBlock,priority:100},blockquote:{category:"node",extension:ec.Blockquote,priority:100},horizontalRule:{category:"node",extension:tc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ac.HardBreak,priority:100},undo:{category:"extension",extension:un.History,priority:50},redo:{category:"extension",extension:un.History,priority:50},textAlign:{category:"extension",extension:sc.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}},jd=[nc.Document,rc.Text,Go.Paragraph,Wo.TextStyle.configure({HTMLAttributes:{}}),Xo.ListItem.configure({HTMLAttributes:{}}),Qo.TaskItem.configure({nested:!0}),ic.Dropcursor,lc.Gapcursor];function wd(e){const a=[],s=new Set,n=new Set;jd.forEach(l=>{l&&(a.push(l),n.add(l.name))});const r=e.map(l=>Zt(l)),i=new Set;return r.forEach(l=>{const d=Pt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=Pt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(n.has(u)){s.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(x),s.add(l),n.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=Pt[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(n.has(u)){s.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;a.push(x),s.add(l),n.add(u)}),a.sort((l,d)=>{const u=Object.values(Pt).find(f=>f?.extension?.name===l.name),x=Object.values(Pt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(x?.priority??100)-m})}const ei={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"]},Nd={h1:`font-size: ${ye.fontSize["4xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h2:`font-size: ${ye.fontSize["2xl"]}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h3:`font-size: ${ye.fontSize.xl}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h4:`font-size: ${ye.fontSize.lg}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h5:`font-size: ${ye.fontSize.base}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h6:`font-size: ${ye.fontSize.sm}; font-weight: ${ye.fontWeight.semibold}; line-height: ${ye.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,p:`min-height: ${ye.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${xe.xl}; margin: ${xe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${xe.xl}; margin: ${xe.md} 0;`,li:`display: list-item; margin: ${xe.xs} 0;`,strong:`font-weight: ${ye.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${$e.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ye.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ye.fontFamily.mono};`,pre:`background: ${$e.neutral.gray[800]}; border-radius: ${xe.sm}; color: ${$e.neutral.gray[100]}; font-family: ${ye.fontFamily.mono}; margin: ${xe.lg} 0; padding: 0.75rem ${xe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${$e.neutral.gray[300]}; margin: ${xe.lg} 0; padding-left: ${xe.md}; color: ${$e.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${$e.neutral.gray[200]}; margin: ${xe.xl} 0;`,a:`color: ${$e.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${$e.palettes.warning[200]}; border-radius: ${xe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${xe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},Cd={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 kd(e){if(!e)return e;let a=e;for(const[s,n]of Object.entries(Cd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");a=a.replace(r,(i,c)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${n}"`):`${c} style="${n}">`)}for(const[s,n]of Object.entries(Nd)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");a=a.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 ${n}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${n}'`);{const c=i.indexOf(">");return`${i.slice(0,c)} style="${n}"${i.slice(c)}`}})}return a}const Sd=({modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})=>{const{editor:r}=gs.useCurrentEditor();return t.jsx(vd,{editor:r,modifiers:e,zoom:a,onZoomChange:s,onToolbarAction:n})},$d=({showCharacterCount:e,showWordCount:a})=>{const{editor:s}=gs.useCurrentEditor();if(!s||!e&&!a)return null;const n=s.getText(),r=n.length,i=n.split(/\s+/).filter(c=>c.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"]}),a&&t.jsxs("span",{children:[i," words"]})]})},ls=h.forwardRef((e,a)=>{const{minRows:s=10,maxRows:n=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:c=!1,showToolbar:l=!0,modifiers:d=ei.full,variant:u="bordered",initialContent:x,content:m,onContentChange:b,onUpdate:f,onToolbarAction:g,isReadOnly:j=!1,isDisabled:y=!1,includeInlineStyles:v=!0,...C}=e,{zoom:S,setZoom:k}=bd(),$=jn.lineHeight,_=s*$,N=r?void 0:n*$,F=h.useMemo(()=>wd(d),[d]),{Component:A,label:M,shouldLabelBeOutside:E,getBaseProps:D,getLabelProps:I,getInputWrapperProps:B}=o.useInput({...C,variant:u,ref:a,isMultiline:!0}),V=M?t.jsx("label",{...I(),children:M}):null,q=h.useCallback(({editor:P})=>{const te=P.getHTML(),W=v?kd(te):te,Y=P.getJSON(),K=P.getText(),ie=K.length,ae=K.split(/\s+/).filter(ne=>ne.length>0).length,Q={html:W,json:Y,text:K,characters:ie,words:ae};if(b?.(Q),f?.(Q),"onChange"in C&&typeof C.onChange=="function"){const ne={target:{value:W},currentTarget:{value:W}};C.onChange(ne)}},[b,f,C,v]);return t.jsxs(A,{...D(),children:[E?V:null,t.jsx("div",{...B(),className:o.cn(B().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:N?`${N+jn.toolbarHeight}px`:void 0,overflow:N?"auto":void 0},children:t.jsx(gs.EditorProvider,{editable:!j&&!y,slotBefore:l?t.jsx(Sd,{modifiers:d,zoom:S,onZoomChange:k,onToolbarAction:g}):void 0,slotAfter:t.jsx($d,{showCharacterCount:i,showWordCount:c}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${_}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:F,content:m||x||e.defaultValue||"",onUpdate:q})})]})});ls.displayName="TipTapEditor";const ti=h.forwardRef((e,a)=>{const{adapter:s="tiptap",variant:n="bordered",...r}=e;return s==="tiptap"?t.jsx(ls,{...r,variant:n,ref:a}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(ls,{...r,variant:n,ref:a}))});ti.displayName="RichTextArea";function Nn(e,a="en-US",s="USD",n=!0){try{return new Intl.NumberFormat(a,n?{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:s}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${s} ${e.toFixed(2)}`}}function Ad(e="en-US",a="USD"){try{const s=new Intl.NumberFormat(e,{style:"currency",currency:a,currencyDisplay:"symbol"}),n=s.formatToParts(1),r=n.findIndex(d=>d.type==="currency"),i=n.findIndex(d=>d.type==="integer"),{minimumFractionDigits:c,maximumFractionDigits:l}=s.resolvedOptions();return{symbol:n[r]?.value??a,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:c,maximumFractionDigits:l}}}catch(s){return console.warn(`Invalid currency formatting: ${s}`),{symbol:a,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const Cn=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,kn=`border bg-white shadow-none ${p.stillTransitionClass}`,Dd={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${Cn} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${kn} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${Cn} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${kn} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},Ct={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},Ed={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},Sn=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Ld={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},ai=({presetAmounts:e=Sn,selectedDonation:a,defaultSelectedDonation:s=null,onChange:n,onAddDonation:r,currency:i="USD",locale:c="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:x,mobileColumns:m=2,desktopColumns:b=3,isDisabled:f=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:y="bordered",size:v="md",className:C="",showCard:S=!0,variant:k="pill",customAmountPlacement:$="below",isRequired:_=!1})=>{const N={...Ld,...x},F=h.useId(),A=`${F}-title`,M=`${F}-custom`,E=Array.isArray(e)?e:Sn,D={2:"grid-cols-2",3:"grid-cols-3"},I={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},B=`${D[m]} ${I[b]}`,[V,q]=_t(a,s,n),[P,te]=h.useState(""),[W,Y]=h.useState(!1),[K,ie]=h.useState(0),ae=h.useCallback(se=>{if(f)return;const ge={amount:se.amount,isCustom:!1,presetId:se.id};q(ge),te(""),Y(!1),ie(Ee=>Ee+1),r?.(ge)},[f,q,r]),Q=h.useCallback(se=>{if(f)return;if(te(se!==void 0?String(se):""),r){q(null);return}if(Y(!1),se===void 0||isNaN(se)){q(null);return}q({amount:se,isCustom:!0})},[f,q,r]),ne=h.useCallback(()=>{if(f)return;const se=P!==""?parseFloat(P):void 0;se===void 0||isNaN(se)||r?.({amount:se,isCustom:!0})},[f,P,r]),z=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),O=h.useMemo(()=>Ad(c,i),[c,i]),Z=se=>V!==null&&!V.isCustom&&V.presetId===se.id,Re=(se,ge)=>{const Ee=V?.isCustom===!0,Ze=!r&&W,pe=k==="tile"&&$==="inline",Le=pe?t.jsx("span",{className:Ct.affix,"data-testid":"donation-amounts-custom-symbol",children:O.symbol}):void 0,oe=t.jsxs("div",{className:o.cn("flex items-start gap-3",pe&&Ct.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(o.NumberInput,{id:M,placeholder:N.customAmountPlaceholder,"aria-label":pe?N.customAmountLabel??N.customAmountAriaLabel:N.customAmountLabel?void 0:N.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:()=>Y(!0),onBlur:r?void 0:()=>Y(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:pe?O.formatOptions:z,startContent:O.position==="start"?Le:void 0,endContent:O.position==="end"?Le:void 0,value:P!==""?parseFloat(P):void 0,onValueChange:Q,isDisabled:f,className:"flex-1",classNames:{inputWrapper:o.cn(se.inputWrapper,ge.wrapper,pe&&Ct.inputWrapper,(Ee||Ze)&&se.inputWrapperActive),input:o.cn(se.input,ge.input,pe&&Ct.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:V?.isCustom===!1?V.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",size:v,className:"shrink-0",onPress:ne,isDisabled:f||!W,"data-testid":"donation-amounts-add-button",children:N.addDonationButton})]}),he=l&&(pe?oe:t.jsxs("div",{className:o.cn("flex flex-col",se.inputBase),children:[N.customAmountLabel&&t.jsx("label",{htmlFor:M,className:se.customLabel,"data-testid":"donation-amounts-custom-label",children:N.customAmountLabel}),oe]}));return t.jsxs("div",{className:se.root,"data-testid":"donation-amounts-root","data-variant":k,"data-custom-placement":pe?"inline":void 0,children:[N.eyebrow&&t.jsx("p",{className:se.eyebrow,"data-testid":"donation-amounts-eyebrow",children:N.eyebrow}),N.title&&t.jsxs("p",{id:A,className:se.title,"data-testid":"donation-amounts-title",children:[N.title,_&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),N.caption&&t.jsx("p",{className:se.caption,"data-testid":"donation-amounts-caption",children:N.caption}),(E.length>0||pe&&he)&&t.jsxs("div",{role:"group","aria-labelledby":N.title?A:void 0,"aria-label":N.title?void 0:N.presetsAriaLabel,className:pe?Ct.row:o.cn(se.grid,k==="tile"&&B),"data-testid":"donation-amounts-presets",children:[E.map(X=>{const w=Z(X)&&!Ze;return t.jsxs(p.Button,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":w,className:o.cn(se.preset,pe&&Ct.preset,w?se.presetSelected:se.presetIdle),onPress:()=>ae(X),isDisabled:f,"data-selected":w||void 0,"data-testid":`donation-amounts-preset-${X.id}`,children:[t.jsx("span",{className:o.cn(se.amount,w&&se.amountSelected),children:X.label||Nn(X.amount,c,i,k!=="pos")}),X.sublabel&&" ",X.sublabel&&t.jsx("span",{className:se.sublabel,"data-testid":`donation-amounts-preset-${X.id}-sublabel`,children:X.sublabel})]},X.id)}),pe&&he]}),!pe&&he]})},Ae=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[N.title&&t.jsx("h2",{id:A,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:N.title}),E.length>0&&t.jsx("div",{role:"group","aria-labelledby":N.title?A:void 0,"aria-label":N.title?void 0:N.presetsAriaLabel,className:o.cn("grid gap-3",B),"data-testid":"donation-amounts-presets",children:E.map(se=>{const ge=V!==null&&!V.isCustom&&V.presetId===se.id;return t.jsx(p.Button,{color:ge?"primary":j,variant:ge?"solid":g,className:"w-full","aria-pressed":ge,onPress:()=>ae(se),isDisabled:f,"data-testid":`donation-amounts-preset-${se.id}`,children:se.label||Nn(se.amount,c,i)},se.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(o.NumberInput,{placeholder:N.customAmountPlaceholder,"aria-label":N.customAmountAriaLabel,onInput:r?()=>{q(null),Y(!0)}:void 0,variant:y,radius:"full",size:v,minValue:d,maxValue:u,step:.01,formatOptions:z,value:P!==""?parseFloat(P):void 0,onValueChange:Q,isDisabled:f,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:V?.isCustom===!1?V.presetId:"custom"),r&&t.jsx(p.Button,{color:"primary",variant:"solid",radius:"full",size:v,className:"shrink-0",onPress:ne,isDisabled:f||!W,"data-testid":"donation-amounts-add-button",children:N.addDonationButton})]})]}),De=k==="pill"?Ae:Re(Dd[k],Ed[k][v]);return S?t.jsx(o.Card,{className:o.cn("w-full",C),"data-testid":"donation-amounts-card",children:t.jsx(o.CardBody,{children:De})}):t.jsx("div",{className:o.cn("w-full",C),"data-testid":"donation-amounts-plain",children:De})};ai.displayName="DonationAmounts";const Fd=e=>{const a=Math.max(0,e),s=Math.floor(a/60).toString().padStart(2,"0"),n=(a%60).toString().padStart(2,"0");return`${s}:${n} minutes`},_d=e=>{switch(e){case"warning":return ee.Clock;case"error":return ee.AlertCircle;case"success":return ee.CheckCircle;default:return ee.Clock}},Rd=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"}},si=h.forwardRef(({timeLeft:e,defaultTimeLeft:a=1200,onTimeChange:s,onExpire:n,variant:r="info",color:i="primary",message:c="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:x=!0,formatTime:m=Fd,className:b,...f},g)=>{const[j,y]=_t(e!==void 0?Math.max(0,e):void 0,Math.max(0,a),s),v=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]),h.useEffect(()=>{if(!x||j<=0){v.current&&(clearInterval(v.current),v.current=null);return}return v.current=setInterval(()=>{y(_=>_<=1?(v.current&&(clearInterval(v.current),v.current=null),C.current||(C.current=!0,n?.()),0):_-1)},1e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[x,j,y,n]),h.useEffect(()=>{j>0&&(C.current=!1)},[j]);const S=d||_d(r),k=Rd(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${c} ${m(j)}`,"data-testid":"expire-cart-timer",className:o.cn("w-full text-white z-50",k,$[u],b),...f,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(S,{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:c})]}),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(j)}`,"data-testid":"expire-cart-timer-value",children:m(j)})})]})})})});si.displayName="ExpireCartTimer";const kt=({icon:e,children:a,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(p.Icon,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:a})]}),Id=({classes:e="",name:a,imageUrl:s,eventDate:n,eventTime:r,location:i,description:c,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:x="eager",showMoreButtonClassName:m,labels:b})=>{const[f,g]=h.useState(!1),[j,y]=h.useState(!1),v=h.useRef(null);return h.useEffect(()=>{const C=()=>{if(v.current){const S=v.current.scrollHeight>v.current.clientHeight;y(S)}};return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[c]),u==="horizontal"?t.jsx(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(o.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(o.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${a}`,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:a}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!f&&j&&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"})]}),(j||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!f),variant:"light",className:o.cn("text-primary",m),size:"md",startContent:t.jsx(p.Icon,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})})}):t.jsxs(o.Card,{className:o.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(o.CardHeader,{className:o.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:o.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(o.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${a}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:o.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:a})]}),t.jsxs(o.CardBody,{className:o.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:o.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:b.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[n&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:n}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),c&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:o.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:c}}),!f&&j&&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"})]}),(j||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(p.Button,{onPress:()=>g(!f),variant:"light",className:o.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(p.Icon,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?b.showLess||"Hide":b.showMore||"Show"})})]})]})]})};function os(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function Md(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}const Bd={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"},St=e=>typeof e=="number"&&!isNaN(e),ha=({offer:e,quantity:a,defaultQuantity:s=0,onQuantityChange:n,currency:r="USD",locale:i="en-US",labels:c,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:x="default",showCard:m=!0,showDescription:b=!0,showPeopleCount:f=!0,showPrice:g=!0,priceDisplay:j,classNames:y={},"data-testid":v,selectedColor:C="default",selectionMode:S="stepper",compact:k=!1,isSoldOut:$,isMaxReached:_,isRuleBlocked:N,statusTone:F="default",statusLabel:A,disabledReason:M,disabled:E})=>{const D=h.useMemo(()=>({...Bd,...c}),[c]),[I,B]=h.useState(s),V=a!==void 0?a:I,q=!!(d||E),P=k||!!e.compact,te=S==="press-to-add",W=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!St(e.totalTicketsSold)||!St(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),Y=h.useMemo(()=>typeof _=="boolean"?_:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!St(e.ticketsAllowed)?!1:V>=e.ticketsAllowed-(e.totalTicketsSold??0),[_,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,V]),K=h.useMemo(()=>typeof N=="boolean"?N:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[N,e.isRuleBlocked]),ie=M||e.disabledReason,ae=q||W||K,Q=oe=>{if(ae||oe>0&&Y)return;const he=Math.max(0,V+oe);a===void 0&&B(he),n?.(e.id,he)},ne=h.useMemo(()=>{if(W)return"soldOut";if(K)return"ruleBlocked";if(q)return"disabled"},[W,K,q]),z=h.useMemo(()=>F||(W||K?"danger":Y?"warning":"default"),[F,W,K,Y]),O=h.useMemo(()=>{if(ne)return ne==="ruleBlocked"?A||ie||D.ruleBlocked:ne==="soldOut"?A||ie||D.soldOut:ne==="disabled"?A||ie||D.disabled:A||D.maxReached},[ne,A,ie,D]),Z={soldOut:"danger",ruleBlocked:z,disabled:"default",maxReached:"warning"},Re={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Ae=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:o.cn("text-base font-medium",P&&"text-sm",y.name),children:e.name}),De=()=>{if(!g)return null;const oe=j?.price??e.price,he=j?.originalPrice,X=os(oe,i,r);if(l?.renderPrice)return l.renderPrice(oe,X,e);if(St(he)&&St(oe)&&he>oe){const L=os(he,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:o.cn("flex items-center gap-2 mt-1",P&&"mt-0.5",y.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",L,", discounted price ",X]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:o.cn("text-gray-400 line-through text-sm",P&&"text-xs",y.originalPrice),children:L}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:o.cn("text-primary text-base font-semibold",P&&"text-sm",y.discountedPrice),children:X})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:o.cn("text-primary text-base mt-1",P&&"text-sm mt-0.5",y.price),children:X})},se=()=>!b||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:o.cn("mb-4 text-sm text-gray-700 leading-relaxed",P&&"mb-2 text-xs text-gray-600",y.description),children:e.description}),ge=()=>{if(!f||!St(e.numberOfPeople)||e.numberOfPeople<=0)return null;const oe=e.numberOfPeople===1?D.person:D.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,oe,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:o.cn("text-sm text-gray-600 flex items-center mt-2",P&&"mt-1 text-xs",y.peopleCount),children:[t.jsx(p.Icon,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",oe]})},Ee=()=>{const oe=V===0||ae,he=Y||ae;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:V,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:oe,isIncrementDisabled:he,isDisabled:ae}):t.jsxs("div",{className:o.cn("flex items-center gap-2",y.quantitySelector),children:[t.jsx(p.Button,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:oe,variant:u,color:V>0?C:x,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:o.cn("min-w-[2rem] text-center font-medium",P&&"text-sm"),children:V}),t.jsx(p.Button,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:he,variant:u,color:V>0?C:x,radius:"full",isIconOnly:!0,size:P?"md":"sm","aria-label":"Increase quantity",children:t.jsx(p.Icon,{icon:"gravity-ui:plus",width:16})})]})},Ze=(oe,he)=>l?.renderDisabledState?l.renderDisabledState(oe,he):oe==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(he):oe==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(he):t.jsx(o.Chip,{"data-testid":Re[oe],color:Z[oe],variant:oe==="maxReached"?"flat":"solid",className:o.cn("gap-2 px-4",oe==="maxReached"?"h-8":"h-10",oe==="soldOut"&&y.soldOut,oe==="maxReached"&&y.maxReachedAlert,P&&"h-8"),startContent:t.jsx(p.Icon,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:he})}),pe=t.jsxs("div",{className:o.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",P?"gap-1":"gap-2"),children:[t.jsxs("div",{className:o.cn("h-full col-span-2",ae||Y?"opacity-50 pointer-events-none select-none":""),children:[Ae(),De(),t.jsxs("div",{className:o.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",P?"mb-1":"mb-2"),children:[ge(),se()]})]}),!te&&t.jsx("div",{className:o.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",P&&"space-x-1 pb-1 md:p-1",y.compactFooter),children:ne&&O?Ze(ne,O):Ee()})]}),Le=Y&&!W&&!K&&!q?t.jsx(ze.motion.div,{className:o.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",y.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Ze("maxReached",O||D.maxReached)}):null;return m?t.jsxs(o.Card,{className:o.cn("w-full",te&&!ae&&!Y&&"cursor-pointer",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,isPressable:te&&!ae&&!Y,onPress:te&&!ae&&!Y?()=>Q(1):void 0,children:[t.jsx(o.CardBody,{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:pe}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx(o.CardFooter,{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]}):t.jsxs("div",{className:o.cn("w-full",P&&y.compact,y.base),"data-testid":v||`offer-card-${e.id}`,children:[t.jsx("div",{className:o.cn("pt-1 pb-0",P?"pb-0.5":"",y.body),children:pe}),t.jsx(ze.AnimatePresence,{children:Le&&t.jsx("div",{className:o.cn("w-full mt-0 pt-0",P?"pt-1":"",y.footer),children:Le})})]})};ha.displayName="OfferCard";const ni=({message:e="No offers available.",icon:a="solar:ticket-sale-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:l})}const c=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:o.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(p.Icon,{"data-testid":"offer-card-empty-icon",icon:a,width:s,className:o.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:o.cn("text-lg",r.message),children:e})]});return n?t.jsx(o.Card,{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-empty-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-empty",className:o.cn("w-full",r.base),children:c})};ni.displayName="OfferCardEmpty";const Pd={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},ri=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...Pd,...a},c=t.jsx(o.Alert,{"data-testid":"offer-card-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{"data-testid":"offer-card-error-body",children:c})}):t.jsx("div",{"data-testid":"offer-card-error",className:o.cn("w-full",r.base),children:c})};ri.displayName="OfferCardError";const Td={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},ii=({quantity:e=2,gap:a=4,classNames:s={}})=>{const n=Td[a];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:o.cn(n,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(o.Card,{"data-testid":`offer-card-skeleton-${i}`,className:o.cn("w-full",s.card),children:[t.jsx(o.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(p.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(p.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(o.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(p.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(p.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(p.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(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(p.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};ii.displayName="OfferCardSkeleton";const li={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},oi={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"}}},Od={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},ci=({offers:e=[],mapOffer:a,selection:s,defaultSelection:n={},onSelectionChange:r,onQuantityChange:i,currency:c="USD",locale:l="en-US",labels:d,slots:u,isDisabled:x=!1,buttonVariant:m="bordered",buttonColor:b="default",showCard:f=!0,animated:g=!0,gap:j=2,compact:y=!1,classNames:v={}})=>{const[C,S]=h.useState(n),k=s!==void 0?s:C,$=h.useCallback((E,D)=>{const I={...k,[E]:Math.max(0,D)};s===void 0&&S(I),r?.(I),i?.(E,I[E])},[k,s,r,i]),_=[...e].sort((E,D)=>(E.position??0)-(D.position??0)),N=E=>{const D=a?a(E):E,I=(k??{})[D.id]||0;return{offer:D,quantity:I,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:b,showCard:f,compact:y}},F=Od[j],A=o.cn("grid mx-auto pt-2",F,v.base),M=E=>{const D=N(E);return t.jsx(ha,{offer:D.offer,quantity:D.quantity,onQuantityChange:D.onQuantityChange,currency:D.currency,locale:D.locale,labels:D.labels,slots:D.slots,isDisabled:D.isDisabled,buttonVariant:D.buttonVariant,buttonColor:D.buttonColor,showCard:D.showCard,compact:D.compact,classNames:v.card},D.offer.id)};return g?t.jsx(ze.motion.div,{"data-testid":"offer-card-list",className:A,variants:li,initial:"hidden",animate:"show",children:t.jsx(ze.AnimatePresence,{children:_.map(E=>{const D=N(E);return t.jsx(ze.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:v.cardWrapper,variants:oi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(ha,{offer:D.offer,quantity:D.quantity,onQuantityChange:$,currency:c,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:b,showCard:f,compact:y||D.offer.compact,classNames:v.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:A,children:_.map(M)})};ci.displayName="OfferCardList";var Jt=e=>e.type==="checkbox",vt=e=>e instanceof Date,He=e=>e==null;const di=e=>typeof e=="object";var Se=e=>!He(e)&&!Array.isArray(e)&&di(e)&&!vt(e),ui=e=>Se(e)&&e.target?Jt(e.target)?e.target.checked:e.target.value:e,zd=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mi=(e,a)=>e.has(zd(a)),Vd=e=>{const a=e.constructor&&e.constructor.prototype;return Se(a)&&a.hasOwnProperty("isPrototypeOf")},Ss=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ne(e){if(e instanceof Date)return new Date(e);const a=typeof FileList<"u"&&e instanceof FileList;if(Ss&&(e instanceof Blob||a))return e;const s=Array.isArray(e);if(!s&&!(Se(e)&&Vd(e)))return e;const n=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Ne(e[r]));return n}var Aa=e=>/^\w*$/.test(e),be=e=>e===void 0,$s=e=>Array.isArray(e)?e.filter(Boolean):[],As=e=>$s(e.replace(/["|']|\]/g,"").split(/\.|\[/)),G=(e,a,s)=>{if(!a||!Se(e))return s;const n=(Aa(a)?[a]:As(a)).reduce((r,i)=>He(r)?r:r[i],e);return be(n)||n===e?be(e[a])?s:e[a]:n},qe=e=>typeof e=="boolean",Oe=e=>typeof e=="function",fe=(e,a,s)=>{let n=-1;const r=Aa(a)?[a]:As(a),i=r.length,c=i-1;for(;++n<i;){const l=r[n];let d=s;if(n!==c){const u=e[l];d=Se(u)||Array.isArray(u)?u:isNaN(+r[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const ba={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},nt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},fi=h.createContext(null);fi.displayName="HookFormControlContext";const Ds=()=>h.useContext(fi);var xi=(e,a,s,n=!0)=>{const r={defaultValues:a._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const c=i;return a._proxyFormState[c]!==et.all&&(a._proxyFormState[c]=!n||et.all),s&&(s[c]=!0),e[c]}});return r};const Es=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Ud(e){const a=Ds(),{control:s=a,disabled:n,name:r,exact:i}=e||{},[c,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 Es(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!n&&l({...s._formState,...u})}}),[r,n,i]),h.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),h.useMemo(()=>xi(c,s,d.current,!1),[c,s])}var Ke=e=>typeof e=="string",cs=(e,a,s,n,r)=>Ke(e)?(n&&a.watch.add(e),G(s,e,r)):Array.isArray(e)?e.map(i=>(n&&a.watch.add(i),G(s,i))):(n&&(a.watchAll=!0),s),ds=e=>He(e)||!di(e);function tt(e,a,s=new WeakSet){if(ds(e)||ds(a))return Object.is(e,a);if(vt(e)&&vt(a))return Object.is(e.getTime(),a.getTime());const n=Object.keys(e),r=Object.keys(a);if(n.length!==r.length)return!1;if(s.has(e)||s.has(a))return!0;s.add(e),s.add(a);for(const i of n){const c=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=a[i];if(vt(c)&&vt(l)||Se(c)&&Se(l)||Array.isArray(c)&&Array.isArray(l)?!tt(c,l,s):!Object.is(c,l))return!1}}return!0}function Hd(e){const a=Ds(),{control:s=a,name:n,defaultValue:r,disabled:i,exact:c,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),x=h.useRef(void 0),m=h.useRef(s),b=h.useRef(n);u.current=l;const[f,g]=h.useState(()=>{const k=s._getWatch(n,d.current);return u.current?u.current(k):k}),j=h.useCallback(k=>{const $=cs(n,s._names,k||s._formValues,!1,d.current);return u.current?u.current($):$},[s._formValues,s._names,n]),y=h.useCallback(k=>{if(!i){const $=cs(n,s._names,k||s._formValues,!1,d.current);if(u.current){const _=u.current($);tt(_,x.current)||(g(_),x.current=_)}else g($)}},[s._formValues,s._names,i,n]);Es(()=>((m.current!==s||!tt(b.current,n))&&(m.current=s,b.current=n,y()),s._subscribe({name:n,formState:{values:!0},exact:c,callback:k=>{y(k.values)}})),[s,c,n,y]),h.useEffect(()=>s._removeUnmounted());const v=m.current!==s,C=b.current,S=h.useMemo(()=>{if(i)return null;const k=!v&&!tt(C,n);return v||k?j():null},[i,v,n,C,j]);return S!==null?S:f}function Wd(e){const a=Ds(),{name:s,disabled:n,control:r=a,shouldUnregister:i,defaultValue:c,exact:l=!0}=e,d=mi(r._names.array,s),u=h.useMemo(()=>G(r._formValues,s,G(r._defaultValues,s,c)),[r,s,c]),x=Hd({control:r,name:s,defaultValue:u,exact:l}),m=Ud({control:r,name:s,exact:l}),b=h.useRef(e),f=h.useRef(void 0),g=h.useRef(r.register(s,{...e.rules,value:x,...qe(e.disabled)?{disabled:e.disabled}:{}}));b.current=e;const j=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!G(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!G(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!G(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!G(m.validatingFields,s)},error:{enumerable:!0,get:()=>G(m.errors,s)}}),[m,s]),y=h.useCallback(k=>g.current.onChange({target:{value:ui(k),name:s},type:ba.CHANGE}),[s]),v=h.useCallback(()=>g.current.onBlur({target:{value:G(r._formValues,s),name:s},type:ba.BLUR}),[s,r._formValues]),C=h.useCallback(k=>{const $=G(r._fields,s);$&&$._f&&k&&($._f.ref={focus:()=>Oe(k.focus)&&k.focus(),select:()=>Oe(k.select)&&k.select(),setCustomValidity:_=>Oe(k.setCustomValidity)&&k.setCustomValidity(_),reportValidity:()=>Oe(k.reportValidity)&&k.reportValidity()})},[r._fields,s]),S=h.useMemo(()=>({name:s,value:x,...qe(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:y,onBlur:v,ref:C}),[s,n,m.disabled,y,v,C,x]);return h.useEffect(()=>{const k=r._options.shouldUnregister||i,$=f.current;$&&$!==s&&!d&&r.unregister($),r.register(s,{...b.current.rules,...qe(b.current.disabled)?{disabled:b.current.disabled}:{}});const _=(N,F)=>{const A=G(r._fields,N);A&&A._f&&(A._f.mount=F)};if(_(s,!0),k){const N=Ne(G(r._options.defaultValues,s,b.current.defaultValue));fe(r._defaultValues,s,N),be(G(r._formValues,s))&&fe(r._formValues,s,N)}return!d&&r.register(s),f.current=s,()=>{(d?k&&!r._state.action:k)?r.unregister(s):_(s,!1)}},[s,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:n,name:s})},[n,s,r]),h.useMemo(()=>({field:S,formState:m,fieldState:j}),[S,m,j])}const qd=h.createContext(null);qd.displayName="HookFormContext";var Gd=(e,a,s,n,r)=>a?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:r||!0}}:{},Gt=e=>Array.isArray(e)?e:[e],$n=()=>{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 pi(e,a){const s={};for(const n in e)if(e.hasOwnProperty(n)){const r=e[n],i=a[n];if(r&&Se(r)&&i){const c=pi(r,i);Se(c)&&(s[n]=c)}else e[n]&&(s[n]=i)}return s}var Te=e=>Se(e)&&!Object.keys(e).length,Ls=e=>e.type==="file",ga=e=>{if(!Ss)return!1;const a=e?e.ownerDocument:0;return e instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},hi=e=>e.type==="select-multiple",Fs=e=>e.type==="radio",Kd=e=>Fs(e)||Jt(e),Ua=e=>ga(e)&&e.isConnected;function Yd(e,a){const s=a.slice(0,-1).length;let n=0;for(;n<s;)e=be(e)?n++:e[a[n++]];return e}function Zd(e){for(const a in e)if(e.hasOwnProperty(a)&&!be(e[a]))return!1;return!0}function Ce(e,a){const s=Array.isArray(a)?a:Aa(a)?[a]:As(a),n=s.length===1?e:Yd(e,s),r=s.length-1,i=s[r];return n&&delete n[i],r!==0&&(Se(n)&&Te(n)||Array.isArray(n)&&Zd(n))&&Ce(e,s.slice(0,-1)),e}var Qd=e=>{for(const a in e)if(Oe(e[a]))return!0;return!1};function bi(e){return Array.isArray(e)||Se(e)&&!Qd(e)}function us(e,a={}){for(const s in e){const n=e[s];bi(n)?(a[s]=Array.isArray(n)?[]:{},us(n,a[s])):be(n)||(a[s]=!0)}return a}function Lt(e,a,s){s||(s=us(a));for(const n in e){const r=e[n];if(bi(r))be(a)||ds(s[n])?s[n]=us(r,Array.isArray(r)?[]:{}):Lt(r,He(a)?{}:a[n],s[n]);else{const i=a[n];s[n]=!tt(r,i)}}return s}const An={value:!1,isValid:!1},Dn={value:!0,isValid:!0};var gi=e=>{if(Array.isArray(e)){if(e.length>1){const a=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:a,isValid:!!a.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?Dn:{value:e[0].value,isValid:!0}:Dn:An}return An},yi=(e,{valueAsNumber:a,valueAsDate:s,setValueAs:n})=>be(e)?e:a?e===""?NaN:e&&+e:s&&Ke(e)?new Date(e):n?n(e):e;const En={isValid:!1,value:null};var vi=e=>Array.isArray(e)?e.reduce((a,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:a,En):En;function Ln(e){const a=e.ref;return Ls(a)?a.files:Fs(a)?vi(e.refs).value:hi(a)?[...a.selectedOptions].map(({value:s})=>s):Jt(a)?gi(e.refs).value:yi(be(a.value)?e.ref.value:a.value,e)}var Xd=(e,a,s,n)=>{const r={};for(const i of e){const c=G(a,i);c&&fe(r,i,c._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:n}},ya=e=>e instanceof RegExp,Tt=e=>be(e)?e:ya(e)?e.source:Se(e)?ya(e.value)?e.value.source:e.value:e,Fn=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched});const _n="AsyncFunction";var Jd=e=>!!e&&!!e.validate&&!!(Oe(e.validate)&&e.validate.constructor.name===_n||Se(e.validate)&&Object.values(e.validate).find(a=>a.constructor.name===_n)),eu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Rn=(e,a,s)=>!s&&(a.watchAll||a.watch.has(e)||[...a.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Kt=(e,a,s,n)=>{for(const r of s||Object.keys(e)){const i=G(e,r);if(i){const{_f:c,...l}=i;if(c){if(c.refs&&c.refs[0]&&a(c.refs[0],r)&&!n)return!0;if(c.ref&&a(c.ref,c.name)&&!n)return!0;if(Kt(l,a))break}else if(Se(l)&&Kt(l,a))break}}};function In(e,a,s){const n=G(e,s);if(n||Aa(s))return{error:n,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),c=G(a,i),l=G(e,i);if(c&&!Array.isArray(c)&&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 tu=(e,a,s,n)=>{s(e);const{name:r,...i}=e;return Te(i)||Object.keys(i).length>=Object.keys(a).length||Object.keys(i).find(c=>a[c]===(!n||et.all))},au=(e,a,s)=>!e||!a||e===a||Gt(e).some(n=>n&&(s?n===a:n.startsWith(a)||a.startsWith(n))),su=(e,a,s,n,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(a||e):(s?n.isOnBlur:r.isOnBlur)?!e:(s?n.isOnChange:r.isOnChange)?e:!0,nu=(e,a)=>!$s(G(e,a)).length&&Ce(e,a),ru=(e,a,s)=>{const n=Gt(G(e,s));return fe(n,"root",a[s]),fe(e,s,n),e};function Mn(e,a,s="validate"){if(Ke(e)||Array.isArray(e)&&e.every(Ke)||qe(e)&&!e)return{type:s,message:Ke(e)?e:"",ref:a}}var $t=e=>Se(e)&&!ya(e)?e:{value:e,message:""},Bn=async(e,a,s,n,r,i)=>{const{ref:c,refs:l,required:d,maxLength:u,minLength:x,min:m,max:b,pattern:f,validate:g,name:j,valueAsNumber:y,mount:v}=e._f,C=G(s,j);if(!v||a.has(j))return{};const S=l?l[0]:c,k=D=>{r&&S.reportValidity&&(S.setCustomValidity(qe(D)?"":D||""),S.reportValidity())},$={},_=Fs(c),N=Jt(c),F=_||N,A=(y||Ls(c))&&be(c.value)&&be(C)||ga(c)&&c.value===""||C===""||Array.isArray(C)&&!C.length,M=Gd.bind(null,j,n,$),E=(D,I,B,V=nt.maxLength,q=nt.minLength)=>{const P=D?I:B;$[j]={type:D?V:q,message:P,ref:c,...M(D?V:q,P)}};if(i?!Array.isArray(C)||!C.length:d&&(!F&&(A||He(C))||qe(C)&&!C||N&&!gi(l).isValid||_&&!vi(l).isValid)){const{value:D,message:I}=Ke(d)?{value:!!d,message:d}:$t(d);if(D&&($[j]={type:nt.required,message:I,ref:S,...M(nt.required,I)},!n))return k(I),$}if(!A&&(!He(m)||!He(b))){let D,I;const B=$t(b),V=$t(m);if(!He(C)&&!isNaN(C)){const q=c.valueAsNumber||C&&+C;He(B.value)||(D=q>B.value),He(V.value)||(I=q<V.value)}else{const q=c.valueAsDate||new Date(C),P=Y=>new Date(new Date().toDateString()+" "+Y),te=c.type=="time",W=c.type=="week";Ke(B.value)&&C&&(D=te?P(C)>P(B.value):W?C>B.value:q>new Date(B.value)),Ke(V.value)&&C&&(I=te?P(C)<P(V.value):W?C<V.value:q<new Date(V.value))}if((D||I)&&(E(!!D,B.message,V.message,nt.max,nt.min),!n))return k($[j].message),$}if((u||x)&&!A&&(Ke(C)||i&&Array.isArray(C))){const D=$t(u),I=$t(x),B=!He(D.value)&&C.length>+D.value,V=!He(I.value)&&C.length<+I.value;if((B||V)&&(E(B,D.message,I.message),!n))return k($[j].message),$}if(f&&!A&&Ke(C)){const{value:D,message:I}=$t(f);if(ya(D)&&!C.match(D)&&($[j]={type:nt.pattern,message:I,ref:c,...M(nt.pattern,I)},!n))return k(I),$}if(g){if(Oe(g)){const D=await g(C,s),I=Mn(D,S);if(I&&($[j]={...I,...M(nt.validate,I.message)},!n))return k(I.message),$}else if(Se(g)){let D={};for(const I in g){if(!Te(D)&&!n)break;const B=Mn(await g[I](C,s),S,I);B&&(D={...B,...M(I,B.message)},k(B.message),n&&($[j]=D))}if(!Te(D)&&($[j]={ref:S,...D},!n))return $}}return k(!0),$};const iu={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function lu(e={}){let a={...iu,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Oe(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1},n={},r=Se(a.defaultValues)||Se(a.values)?Ne(a.defaultValues||a.values)||{}:{},i=a.shouldUnregister?{}:Ne(r),c={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...x};let b={...m};const f={array:$n(),state:$n()},g=a.criteriaMode===et.all,j=w=>L=>{clearTimeout(u),u=setTimeout(w,L)},y=async w=>{if(!c.keepIsValid&&!a.disabled&&(m.isValid||b.isValid||w)){let L;a.resolver?(L=Te((await F()).errors),v()):L=await M(n,!0),L!==s.isValid&&f.state.next({isValid:L})}},v=(w,L)=>{!a.disabled&&(m.isValidating||m.validatingFields||b.isValidating||b.validatingFields)&&((w||Array.from(l.mount)).forEach(R=>{R&&(L?fe(s.validatingFields,R,L):Ce(s.validatingFields,R))}),f.state.next({validatingFields:s.validatingFields,isValidating:!Te(s.validatingFields)}))},C=(w,L=[],R,H,U=!0,T=!0)=>{if(H&&R&&!a.disabled){if(c.action=!0,T&&Array.isArray(G(n,w))){const J=R(G(n,w),H.argA,H.argB);U&&fe(n,w,J)}if(T&&Array.isArray(G(s.errors,w))){const J=R(G(s.errors,w),H.argA,H.argB);U&&fe(s.errors,w,J),nu(s.errors,w)}if((m.touchedFields||b.touchedFields)&&T&&Array.isArray(G(s.touchedFields,w))){const J=R(G(s.touchedFields,w),H.argA,H.argB);U&&fe(s.touchedFields,w,J)}(m.dirtyFields||b.dirtyFields)&&(s.dirtyFields=Lt(r,i)),f.state.next({name:w,isDirty:D(w,L),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else fe(i,w,L)},S=(w,L)=>{fe(s.errors,w,L),f.state.next({errors:s.errors})},k=w=>{s.errors=w,f.state.next({errors:s.errors,isValid:!1})},$=(w,L,R,H)=>{const U=G(n,w);if(U){const T=G(i,w,be(R)?G(r,w):R);be(T)||H&&H.defaultChecked||L?fe(i,w,L?T:Ln(U._f)):V(w,T),c.mount&&!c.action&&y()}},_=(w,L,R,H,U)=>{let T=!1,J=!1;const de={name:w};if(!a.disabled){if(!R||H){(m.isDirty||b.isDirty)&&(J=s.isDirty,s.isDirty=de.isDirty=D(),T=J!==de.isDirty);const ue=tt(G(r,w),L);J=!!G(s.dirtyFields,w),ue?Ce(s.dirtyFields,w):fe(s.dirtyFields,w,!0),de.dirtyFields=s.dirtyFields,T=T||(m.dirtyFields||b.dirtyFields)&&J!==!ue}if(R){const ue=G(s.touchedFields,w);ue||(fe(s.touchedFields,w,R),de.touchedFields=s.touchedFields,T=T||(m.touchedFields||b.touchedFields)&&ue!==R)}T&&U&&f.state.next(de)}return T?de:{}},N=(w,L,R,H)=>{const U=G(s.errors,w),T=(m.isValid||b.isValid)&&qe(L)&&s.isValid!==L;if(a.delayError&&R?(d=j(()=>S(w,R)),d(a.delayError)):(clearTimeout(u),d=null,R?fe(s.errors,w,R):Ce(s.errors,w)),(R?!tt(U,R):U)||!Te(H)||T){const J={...H,...T&&qe(L)?{isValid:L}:{},errors:s.errors,name:w};s={...s,...J},f.state.next(J)}},F=async w=>(v(w,!0),await a.resolver(i,a.context,Xd(w||l.mount,n,a.criteriaMode,a.shouldUseNativeValidation))),A=async w=>{const{errors:L}=await F(w);if(v(w),w)for(const R of w){const H=G(L,R);H?fe(s.errors,R,H):Ce(s.errors,R)}else s.errors=L;return L},M=async(w,L,R={valid:!0})=>{for(const H in w){const U=w[H];if(U){const{_f:T,...J}=U;if(T){const de=l.array.has(T.name),ue=U._f&&Jd(U._f);ue&&m.validatingFields&&v([T.name],!0);const Be=await Bn(U,l.disabled,i,g,a.shouldUseNativeValidation&&!L,de);if(ue&&m.validatingFields&&v([T.name]),Be[T.name]&&(R.valid=!1,L||e.shouldUseNativeValidation))break;!L&&(G(Be,T.name)?de?ru(s.errors,Be,T.name):fe(s.errors,T.name,Be[T.name]):Ce(s.errors,T.name))}!Te(J)&&await M(J,L,R)}}return R.valid},E=()=>{for(const w of l.unMount){const L=G(n,w);L&&(L._f.refs?L._f.refs.every(R=>!Ua(R)):!Ua(L._f.ref))&&Z(w)}l.unMount=new Set},D=(w,L)=>!a.disabled&&(w&&L&&fe(i,w,L),!tt(K(),r)),I=(w,L,R)=>cs(w,l,{...c.mount?i:be(L)?r:Ke(w)?{[w]:L}:L},R,L),B=w=>$s(G(c.mount?i:r,w,a.shouldUnregister?G(r,w,[]):[])),V=(w,L,R={})=>{const H=G(n,w);let U=L;if(H){const T=H._f;T&&(!T.disabled&&fe(i,w,yi(L,T)),U=ga(T.ref)&&He(L)?"":L,hi(T.ref)?[...T.ref.options].forEach(J=>J.selected=U.includes(J.value)):T.refs?Jt(T.ref)?T.refs.forEach(J=>{(!J.defaultChecked||!J.disabled)&&(Array.isArray(U)?J.checked=!!U.find(de=>de===J.value):J.checked=U===J.value||!!U)}):T.refs.forEach(J=>J.checked=J.value===U):Ls(T.ref)?T.ref.value="":(T.ref.value=U,T.ref.type||f.state.next({name:w,values:Ne(i)})))}(R.shouldDirty||R.shouldTouch)&&_(w,U,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&Y(w)},q=(w,L,R)=>{for(const H in L){if(!L.hasOwnProperty(H))return;const U=L[H],T=w+"."+H,J=G(n,T);(l.array.has(w)||Se(U)||J&&!J._f)&&!vt(U)?q(T,U,R):V(T,U,R)}},P=(w,L,R={})=>{const H=G(n,w),U=l.array.has(w),T=Ne(L);fe(i,w,T),U?(f.array.next({name:w,values:Ne(i)}),(m.isDirty||m.dirtyFields||b.isDirty||b.dirtyFields)&&R.shouldDirty&&f.state.next({name:w,dirtyFields:Lt(r,i),isDirty:D(w,T)})):H&&!H._f&&!He(T)?q(w,T,R):V(w,T,R),Rn(w,l)?f.state.next({...s,name:w,values:Ne(i)}):f.state.next({name:c.mount?w:void 0,values:Ne(i)})},te=async w=>{c.mount=!0;const L=w.target;let R=L.name,H=!0;const U=G(n,R),T=ue=>{H=Number.isNaN(ue)||vt(ue)&&isNaN(ue.getTime())||tt(ue,G(i,R,ue))},J=Fn(a.mode),de=Fn(a.reValidateMode);if(U){let ue,Be;const pt=L.type?Ln(U._f):ui(w),ct=w.type===ba.BLUR||w.type===ba.FOCUS_OUT,Ro=!eu(U._f)&&!a.resolver&&!G(s.errors,R)&&!U._f.deps||su(ct,G(s.touchedFields,R),s.isSubmitted,de,J),Ra=Rn(R,l,ct);fe(i,R,pt),ct?(!L||!L.readOnly)&&(U._f.onBlur&&U._f.onBlur(w),d&&d(0)):U._f.onChange&&U._f.onChange(w);const Ia=_(R,pt,ct),Io=!Te(Ia)||Ra;if(!ct&&f.state.next({name:R,type:w.type,values:Ne(i)}),Ro)return(m.isValid||b.isValid)&&(a.mode==="onBlur"?ct&&y():ct||y()),Io&&f.state.next({name:R,...Ra?{}:Ia});if(!ct&&Ra&&f.state.next({...s}),a.resolver){const{errors:on}=await F([R]);if(v([R]),T(pt),H){const Mo=In(s.errors,n,R),cn=In(on,n,Mo.name||R);ue=cn.error,R=cn.name,Be=Te(on)}}else v([R],!0),ue=(await Bn(U,l.disabled,i,g,a.shouldUseNativeValidation))[R],v([R]),T(pt),H&&(ue?Be=!1:(m.isValid||b.isValid)&&(Be=await M(n,!0)));H&&(U._f.deps&&(!Array.isArray(U._f.deps)||U._f.deps.length>0)&&Y(U._f.deps),N(R,Be,ue,Ia))}},W=(w,L)=>{if(G(s.errors,L)&&w.focus)return w.focus(),1},Y=async(w,L={})=>{let R,H;const U=Gt(w);if(a.resolver){const T=await A(be(w)?w:U);R=Te(T),H=w?!U.some(J=>G(T,J)):R}else w?(H=(await Promise.all(U.map(async T=>{const J=G(n,T);return await M(J&&J._f?{[T]:J}:J)}))).every(Boolean),!(!H&&!s.isValid)&&y()):H=R=await M(n);return f.state.next({...!Ke(w)||(m.isValid||b.isValid)&&R!==s.isValid?{}:{name:w},...a.resolver||!w?{isValid:R}:{},errors:s.errors}),L.shouldFocus&&!H&&Kt(n,W,w?U:l.mount),H},K=(w,L)=>{let R={...c.mount?i:r};return L&&(R=pi(L.dirtyFields?s.dirtyFields:s.touchedFields,R)),be(w)?R:Ke(w)?G(R,w):w.map(H=>G(R,H))},ie=(w,L)=>({invalid:!!G((L||s).errors,w),isDirty:!!G((L||s).dirtyFields,w),error:G((L||s).errors,w),isValidating:!!G(s.validatingFields,w),isTouched:!!G((L||s).touchedFields,w)}),ae=w=>{w&&Gt(w).forEach(L=>Ce(s.errors,L)),f.state.next({errors:w?s.errors:{}})},Q=(w,L,R)=>{const H=(G(n,w,{_f:{}})._f||{}).ref,U=G(s.errors,w)||{},{ref:T,message:J,type:de,...ue}=U;fe(s.errors,w,{...ue,...L,ref:H}),f.state.next({name:w,errors:s.errors,isValid:!1}),R&&R.shouldFocus&&H&&H.focus&&H.focus()},ne=(w,L)=>Oe(w)?f.state.subscribe({next:R=>"values"in R&&w(I(void 0,L),R)}):I(w,L,!0),z=w=>f.state.subscribe({next:L=>{au(w.name,L.name,w.exact)&&tu(L,w.formState||m,oe,w.reRenderRoot)&&w.callback({values:{...i},...s,...L,defaultValues:r})}}).unsubscribe,O=w=>(c.mount=!0,b={...b,...w.formState},z({...w,formState:{...x,...w.formState}})),Z=(w,L={})=>{for(const R of w?Gt(w):l.mount)l.mount.delete(R),l.array.delete(R),L.keepValue||(Ce(n,R),Ce(i,R)),!L.keepError&&Ce(s.errors,R),!L.keepDirty&&Ce(s.dirtyFields,R),!L.keepTouched&&Ce(s.touchedFields,R),!L.keepIsValidating&&Ce(s.validatingFields,R),!a.shouldUnregister&&!L.keepDefaultValue&&Ce(r,R);f.state.next({values:Ne(i)}),f.state.next({...s,...L.keepDirty?{isDirty:D()}:{}}),!L.keepIsValid&&y()},Re=({disabled:w,name:L})=>{if(qe(w)&&c.mount||w||l.disabled.has(L)){const U=l.disabled.has(L)!==!!w;w?l.disabled.add(L):l.disabled.delete(L),U&&c.mount&&!c.action&&y()}},Ae=(w,L={})=>{let R=G(n,w);const H=qe(L.disabled)||qe(a.disabled);return fe(n,w,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:w}},name:w,mount:!0,...L}}),l.mount.add(w),R?Re({disabled:qe(L.disabled)?L.disabled:a.disabled,name:w}):$(w,!0,L.value),{...H?{disabled:L.disabled||a.disabled}:{},...a.progressive?{required:!!L.required,min:Tt(L.min),max:Tt(L.max),minLength:Tt(L.minLength),maxLength:Tt(L.maxLength),pattern:Tt(L.pattern)}:{},name:w,onChange:te,onBlur:te,ref:U=>{if(U){Ae(w,L),R=G(n,w);const T=be(U.value)&&U.querySelectorAll&&U.querySelectorAll("input,select,textarea")[0]||U,J=Kd(T),de=R._f.refs||[];if(J?de.find(ue=>ue===T):T===R._f.ref)return;fe(n,w,{_f:{...R._f,...J?{refs:[...de.filter(Ua),T,...Array.isArray(G(r,w))?[{}]:[]],ref:{type:T.type,name:w}}:{ref:T}}}),$(w,!1,void 0,T)}else R=G(n,w,{}),R._f&&(R._f.mount=!1),(a.shouldUnregister||L.shouldUnregister)&&!(mi(l.array,w)&&c.action)&&l.unMount.add(w)}}},De=()=>a.shouldFocusError&&Kt(n,W,l.mount),se=w=>{qe(w)&&(f.state.next({disabled:w}),Kt(n,(L,R)=>{const H=G(n,R);H&&(L.disabled=H._f.disabled||w,Array.isArray(H._f.refs)&&H._f.refs.forEach(U=>{U.disabled=H._f.disabled||w}))},0,!1))},ge=(w,L)=>async R=>{let H;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let U=Ne(i);if(f.state.next({isSubmitting:!0}),a.resolver){const{errors:T,values:J}=await F();v(),s.errors=T,U=Ne(J)}else await M(n);if(l.disabled.size)for(const T of l.disabled)Ce(U,T);if(Ce(s.errors,"root"),Te(s.errors)){f.state.next({errors:{}});try{await w(U,R)}catch(T){H=T}}else L&&await L({...s.errors},R),De(),setTimeout(De);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(s.errors)&&!H,submitCount:s.submitCount+1,errors:s.errors}),H)throw H},Ee=(w,L={})=>{G(n,w)&&(be(L.defaultValue)?P(w,Ne(G(r,w))):(P(w,L.defaultValue),fe(r,w,Ne(L.defaultValue))),L.keepTouched||Ce(s.touchedFields,w),L.keepDirty||(Ce(s.dirtyFields,w),s.isDirty=L.defaultValue?D(w,Ne(G(r,w))):D()),L.keepError||(Ce(s.errors,w),m.isValid&&y()),f.state.next({...s}))},Ze=(w,L={})=>{const R=w?Ne(w):r,H=Ne(R),U=Te(w),T=U?r:H;if(L.keepDefaultValues||(r=R),!L.keepValues){if(L.keepDirtyValues){const J=new Set([...l.mount,...Object.keys(Lt(r,i))]);for(const de of Array.from(J)){const ue=G(s.dirtyFields,de),Be=G(i,de),pt=G(T,de);ue&&!be(Be)?fe(T,de,Be):!ue&&!be(pt)&&P(de,pt)}}else{if(Ss&&be(w))for(const J of l.mount){const de=G(n,J);if(de&&de._f){const ue=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(ga(ue)){const Be=ue.closest("form");if(Be){Be.reset();break}}}}if(L.keepFieldsRef)for(const J of l.mount)P(J,G(T,J));else n={}}i=a.shouldUnregister?L.keepDefaultValues?Ne(r):{}:Ne(T),f.array.next({values:{...T}}),f.state.next({values:{...T}})}l={mount:L.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!m.isValid||!!L.keepIsValid||!!L.keepDirtyValues||!a.shouldUnregister&&!Te(T),c.watch=!!a.shouldUnregister,c.keepIsValid=!!L.keepIsValid,c.action=!1,L.keepErrors||(s.errors={}),f.state.next({submitCount:L.keepSubmitCount?s.submitCount:0,isDirty:U?!1:L.keepDirty?s.isDirty:!!(L.keepDefaultValues&&!tt(w,r)),isSubmitted:L.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:U?{}:L.keepDirtyValues?L.keepDefaultValues&&i?Lt(r,i):s.dirtyFields:L.keepDefaultValues&&w?Lt(r,w):L.keepDirty?s.dirtyFields:{},touchedFields:L.keepTouched?s.touchedFields:{},errors:L.keepErrors?s.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},pe=(w,L)=>Ze(Oe(w)?w(i):w,{...a.resetOptions,...L}),Le=(w,L={})=>{const R=G(n,w),H=R&&R._f;if(H){const U=H.refs?H.refs[0]:H.ref;U.focus&&setTimeout(()=>{U.focus(),L.shouldSelect&&Oe(U.select)&&U.select()})}},oe=w=>{s={...s,...w}},X={control:{register:Ae,unregister:Z,getFieldState:ie,handleSubmit:ge,setError:Q,_subscribe:z,_runSchema:F,_updateIsValidating:v,_focusError:De,_getWatch:I,_getDirty:D,_setValid:y,_setFieldArray:C,_setDisabledField:Re,_setErrors:k,_getFieldArray:B,_reset:Ze,_resetDefaultValues:()=>Oe(a.defaultValues)&&a.defaultValues().then(w=>{pe(w,a.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:E,_disableForm:se,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return i},get _state(){return c},set _state(w){c=w},get _defaultValues(){return r},get _names(){return l},set _names(w){l=w},get _formState(){return s},get _options(){return a},set _options(w){a={...a,...w}}},subscribe:O,trigger:Y,register:Ae,handleSubmit:ge,watch:ne,setValue:P,getValues:K,reset:pe,resetField:Ee,clearErrors:ae,unregister:Z,setError:Q,setFocus:Le,getFieldState:ie};return{...X,formControl:X}}function ou(e={}){const a=h.useRef(void 0),s=h.useRef(void 0),[n,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Oe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Oe(e.defaultValues)?void 0:e.defaultValues});if(!a.current)if(e.formControl)a.current={...e.formControl,formState:n},e.defaultValues&&!Oe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:c,...l}=lu(e);a.current={...l,formState:n}}const i=a.current.control;return i._options=e,Es(()=>{const c=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,c},[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 c=i._getDirty();c!==n.isDirty&&i._subjects.state.next({isDirty:c})}},[i,n.isDirty]),h.useEffect(()=>{var c;e.values&&!tt(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((c=i._options.resetOptions)===null||c===void 0)&&c.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()}),a.current.formState=h.useMemo(()=>xi(n,i),[i,n]),a.current}function cu(e,a=3){return e%1===0?e.toString():e.toFixed(a).replace(/\.?0+$/,"")}function du(e,a="en-US",s="USD"){try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(n){return console.warn(`Invalid currency formatting: ${n}`),`${s} ${e.toFixed(2)}`}}function uu(e="USD",a="en-US"){try{return new Intl.NumberFormat(a,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function mu(e){const a=e.replace(/[^\d.,-]/g,""),s=a.match(/,\d{1,2}$/);let n;s?n=a.replace(/\./g,"").replace(",","."):n=a.replace(/,/g,"");const r=parseFloat(n);return isNaN(r)?null:r}function fu(e,a,s=.001){const n=e-a,r=Math.abs(n)<=s;return{difference:n,isBalanced:r,isUnderAllocated:!r&&n>0,isOverAllocated:!r&&n<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:"$"},Ha=()=>({id:_s(),amount:0,glAccount:null,isTaxDeductible:!1}),ji=({distribution:e,defaultDistribution:a,glAccounts:s=[],isLoadingGlAccounts:n=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:c,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:x=!0,canEditTaxDeductible:m=!0,isDisabled:b=!1,labels:f,classNames:g={},"data-testid":j,control:y,name:v,rules:C})=>{const S={...xu,...f},k=y!==void 0&&v!==void 0,$=ou({defaultValues:{_internal:a||Ha()}}),_=Wd({control:k?y:$.control,name:k?v:"_internal",rules:k?C:void 0}),[N,F]=h.useState(a||Ha()),A=k?_.field.value??Ha():e??N,M=k&&!!_.fieldState?.error,E=k&&(_.fieldState?.isTouched??!1),D=M||E,I=D&&(!A.amount||A.amount<=0),B=D&&!A.glAccount,[V,q]=h.useState(A.glAccount?.name||""),P=h.useCallback(Q=>{const ne={...A,...Q};k&&_.field.onChange(ne),!k&&e===void 0&&F(ne),i?.(ne)},[A,e,i,k,_]),te=h.useCallback(Q=>{const ne=Q||0;P({amount:ne}),c?.(ne)},[P,c]),W=h.useCallback(Q=>{q(Q),r?.(Q)},[r]),Y=h.useCallback(Q=>{if(Q===null){P({glAccount:null}),l?.(null);return}const z=s.find(O=>String(O.id)===String(Q))||null;P({glAccount:z}),l?.(z)},[s,P,l]),K=h.useCallback(()=>{q(""),P({glAccount:null}),l?.(null)},[P,l]),ie=h.useCallback(Q=>{P({isTaxDeductible:Q}),d?.(Q)},[P,d]),ae=h.useCallback(()=>{u?.()},[u]);return t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:o.cn(g.base),children:t.jsxs(o.CardBody,{className:o.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:o.cn("shrink-0",g.amountContainer),children:t.jsx(o.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(o.Tooltip,{content:S.amountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:A.amount||void 0,onValueChange:te,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:b,isInvalid:I,errorMessage:I?"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:S.currencySymbol})})})}),t.jsx("div",{className:o.cn("grow",g.glAccountContainer),children:t.jsx(o.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.glAccount,t.jsx(o.Tooltip,{content:S.glAccountTooltip,children:t.jsx(p.Icon,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:n,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:A.glAccount?.name??V,selectedKey:A.glAccount?.id??null,isDisabled:b,isInvalid:B,errorMessage:B?"GL Account is required":void 0,listboxProps:{emptyContent:n?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:W,onSelectionChange:Y,onClear:K,className:g.glAccountInput,children:Q=>t.jsx(o.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:o.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(o.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:A.isTaxDeductible,onValueChange:ie,isDisabled:b||!m,className:g.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:o.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(p.Button,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:b||!x,onPress:ae,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-trash-linear",width:16}),className:o.cn("text-danger",g.deleteButton),children:S.deleteButton})})]})})};ji.displayName="RevenueDistributionCard";const wi=({message:e="No distributions configured",icon:a="solar:document-text-outline",iconSize:s=48,showCard:n=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const c=t.jsxs("div",{className:o.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(p.Icon,{icon:a,width:s,className:o.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:o.cn("text-default-500 text-sm text-center",r.message),children:e})]});return n?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:o.cn("w-full",r.base),children:c})};wi.displayName="RevenueDistributionEmpty";const pu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ni=({error:e,labels:a,showCard:s=!0,color:n="danger",classNames:r={}})=>{const i={...pu,...a},c=t.jsx(o.Alert,{"data-testid":"revenue-distribution-error-alert",color:n,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(o.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:t.jsx(o.CardBody,{children:c})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:o.cn("w-full",r.base),children:c})};Ni.displayName="RevenueDistributionError";const Ci=({rows:e=1,showCard:a=!0,classNames:s={}})=>{const n=Array.from({length:e},(i,c)=>c),r=i=>t.jsxs("div",{className:o.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(p.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.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(p.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(p.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(p.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(p.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(p.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(p.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return a?t.jsx("div",{className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>t.jsx(o.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(o.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:o.cn("flex flex-col gap-3",s.base),children:n.map(i=>r(i))})};Ci.displayName="RevenueDistributionSkeleton";function Rs({isOpen:e,labels:a,icon:s,isConfirming:n=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:c,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:x}){return t.jsx(p.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:c,shouldBlockScroll:l,classNames:{...d,base:o.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:o.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(o.ModalContent,{children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:o.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:a.title})]}),t.jsx(o.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:a.description})}),t.jsxs(o.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(p.Button,{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:a.cancel}),t.jsx(p.Button,{type:"button",size:"md",color:r,radius:"full",className:o.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:n,onPress:x,children:a.confirm})]})]})})}const hu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Pn(e){return!e.fund&&Number(e.percentage||0)<=0}function bu({mode:e,assignments:a}){const s=a.filter(i=>i.fund),n=s.reduce((i,c)=>i+Number(c.percentage||0),0),r=a.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(n*100)/100===100}const gu={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"},ki={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"},Ot={...ki,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},yu={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"},vu={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 ju(){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 wu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Nu=e=>e.fund!==null;function Cu({assignments:e,funds:a,labels:s,classNames:n,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:c=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:x,footer:m,onAssignmentsChange:b,onOpenFundPicker:f,onCloseFundPicker:g,onCollapseChange:j,onSave:y}){const[v,C]=h.useState(null),S=x??v??void 0,k={...gu,...s},$=e.filter(z=>!Pn(z)),N=$.filter(Nu).length>0,F=h.useMemo(()=>e.filter(z=>!Pn(z)).reduce((z,O)=>z+Number(O.percentage||0),0),[e]),A=Math.round(F*100)/100,M=$.some(z=>!z.fund||Number(z.percentage||0)<=0),E=N&&(A!==100||M),D=`${k.totalError} (${k.total} ${Number(F.toFixed(2))}%)`,I=bu({mode:"split",assignments:e}),B=N&&A>=100,[V,q]=h.useState(!1),[P,te]=h.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ju,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:k.title}),c?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:k.saved}):null]}),Y=(z,O)=>{b(e.map(Z=>Z.id===z?{...Z,...O}:Z))},K=()=>{B||b([...e,hu()])},ie=z=>{e.length<=1||b(e.filter(O=>O.id!==z))},ae=()=>{if(!r){if(!I){te(!0);return}if(!i){y();return}q(!0)}},Q=()=>{q(!1),y()},ne=z=>{const O=u??e.find(Z=>!Z.fund)?.id??e[0]?.id;O&&(b(e.map(Z=>Z.id===O?{...Z,fund:z}:Z)),g())};return t.jsxs("div",{ref:C,className:o.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!x&&"min-h-[560px]",n?.root),children:[t.jsx(o.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:o.cn("w-full gap-0 px-0",n?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",n?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:z=>j?.(!(z==="all"||Array.from(z).length>0)),children:t.jsx(o.AccordionItem,{"aria-label":k.title,title:W,children:t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",n?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!N&&t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:ki,color:"default",variant:"flat",title:k.emptySplit}),N&&t.jsx(ku,{assignments:e,labels:k,total:F,hasTotalError:P&&!I||E,validationMessage:D,onSelectFund:z=>f(z),onRemoveFund:ie,onPercentageChange:(z,O)=>Y(z,{percentage:wu(O)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(p.Button,{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(ee.Plus,{className:"size-5",strokeWidth:2}),isDisabled:B,onPress:()=>N?K():f(),children:k.assignSpecificFund}),t.jsx(p.Button,{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(p.Icon,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!I||r,onPress:ae,children:k.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(Su,{funds:a,labels:k,selectedFundIds:e.map(z=>z.fund?.id).filter(Boolean),portalContainer:S,onSelect:ne,onClose:g}),t.jsx(Rs,{isOpen:V,labels:{title:k.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:k.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:k.modifyAssignedFundsWarning})]}),cancel:k.modifyAssignedFundsCancel,confirm:k.modifyAssignedFundsConfirm},icon:t.jsx(p.Icon,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:S,shouldBlockScroll:!1,classNames:vu,onClose:()=>q(!1),onConfirm:Q})]})}function ku({assignments:e,labels:a,total:s,hasTotalError:n,validationMessage:r,onSelectFund:i,onRemoveFund:c,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:o.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(p.Button,{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(p.Button,{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(ee.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:a.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(o.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:x=>l(d.id,Number(x.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:yu})}),e.length>1&&t.jsx(p.Button,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:o.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:()=>c(d.id),"aria-label":a.removeFund,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(o.Alert,{icon:t.jsx(p.Icon,{icon:n?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:n?"warning":"success",variant:"flat",classNames:{...Ot,base:o.cn(Ot.base,n?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:o.cn(Ot.iconWrapper,n?"text-warning-700":"text-success-700"),alertIcon:o.cn(Ot.alertIcon,n?"text-warning-700":"text-success-700"),title:o.cn(Ot.title,n?"text-warning-700":"text-success-700")},title:n?r:`${a.total} ${Number(s.toFixed(2))}%`})]})}function Su({funds:e,labels:a,selectedFundIds:s,portalContainer:n,onSelect:r,onClose:i}){const[c,l]=h.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const x=c.trim().toLowerCase();return x?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(x):!0});return t.jsx(p.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:n,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(o.ModalContent,{className:"max-h-full",children:[t.jsx(o.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:a.modalTitle}),t.jsxs(o.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(o.Input,{variant:"bordered","aria-label":a.searchPlaceholder,value:c,placeholder:a.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(p.Icon,{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:a.glCode}),t.jsx("span",{children:a.accountName}),t.jsx("span",{children:a.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:a.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(p.Button,{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:a.select})]},u.id))]})]})]})})}function $u(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.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(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Au={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Du({totalAmount:e,remainingBalance:a,amountReceived:s,currency:n="USD",locale:r="en-US",labels:i,className:c}){const l={...Au,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:n});return t.jsx("div",{className:o.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",c),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Wa,{label:l.totalAmount,value:d.format(e)}),t.jsx(Wa,{label:l.remainingBalance,value:d.format(a)}),t.jsx(Wa,{label:l.amountReceived,value:d.format(s)})]})})}function Wa({label:e,value:a}){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:a})]})}const Eu={monthly:1,quarterly:3,annual:12},Si=e=>{const[a,s,n]=e.split("-").map(Number);return{year:a,month:s,day:n}},Lu=(e,a)=>new Date(e,a+1,0).getDate(),Fu=e=>{const a=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${a}-${s}-${n}`},_u=(e,a)=>{const{year:s,month:n,day:r}=Si(e),i=n-1+a,c=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Lu(c,l));return new Date(c,l,d)},Ru=(e,a)=>{const{year:s,month:n,day:r}=Si(e),i=new Date(s,n-1,r);return i.setDate(i.getDate()+a),i};function $i(e,a){const s=Math.max(1,Math.floor(a.numberOfInstallments||1)),n=Math.round(e*100),r=Math.floor(n/s),i=n-r*s,c=Eu[a.frequency];return Array.from({length:s},(l,d)=>{const u=a.frequency==="weekly"?Ru(a.firstInstallmentDate,d*7):_u(a.firstInstallmentDate,d*(c??1));return{id:crypto.randomUUID(),dueDate:Fu(u),amount:(r+(d===0?i:0))/100}})}function Iu(e){return new Set(e.map((a,s)=>{const n=e[s+1]?.dueDate;return a.dueDate&&n&&a.dueDate>n?a.id:null}).filter(a=>!!a))}function Mu(e){return{missingDateRows:new Set(e.filter(a=>!a.dueDate).map(a=>a.id)),invalidDateRows:Iu(e),invalidAmountRows:new Set(e.filter(a=>Number(a.amount||0)<=0).map(a=>a.id))}}function Bu(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Pu(e,a){const s=e[0];return!s||!a||s.dueDate===a?e:[{...s,dueDate:a},...e.slice(1)]}const Tu=new Set(["paid","partially_refunded","refunded"]);function jt(e){return e!==void 0&&Tu.has(e)}const Ou={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."},zu=["weekly","monthly","quarterly","annual"],Vu=Array.from({length:31},(e,a)=>a+1),Uu=["numberOfInstallments","frequency","firstInstallmentDate"],Tn=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),va=e=>Math.round(e*100)/100,Hu=(e,a)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)},Da=e=>{if(!e)return null;try{return Ac(e)}catch{return null}},Wu=e=>Da(e)?.day??1,qu=(e,a)=>new Date(e,a,0).getDate(),Gu=(e,a)=>{const s=Da(e);if(!s)return e;const n=Math.min(a,qu(s.year,s.month));return s.set({day:n}).toString()},On=e=>{const a=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${a}`};function Ku({mode:e,donationAmount:a,currency:s="USD",locale:n="en-US",installments:r,automaticSettings:i,defaultTab:c="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:x=!0,inputs:m=Uu,startDate:b,firstInstallmentDateOverride:f,labels:g,classNames:j,isSaving:y=!1,showSavedIndicator:v=!1,isModeSwitchDisabled:C=!1,onModeChange:S,onAutomaticSettingsChange:k,onInstallmentsChange:$,onSave:_,onCancel:N}){const[F,A]=h.useState(c),M={...Ou,...g},E=e??F,D=h.useMemo(()=>new Intl.NumberFormat(n,{style:"currency",currency:s}),[s,n]),I=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||b||"":b||i.firstInstallmentDate}),[i,m,b]),B=E==="automatic"?Pu($i(a,I),m.includes("firstInstallmentDate")?void 0:f):r,V=h.useMemo(()=>va(B.reduce((Z,Re)=>Z+Number(Re.amount||0),0)),[B]),q=Math.abs(V-a)>.009,P=va(a-V)<=0,te=h.useMemo(()=>Mu(r),[r]),W=E==="manual"&&Bu(te),Y=q||W,K=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee.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}),v?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:M.saved}):null]}):void 0,ie=Z=>{Z!==E&&(e||A(Z),S?.(Z),Z==="manual"&&r.length===0&&$([Tn()]))},ae=(Z,Re)=>{const Ae=r.find(De=>De.id===Z);jt(Ae?.status)||$(r.map(De=>De.id===Z?{...De,...Re}:De))},Q=()=>{$([...r,Tn()])},ne=Z=>{const Re=r.find(Ae=>Ae.id===Z);jt(Re?.status)||$(r.filter(Ae=>Ae.id!==Z))},z=()=>{y||Y||_?.()},O=t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.content),children:[x||u||N?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[x?t.jsx(Yu,{mode:E,labels:M,onModeChange:ie,isDisabled:C,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[N?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:y,onPress:N,children:M.cancelEdit}):null,u?t.jsx(p.Button,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:y?void 0:t.jsx(p.Icon,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:y,isDisabled:y||Y,onPress:z,children:M.saveInstallments}):null]})]}):null,t.jsxs("div",{className:o.cn("flex w-full flex-col gap-4",j?.preview),children:[E==="automatic"&&t.jsx(Zu,{settings:I,inputs:m,labels:M,className:j?.controls,onSettingsChange:k}),B.length===0&&t.jsx(o.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:E==="automatic"?M.emptyAutomatic:M.emptyManual}),B.length>0&&t.jsx(Qu,{mode:E,installments:B,rowErrors:te,labels:M,formatter:D,locale:n,onUpdateInstallment:ae,onRemoveInstallment:ne}),E==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(p.Button,{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(ee.Plus,{className:"size-5",strokeWidth:2}),isDisabled:P,onPress:Q,children:M.addInstallment})}),t.jsx(tm,{total:V,donationAmount:a,hasTotalMismatch:q,mode:E,installments:B,formatter:D,labels:M,className:j?.summary})]})]});return t.jsx("div",{className:o.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(o.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:o.cn("w-full gap-0 px-0",j?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:o.cn("px-4 py-4",j?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(o.AccordionItem,{"aria-label":M.title,title:K,children:O},"installment-schedule")}):O})}function Yu({mode:e,labels:a,className:s,isDisabled:n=!1,onModeChange:r}){return t.jsxs(o.Tabs,{"aria-label":a.title,selectedKey:e,isDisabled:n,color:"primary",size:"lg",radius:"full",className:o.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(o.Tab,{title:a.automaticMode},"automatic"),t.jsx(o.Tab,{title:a.manualMode},"manual")]})}function Zu({settings:e,inputs:a,labels:s,className:n,onSettingsChange:r}){const i=c=>{if(c==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(o.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))})}})},c);if(c==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{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:zu.map(l=>t.jsx(o.SelectItem,{textValue:s[l],children:s[l]},l))})},c);if(c==="dayOfMonth"){const l=String(Wu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(p.Select,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Gu(e.firstInstallmentDate,u)})},children:Vu.map(d=>t.jsx(o.SelectItem,{textValue:On(d),children:On(d)},String(d)))})},c)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Cs,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Da(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},c)};return a.length===0?null:t.jsx("div",{className:o.cn("grid gap-4",n),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:a.map(i)})}function Qu({mode:e,installments:a,rowErrors:s,labels:n,formatter:r,locale:i,onUpdateInstallment:c,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:o.cn("flex flex-col gap-3",a.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:a.map((d,u)=>t.jsxs("div",{className:o.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:Hu(d.dueDate,i)}),u===0&&a.length>1&&t.jsx(o.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:a.map((d,u)=>{const x=s.missingDateRows.has(d.id),m=s.invalidDateRows.has(d.id),b=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(Cs,{variant:"bordered","aria-label":`${n.dueDate} ${u+1}`,isDisabled:jt(d.status),isInvalid:x||m,errorMessage:x?n.dueDateRequiredError:m?n.dateOrderError:void 0,value:Da(d.dueDate),onChange:f=>c(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Ju,{amount:d.amount,ariaLabel:`${n.amount} ${u+1}`,isDisabled:jt(d.status),isInvalid:b,errorMessage:n.amountGreaterThanZeroError,onAmountChange:f=>c(d.id,{amount:f})})}),t.jsx(em,{isDisabled:a.length<=1,isPaid:jt(d.status),label:n.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Xu=/^\d*(?:[.,]\d{0,2})?$/;function Ju({amount:e,ariaLabel:a,isDisabled:s,isInvalid:n,errorMessage:r,onAmountChange:i}){const[c,l]=h.useState(null);return t.jsx(o.Input,{variant:"bordered","aria-label":a,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:n,errorMessage:n?r:void 0,value:c??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Xu.test(u))return;l(u);const x=Number(u.replace(",","."));i(va(Number.isFinite(x)?x:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function em({isDisabled:e,isPaid:a,label:s,onRemove:n}){const r=t.jsx(p.Button,{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||a,onPress:n,"aria-label":s,children:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return a?t.jsx(o.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 tm({total:e,donationAmount:a,hasTotalMismatch:s,mode:n,installments:r,formatter:i,labels:c,className:l}){const d=r.length,u=r[0]?.amount??0,x=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(x*100),b=va(a-e),f=Math.max(b,0),g=Math.max(-b,0),j=s?t.jsxs("span",{children:[c.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(a)}),"."]}):n==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(x)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(a)}),"."]}),y=n==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${c.remaining}: ${i.format(f)}`;return t.jsx(o.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:y}),title:j})}function am(){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(p.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(p.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(p.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(p.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(p.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(p.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(p.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,a)=>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(p.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(p.Skeleton,{className:"h-8 w-full rounded-xl"})]},a))})]})}const zn={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"},Ai={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"},sm={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:Ai.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."},nm={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},rm=[];function im({installments:e,currency:a,locale:s="en-US",showTitle:n=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:c=!0,payNowHiddenStatuses:l=rm,showSavedIndicator:d=!1,labels:u,isSaving:x=!1,onEditInstallments:m,onPayInstallment:b,onDeleteInstallment:f}){const[g,j]=h.useState(null),y={...sm,...u},[v,C]=h.useState(""),S=new Intl.NumberFormat(s,{style:"currency",currency:a}),k=e.some(A=>Di(A)!==null),$=e.some(A=>A.status==="partially_refunded"),_=n?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ee.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title}),d?t.jsx(o.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:y.saved}):null]}):void 0,N=h.useMemo(()=>{const A=v.trim().toLowerCase();if(!A)return e;const M=new Intl.NumberFormat(s,{style:"currency",currency:a});return e.filter(E=>{const D=E.status??"scheduled";return[qa(E),E.id,E.amount,E.dueDate,fa(E.dueDate,s),Ga(E,y.paidOn,s),Ka(E,y.refundedAmount,M),D,Ya(D,y.partiallyRefunded)].join(" ").toLowerCase().includes(A)})},[s,a,e,v,y.paidOn,y.refundedAmount,y.partiallyRefunded]),F=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:y.searchLabel}),t.jsx(o.Input,{variant:"bordered",size:"md",value:v,placeholder:y.searchPlaceholder,onChange:A=>C(A.target.value),startContent:t.jsx(p.Icon,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(p.Button,{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(p.Icon,{icon:"solar:pen-outline",className:"size-4"}),isLoading:x,onPress:m,children:y.editInstallments}):null]}),t.jsx("div",{className:o.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((A,M)=>{const E=A.status??"scheduled",D=qa(A),I=Ga(A,y.paidOn,s),B=Ka(A,y.refundedAmount,S);return t.jsx(o.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(o.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:D||`PMT-${M+1}`})]}),t.jsx(Vn,{status:E,label:Ya(E,y.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:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:S.format(A.amount)}),B?t.jsx("p",{className:"text-xs text-default-500",children:B}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:fa(A.dueDate,s)}),I?t.jsx("p",{className:"text-xs text-default-500",children:I}):null]})]}),t.jsx(Un,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:f})]})},A.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:y.noInstallmentsFound})]})}),t.jsx("div",{className:o.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:k?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:$?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[N.map((A,M)=>{const E=A.status??"scheduled",D=qa(A),I=Ga(A,y.paidOn,s),B=Ka(A,y.refundedAmount,S);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:D||`PMT-${M+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[S.format(A.amount),B?t.jsx("span",{className:"block text-xs",children:B}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[fa(A.dueDate,s),I?t.jsx("span",{className:"block text-xs",children:I}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Vn,{status:E,label:Ya(E,y.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Un,{status:E,installment:A,labels:y,portalContainer:g??void 0,showDelete:c,payNowHiddenStatuses:l,onPayInstallment:b,onDeleteInstallment:f})})]},A.id)}),N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:j,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(o.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(o.AccordionItem,{"aria-label":y.title,title:_,children:F},"installment-table")}):F})}function qa(e){return e.name?.trim()||e.id}function Ga(e,a,s){return!jt(e.status)||!e.fulfilledAt?null:`${a} ${fa(e.fulfilledAt,s)}`}function Di(e){const{refundedAmount:a}=e;return e.status!=="partially_refunded"||typeof a!="number"||!Number.isFinite(a)||a<=0?null:a}function Ka(e,a,s){const n=Di(e);return n===null?null:`${a} ${s.format(n)}`}function Ya(e,a){return e==="partially_refunded"?a:Ai[e]??e}function Vn({status:e,label:a}){return t.jsx(o.Chip,{size:"md",radius:"lg",className:o.cn("justify-center px-4",zn[e]??zn.scheduled),startContent:t.jsx(om,{status:e}),children:a})}function Un({status:e,installment:a,labels:s,portalContainer:n,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:c,onDeleteInstallment:l}){const d=!i.includes(e),u=jt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(p.Button,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(p.Icon,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>c?.(a),children:s.payNow}):null,t.jsx(lm,{isFulfilled:u,showDelete:r,labels:s,portalContainer:n,onDelete:()=>l(a.id)})]})}function lm({isFulfilled:e,showDelete:a,labels:s,portalContainer:n,onDelete:r}){const[i,c]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(p.Icon,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(o.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&a&&!e&&c(!0)},children:[t.jsx(o.DropdownSection,{title:"Actions",showDivider:a,children:t.jsx(o.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(p.Icon,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),a?t.jsx(o.DropdownSection,{title:s.dangerZone,children:t.jsx(o.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(p.Icon,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),a?t.jsx(Rs,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(p.Icon,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:n,shouldBlockScroll:!1,classNames:nm,onClose:()=>c(!1),onConfirm:()=>{c(!1),r()}}):null]})}function om({status:e}){return e==="paid"?t.jsx(p.Icon,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(p.Icon,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(p.Icon,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(p.Icon,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(p.Icon,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(p.Icon,{icon:"solar:calendar-outline",className:"size-3"})}const cm=/^\d{4}-\d{2}-\d{2}$/;function fa(e,a){const s=cm.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(a,{month:"short",day:"numeric",year:"numeric"}).format(s)}const dm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},um=({cards:e,locale:a,currency:s,listHeightClassName:n="",labels:r,showRenewal:i=!0,defaultRenewalValue:c=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:x,className:m=""})=>{const b=Array.isArray(e)?e:[],[f,g]=h.useState(l),[j,y]=h.useState(c),v={...dm,...r};h.useEffect(()=>{g(l)},[l]);const C=k=>{if(k===f){d&&x?.(k);return}g(k),x?.(k)},S=k=>{y(k),u?.(k)};return t.jsxs("div",{className:o.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:v.title}),i&&t.jsx(Ii,{title:v.renewalTitle,description:v.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:o.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",n===""?"flex-1":o.cn("shrink-0",n)),"data-testid":"membership-select-cards-list",children:b.map(k=>t.jsx(Ei,{itemKey:k.id,name:k.name,type:k.type,price:k.price,locale:a,currency:s,isSelected:f===k.id,onSelect:C},k.id))})]})},Ei=({itemKey:e,name:a,type:s,price:n,locale:r="en-US",currency:i="USD",showPrice:c=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:x=!1,disabledReason:m,statusLabel:b,statusTone:f="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(n),y=!!d&&!x,v=m||b,C=()=>{y&&d?.(e)};return t.jsx(o.Card,{shadow:"none",isPressable:!!d,onPress:C,className:o.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",x?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:x,children:t.jsxs("div",{className:o.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:o.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:a}),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})}),v&&t.jsx(o.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:v})]}),c&&t.jsx("p",{className:o.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Hn="w-full bg-gray-100",Wn={variant:"light",color:"default"},Li=({id:e,title:a,media:s,imageUrl:n,imageAlt:r,imageClassName:i="",imageAspect:c="aspect-[4/3]",meta:l=[],price:d,action:u,footer:x,onPress:m,isPressable:b=!1,isDisabled:f=!1,compact:g=!1,className:j="",bodyClassName:y="",footerClassName:v="",dataTestId:C})=>{const S=!!(d&&d.value),k=!!u?.label,$=b&&!!m&&!k,_=!$,N=k?{variant:u?.variant??Wn.variant,color:u?.color??Wn.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(p.Icon,{icon:u.icon,width:16}):void 0}:null,F=s??(n?t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Hn,i),children:t.jsx(o.Image,{removeWrapper:!0,src:n,alt:r||a,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:o.cn("relative overflow-hidden rounded-xl",c,Hn,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(p.Icon,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(o.Card,{"data-testid":C||`catalog-item-card-${e??"item"}`,className:o.cn("w-full overflow-hidden",j),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:F}),t.jsxs(o.CardBody,{className:o.cn("gap-3",g?"p-3":"p-4",y),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:o.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:a}),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((A,M)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(p.Icon,{icon:A.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:A.label})]},`${A.label}-${M}`))}):null,(S||k)&&t.jsxs("div",{className:o.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",v),children:[S?t.jsxs("span",{className:o.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}),k&&_?t.jsx(p.Button,{className:o.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]}),x?t.jsx("div",{className:"pt-1",children:x}):null]})]})};Li.displayName="CatalogItemCard";const mm={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function Fi({title:e,subtitle:a,price:s,imageUrl:n,status:r,isDisabled:i=!1,onPress:c,className:l}){return t.jsx(o.Card,{isPressable:!!c,isDisabled:i,onPress:c,shadow:"none",radius:"lg",className:o.cn("w-full border border-pos-hair",l),children:t.jsxs(o.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:n?t.jsx(o.Image,{removeWrapper:!0,src:n,alt:"",className:"size-full object-cover"}):t.jsx(p.Icon,{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:a})]}),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:mm[r]}):null,s?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",s]}):null]})})}Fi.displayName="ProgramListItem";const fm={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]"},pm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},hm={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},bm={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},gm={card:"mt-1",panel:"mt-[22px]"},ym="bg-acct-page border-acct-border text-acct-muted",vm={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},jm={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"},Nm={empty:"status",error:"alert",success:"status",loading:"status"},Cm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function km(e,a,s,n){if(a===!1)return null;if(e==="loading"&&a===void 0)return t.jsx(o.Spinner,{size:"lg",color:"primary",className:n.spinner});if(h.isValidElement(a))return t.jsx(t.Fragment,{children:a});const r=typeof a=="string"?a:vm[e];return r?t.jsx(p.Icon,{icon:r,width:s,height:s,"aria-hidden":"true",className:n.icon}):null}function _i({variant:e="empty",surface:a="card",title:s,titleAs:n="p",description:r,icon:i,actions:c,role:l=Nm[e],ariaLive:d=Cm[e],iconSize:u=24,className:x,classNames:m={},"data-testid":b="feedback-state",referenceCode:f,referenceCodeLabel:g="Reference code:"}){const j=km(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":b,"data-surface":a,className:o.cn("flex flex-col items-center justify-center text-center",fm[a],a==="card"?jm[e]:"bg-transparent",x,m.base),children:[j?t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn("inline-flex items-center justify-center",xm[a],e==="success"&&a==="card"&&"rounded-full",a==="panel"?ym:wm[e],m.iconWrapper),children:j}):null,t.jsxs("div",{className:o.cn("flex flex-col items-center",a==="card"&&"gap-1"),children:[t.jsx(n,{"data-testid":`${b}-title`,className:o.cn(pm[a],m.title),children:s}),r?t.jsx("p",{"data-testid":`${b}-description`,className:o.cn(hm[a],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${b}-reference-code`,className:o.cn(bm[a],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),c?t.jsx("div",{"data-testid":`${b}-actions`,className:o.cn("flex flex-wrap items-center justify-center gap-2",gm[a],m.actions),children:c}):null]})}function ea(e){return t.jsx(_i,{...e})}function Is(e){return t.jsx(ea,{...e,variant:"empty"})}function Ms(e){return t.jsx(_i,{...e,variant:"error"})}function Bs(e){return t.jsx(ea,{...e,variant:"loading"})}function Ri(e){return t.jsx(ea,{...e,variant:"success"})}ea.displayName="FeedbackState";Is.displayName="EmptyState";Ms.displayName="ErrorState";Bs.displayName="LoadingState";Ri.displayName="SuccessState";const Ii=({title:e,value:a,description:s,onValueChange:n,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:o.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(o.Switch,{id:i,isSelected:a,onValueChange:n,"data-testid":"toggle-switch"})]})},Sm={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"},$m=(e,a)=>new Intl.NumberFormat(e,{style:"currency",currency:a}),Mi=e=>Object.values(e).reduce((a,s)=>a+Object.values(s).reduce((n,r)=>n+Object.values(r).reduce((i,c)=>i+c.selectedQuantity,0),0),0),Am=e=>e.reduce((a,s)=>a+s.dates.reduce((n,r)=>n+r.tickets.reduce((i,c)=>i+c.max,0),0),0),Ps=e=>e.flatMap(a=>a.dates.flatMap(s=>s.tickets.map(n=>({exhibition:a,dateGroup:s,ticket:n})))),qn=(e,a,s)=>{const n={};let r=s?a??Am(e):0;for(const{exhibition:i,dateGroup:c,ticket:l}of Ps(e)){n[i.id]??={},n[i.id][c.id]??={};const d=s?Math.min(l.max,r):0;n[i.id][c.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return n},Gn=(e,a,s)=>`${e}::${a}::${s}`,Dm=(e,a,s)=>{const n=Mi(a);for(const{exhibition:r,dateGroup:i,ticket:c}of Ps(e)){const l=a[r.id]?.[i.id]?.[c.id]?.selectedQuantity??0,d=s===void 0?c.max:Math.min(c.max,s-(n-l));if(d>0&&l<d)return!1}return!0},Em=({initialQuantity:e=1,minQuantity:a=1,maxQuantity:s=10,onChange:n,disabled:r=!1})=>{const i=Math.max(a,Math.min(s,e)),[c,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),x=d?c:String(i),m=()=>{r||i>=s||n?.(i+1)},b=()=>{r||i<=a||n?.(i-1)},f=k=>{if(r)return;l(k.target.value);const $=parseInt(k.target.value,10);isNaN($)||n?.(Math.max(a,Math.min(s,$)))},g=k=>{const $=parseInt(k.target.value,10);if(u(!1),isNaN($)){n?.(a);return}const _=Math.max(a,Math.min(s,$));_!==$?n?.(_):l(String(_))},j=i<=a,y=i>=s,v="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",S="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:b,disabled:r||j,className:o.cn(v,r||j?S:C),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:x,onChange:f,onFocus:()=>u(!0),onBlur:g,disabled:r,min:a,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||y,className:o.cn(v,r||y?S:C),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Lm=({label:e,checked:a=!1,onChange:s,disabled:n=!1})=>{const r=()=>{n||s?.(!a)};return t.jsxs("button",{type:"button",onClick:r,disabled:n,role:"checkbox","aria-checked":a,"data-testid":"checkbox-button","data-checked":a,className:o.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",n&&"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:a,onChange:()=>{},disabled:n,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:o.cn("block w-3.5 h-3.5 rounded-sm relative",a?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:a&&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})]})},Fm=({item:e,quantity:a,onChange:s,getTotalSelectedTickets:n,userMaxLimit:r,settings:i,labels:c})=>{const l=()=>{if(!n||r===void 0)return e.max;const m=n();return Math.min(e.max,r-(m-a))},d=i?.locale??"en-US",u=i?.currency??"USD",x=$m(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:x.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:x.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[c.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Em,{initialQuantity:a,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(o.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]})},_m=({exhibitionId:e,dateGroup:a,isLast:s=!1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d})=>t.jsxs("div",{className:o.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:a.date}),a.tickets.map((u,x)=>t.jsxs("div",{children:[t.jsx(Fm,{item:u,quantity:r(e,a.id,u.id),onChange:m=>n(e,a.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:c,settings:l,labels:d}),x<a.tickets.length-1?t.jsx(o.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Rm=({title:e,exhibition:a,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,labels:l,initialExpanded:d=!1})=>{const[u,x]=h.useState(d),m=a.dates.reduce((f,g)=>f+g.tickets.reduce((j,y)=>j+n(a.id,g.id,y.id),0),0),b=a.dates.some(f=>f.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>x(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${a.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:o.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(p.Icon,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${a.id}`,className:o.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:b?a.dates.map((f,g)=>t.jsx(_m,{exhibitionId:a.id,dateGroup:f,isLast:g===a.dates.length-1,onQuantityChange:s,getTicketQuantity:n,getTotalSelectedTickets:r,userMaxLimit:i,settings:c,labels:l},f.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Im=({initialExpanded:e=!1,userMaxLimit:a,labels:s,settings:n,ticketSelectionData:r,className:i="",onSelectionChange:c})=>{const l=h.useMemo(()=>r??[],[r]),d={...Sm,...s},[u,x]=h.useState(()=>qn(l,a,!0)),m=h.useRef(!1),b=h.useMemo(()=>{const C=Ps(l).map(({exhibition:S,dateGroup:k,ticket:$})=>[Gn(S.id,k.id,$.id),$]);return new Map(C)},[l]),f=Dm(l,u,a),g=(C,S,k)=>u[C]?.[S]?.[k]?.selectedQuantity??0,j=()=>Mi(u),y=(C,S,k,$)=>{const _=g(C,S,k),N=j()-_;if(a!==void 0&&N+$>a)return;const F=b.get(Gn(C,S,k));if(!F)return;const A={...u,[C]:{...u[C],[S]:{...u[C]?.[S],[k]:{id:k,selectedQuantity:$,originalPrice:F.originalPrice,discountedPrice:F.price}}}};x(A),c?.(A)},v=C=>{const S=qn(l,a,C);x(S),c?.(S)};return h.useEffect(()=>{!m.current&&f&&(c?.(u),m.current=!0)},[f,u,c]),t.jsxs("div",{className:o.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(Lm,{label:d.selectAllButtonLabel,checked:f,onChange:v})]}),l.map(C=>t.jsx(Rm,{title:C.exhibitionName,exhibition:C,onQuantityChange:y,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:a,settings:n,labels:d,initialExpanded:e},C.id))]})},Za={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Qa=e=>{const a={};for(const s of e)s.type==="checkbox"?a[s.id]=[...s.selectedValues]:a[s.id]=s.selectedValue?[s.selectedValue]:[];return a},Mm=(e,a)=>{const s={};for(const n of a){if(n.type==="checkbox"){s[n.id]=e[n.id]??[...n.selectedValues];continue}const r=e[n.id]??[];s[n.id]=r.length>0?r[0]:null}return s},Bm=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Bi=({triggerLabel:e,triggerAriaLabel:a,triggerIcon:s="solar:tuning-square-outline",triggerVariant:n="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:c,popoverClassName:l,className:d,sections:u,onConfirm:x,onClear:m,appliedCount:b,countAriaLabel:f,countDisplay:g="badge",confirmLabel:j=Za.confirm,clearLabel:y=Za.clear,isOpen:v,defaultOpen:C=!1,onOpenChange:S,isDisabled:k=!1,closeOnConfirm:$=!0,keepOpenAfterClear:_=!1})=>{const[N,F]=h.useState(C),[A,M]=h.useState(()=>Qa(u)),E=v??N,D=b??u.filter(K=>Bm(K)).length,I=K=>{K&&M(Qa(u)),v||F(K),S?.(K)},B=(K,ie)=>{M(ae=>({...ae,[K.id]:ie}))},V=(K,ie)=>{M(ae=>({...ae,[K.id]:ie?[ie]:[]}))},q=async()=>{M(Qa(u.map(K=>K.type==="checkbox"?{...K,selectedValues:[]}:{...K,selectedValue:null}))),await m(),_||I(!1)},P=async()=>{const K=Mm(A,u);await x(K),$&&I(!1)},te=K=>{if(K.type==="checkbox")return t.jsx(o.CheckboxGroup,{label:K.label,value:A[K.id]??[],onValueChange:ae=>B(K,ae),children:K.options.map(ae=>t.jsx(o.Checkbox,{value:ae.value,isDisabled:ae.isDisabled,children:ae.label},ae.value))},K.id);const ie=A[K.id]?.[0]??"";return t.jsx(o.RadioGroup,{label:K.label,value:ie,onValueChange:ae=>V(K,ae||null),children:K.options.map(ae=>t.jsx(o.Radio,{value:ae.value,isDisabled:ae.isDisabled,children:ae.label},ae.value))},K.id)},W=h.useMemo(()=>D>0?f?.(D)||`${D} filters applied`:void 0,[f,D]),Y=h.useMemo(()=>D===0?e||Za.noLabel:f?f(D):`${e} (${D})`,[D,e,f]);return t.jsx("div",{className:d,children:t.jsxs(o.Popover,{isOpen:E,onOpenChange:I,placement:"bottom-end",children:[t.jsx(o.PopoverTrigger,{children:t.jsxs(p.Button,{isDisabled:k,variant:n,color:r,size:i,className:c,"aria-label":a,"aria-haspopup":"dialog","aria-expanded":E,children:[t.jsx(p.Icon,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&D>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":W,children:D}):g==="summary"&&Y!==e?t.jsx("span",{className:"text-xs",children:Y}):null]})}),t.jsx(o.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(K=>te(K)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(p.Button,{variant:"light",color:"default",size:"sm",onPress:q,children:y}),t.jsx(p.Button,{color:"primary",size:"sm",onPress:P,children:j})]})]})})]})})};Bi.displayName="FilterPopover";const Pm="No sessions available for this date",Tm=e=>e==="sold-out"||e==="closed"?"danger":"success",Om=e=>{const a=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof a=="number"?`${a} left`:"Limited":typeof a=="number"?`${a} seats available`:"Available"},Kn=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",zm=(e,a)=>a&&e.some(s=>s.date===a)?a:e[0]?.date??null,Pi=({heading:e,subheading:a,days:s,selectedDate:n,onDateSelect:r,quickDates:i,selectedSessionId:c=null,onSessionSelect:l,emptyStateMessage:d=Pm,statusLabel:u,statusTone:x,sessionAriaLabel:m,dayButtonClassName:b,calendarSlot:f,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:y,headingClassName:v,subheadingClassName:C})=>{const S=zm(s,n),k=s.find(A=>A.date===S),$=i??s.map(A=>({date:A.date,label:A.label})),_=k?.sessions??[],N=A=>A===S?"solid":"bordered",F=A=>{if(!Kn(A)){if(A.id===c){l(null);return}l(A.id)}};return t.jsxs("section",{className:o.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",y),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:o.cn("text-base font-semibold text-gray-900",v),children:e}),a?t.jsx("p",{className:o.cn("text-sm text-gray-700",C),children:a}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[$.map(A=>t.jsx(p.Button,{size:"sm",variant:N(A.date),color:"default",className:o.cn("rounded-full",b),isDisabled:A.isDisabled,onPress:()=>{r(A.date)},children:t.jsx("span",{children:A.label})},A.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[_.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,_.map(A=>{const M=Kn(A),E=A.id===c;return t.jsx("li",{className:"rounded-xl",children:t.jsx(o.Card,{shadow:"sm",radius:"lg",isPressable:!M,onPress:()=>{F(A)},"aria-disabled":M,"aria-pressed":M?void 0:E,className:o.cn("w-full",M?"bg-gray-100 opacity-70":"",E?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(A,{isSelected:E,isUnavailable:M}):M?`${A.startTime} ${A.endTime} sold out`:`${A.startTime} ${A.endTime} available`,children:t.jsxs(o.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:[A.startTime," – ",A.endTime]}),t.jsx(o.Chip,{size:"sm",color:x?x(A):Tm(A.status),variant:"flat",children:u?u(A):Om(A)})]})})},A.id)})]})]})};Pi.displayName="SessionTimeline";const ms=16,lt=e=>`${e/ms}rem`;function Vm(){if(typeof document>"u"||typeof getComputedStyle!="function")return ms;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:ms}const ta=(e,a)=>e>=a*Vm(),Um=1120;function It(){const e=h.useRef(null),[a,s]=h.useState(0),[,n]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(c=>{const l=c[c.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(()=>n(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:a}}const Hm=48,Qe={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"},Wm=(e,a)=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e||a||null,Ti=({title:e,subtitle:a,eyebrow:s,icon:n,initials:r,actions:i,titleAs:c="h1",className:l,classNames:d={},"data-testid":u="page-header",list:x,narrow:m,headerRef:b})=>{const f=Wm(n,r);return t.jsxs("header",{ref:b,"data-testid":u,"data-variant":x?"list":void 0,"data-size":x?m?"narrow":"wide":void 0,className:o.cn(x?o.cn(Qe.base,m?Qe.baseNarrow:Qe.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:x?Qe.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{className:x?Qe.text:void 0,children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:o.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(c,{"data-testid":`${u}-title`,className:o.cn(x?m?Qe.titleNarrow:Qe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),a?t.jsx("p",{"data-testid":`${u}-subtitle`,className:o.cn(x?m?Qe.subtitleNarrow:Qe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:a}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:o.cn(x?m?Qe.actionsNarrow:Qe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},qm=e=>{const{ref:a,width:s}=It(),n=s>0&&!ta(s,Hm);return t.jsx(Ti,{...e,list:!0,narrow:n,headerRef:a})},Oi=e=>e.variant==="list"?t.jsx(qm,{...e}):t.jsx(Ti,{...e,list:!1,narrow:!1});Oi.displayName="PageHeader";const Ye={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function aa(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const Gm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},fs={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:Ye.info,violet:Ye.violet},Km={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Ym={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]"},Zm={info:fs.info,violet:fs.violet},zi=({status:e,label:a,variant:s="flat",size:n="sm",color:r,startContent:i,className:c,"data-testid":l="status-chip"})=>{if(s==="plain"){const u=Ye[Km[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Ym[n],"leading-[1.35]",c),style:{color:u.fg,backgroundColor:u.bg},children:[i,a]})}if(s==="dot"){const u=fs[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:o.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",c),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"}}),a]})}const d=r?void 0:Zm[e];return t.jsx(o.Chip,{color:r??Gm[e],variant:s,size:n,startContent:i,"data-testid":l,"data-status":e,className:o.cn("font-medium",c),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:a})};zi.displayName="StatusChip";const Qm={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"},la={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"},Ea=({label:e,value:a,size:s="sm",variant:n="default",className:r,"data-testid":i="key-value-chip"})=>n==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:o.cn(la.base,la[s],r),children:[t.jsx("span",{className:la.label,children:e}),t.jsx("span",{className:la.value,children:a})]}):t.jsxs("span",{"data-testid":i,className:o.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Qm[s],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:a})]});Ea.displayName="KeyValueChip";const Vi=({columns:e,rows:a=6,label:s="Loading",barHeight:n=12,alignLastRight:r=!1,appearance:i="pulse",className:c,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:o.cn("w-full",c,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:a}).map((u,x)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,b)=>{const f=b===e.length-1;return t.jsx("div",{className:o.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:o.cn(p.shimmerClass,l.bar),style:{height:lt(n),width:m==="fill"?"60%":lt(m),maxWidth:"100%"}})},b)})},x):t.jsx("div",{"data-testid":`${d}-row`,className:o.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,b)=>{const f=b===e.length-1;return t.jsx("div",{className:o.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:o.cn("animate-pulse rounded bg-default-200",p.stillAnimationClass,l.bar),style:{height:n,width:m==="fill"?"60%":m}})},b)})},x))})]});Vi.displayName="TableSkeleton";const Ts="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Os="px-4 text-[13.5px] text-acct-ink2 align-middle",zs="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Vs="w-full",Ui="border-t border-acct-border px-5 py-3.5",oa={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 ${p.stillTransitionClass}`,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"},Hi=({columns:e,children:a,emptyContent:s,footer:n,ariaLabel:r,variant:i="default",className:c,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:o.cn(u&&oa.base,c,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(p.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:o.cn(Vs,l.table),th:o.cn(u?oa.th:Ts,l.th),tr:o.cn(u?oa.tr:zs,l.tr),td:o.cn(u?oa.td:Os,l.td)},children:[t.jsx(o.TableHeader,{columns:e,children:x=>t.jsx(o.TableColumn,{align:x.align==="right"?"end":"start",width:x.width,children:x.label},x.key)}),t.jsx(o.TableBody,{emptyContent:s,children:a})]}),n?t.jsx("div",{"data-testid":`${d}-footer`,className:o.cn(!u&&Ui,l.footer),children:n}):null]})};Hi.displayName="AdminTable";const Xm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Us=({actions:e,size:a="md",className:s,"data-testid":n="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":n,className:o.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${n}-${r.key}`,className:o.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Xm[a]),children:r.icon},r.key))});Us.displayName="RowActions";const Jm=$e.palettes.warning[50],ef="solar:alt-arrow-down-outline",tf="solar:pen-2-outline",af={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"},ve={root:"w-full overflow-x-auto rounded-2xl border border-acct-border bg-acct-surface",table:Vs,th:Ts,alignRight:"text-right",thActions:"w-px",row:zs,rowOpen:"bg-acct-page hover:bg-acct-page",td:o.cn(Os,"py-3"),tdActions:"w-px whitespace-nowrap py-2 pl-2 pr-3 align-middle",actions:"flex items-center justify-end gap-0.5",toggle:"gap-1.5 text-acct-ink2 data-[hover=true]:bg-acct-hair",toggleOpen:"bg-acct-surface shadow-sm ring-1 ring-acct-border data-[hover=true]:bg-acct-surface",chevron:`size-4 shrink-0 transition-transform duration-150 ${p.stillTransitionClass}`,chevronOpen:"rotate-180",panelRow:"bg-acct-page",panelCell:"px-4 pb-4 pt-0",panel:"rounded-xl border border-acct-border bg-acct-surface p-4 shadow-sm",panelTitle:"mb-4 flex items-center gap-1.5 border-b border-acct-hair pb-3 text-xs font-semibold uppercase tracking-wide text-acct-sub",panelTitleIcon:"size-3.5 shrink-0",panelFooter:"mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-acct-hair pt-3",done:"border-acct-border bg-acct-surface",empty:"px-4 py-10 text-center text-sm text-acct-sub"},sf=new Set(["text","search","email","tel","url","number","password"]);function nf(e){return e instanceof HTMLInputElement&&sf.has(e.type)&&e.getAttribute("aria-expanded")!=="true"}function Yn(e){return o.cn(e.align==="right"&&ve.alignRight,e.hideBelow&&af[e.hideBelow])}function Wi({ariaLabel:e,columns:a,rows:s,getRowKey:n,getRowLabel:r,renderCell:i,renderExpanded:c,renderExpandedActions:l,getRowActions:d,rowNeedsFix:u,expandedKeys:x,defaultExpandedKeys:m,onExpandedChange:b,labels:f,emptyContent:g,className:j,"data-testid":y="expandable-table"}){const v=h.useId(),C=x!==void 0,[S,k]=h.useState(()=>new Set(m??[])),$=h.useMemo(()=>C?new Set(x):S,[C,x,S]),_=h.useRef(new Map),N=h.useRef(null),F=(E,D,I)=>{if($.has(E)===D)return;const B=new Set($);D?B.add(E):B.delete(E),C||k(B),b?.(B,{key:E,expanded:D,reason:I})};h.useLayoutEffect(()=>{const E=N.current;if(E===null||$.has(E))return;N.current=null;const D=document.activeElement;(D===null||D===document.body)&&_.current.get(E)?.focus()});const A=E=>D=>{if(D.defaultPrevented||D.nativeEvent.isComposing)return;const I=D.key==="Escape"?"escape":D.key==="Enter"&&nf(D.target)?"enter":null;I!==null&&(D.preventDefault(),D.stopPropagation(),F(E,!1,I))},M=a.length+1;return t.jsx("div",{"data-testid":y,className:o.cn(ve.root,j),children:t.jsxs("table",{"aria-label":e,className:ve.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[a.map(E=>t.jsx("th",{scope:"col",className:o.cn(ve.th,Yn(E)),style:E.width===void 0?void 0:{width:E.width},children:E.label},E.key)),t.jsx("th",{scope:"col",className:o.cn(ve.th,ve.thActions),children:t.jsx("span",{className:"sr-only",children:f.actions})})]})}),s.length===0&&p.hasContent(g)?t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:M,className:ve.empty,"data-testid":`${y}-empty`,children:g})})}):null,s.map((E,D)=>{const I=n(E),B=$.has(I),V=u?.(E)??!1,q=f.toggleRow(r(E)),P=`${v}-panel-${D}`,te=d?.(E,D)??[],W={rowIndex:D,close:()=>F(I,!1,"done")};return t.jsxs("tbody",{"data-testid":`${y}-row-${I}`,"data-expanded":B?"true":"false","data-needs-fix":V?"true":void 0,children:[t.jsxs("tr",{className:o.cn(ve.row,B&&ve.rowOpen),style:V&&!B?{backgroundColor:Jm}:void 0,children:[a.map(Y=>t.jsx("td",{className:o.cn(ve.td,Yn(Y)),children:i(E,Y.key,D)},Y.key)),t.jsx("td",{className:ve.tdActions,children:t.jsxs("div",{className:ve.actions,children:[t.jsx(p.Button,{ref:Y=>{Y?_.current.set(I,Y):_.current.delete(I)},variant:"light",color:"default",size:"sm",testId:`${y}-toggle-${I}`,"aria-label":q,"aria-expanded":B,"aria-controls":B?P:void 0,className:o.cn(ve.toggle,B&&ve.toggleOpen),endContent:t.jsx(p.Icon,{"aria-hidden":!0,icon:ef,className:o.cn(ve.chevron,B&&ve.chevronOpen)}),onPress:()=>F(I,!B,"toggle"),children:f.toggle}),te.length>0?t.jsx(Us,{actions:te,"data-testid":`${y}-actions-${I}`}):null]})})]}),B?t.jsx("tr",{className:ve.panelRow,children:t.jsx("td",{colSpan:M,className:ve.panelCell,children:t.jsxs("div",{role:"region",id:P,"aria-label":q,"data-testid":`${y}-panel-${I}`,className:ve.panel,onKeyDown:A(I),onFocus:()=>{N.current=I},onBlur:Y=>{const K=Y.relatedTarget;K&&!Y.currentTarget.contains(K)&&(N.current=null)},children:[p.hasContent(f.panelTitle)?t.jsxs("p",{className:ve.panelTitle,children:[t.jsx(p.Icon,{"aria-hidden":!0,icon:tf,className:ve.panelTitleIcon}),f.panelTitle]}):null,c(E,W),t.jsxs("div",{className:ve.panelFooter,children:[l?.(E,W),t.jsx(p.Button,{variant:"bordered",color:"default",size:"sm",testId:`${y}-done-${I}`,className:ve.done,onPress:W.close,children:f.done})]})]})})}):null]},I)})]})})}Wi.displayName="ExpandableTable";const rf=Xt["--warn"],Zn={root:"inline-flex shrink-0 items-center",dot:"block size-1.5 shrink-0 rounded-full"};function Hs({label:e,className:a,"data-testid":s="needs-fix-dot"}){return t.jsxs("span",{"data-testid":s,className:o.cn(Zn.root,a),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${s}-mark`,className:Zn.dot,style:{backgroundColor:rf}}),t.jsx("span",{className:"sr-only",children:e})]})}Hs.displayName="NeedsFixDot";function lf(e,a){return e.find(s=>s.needsFix&&!s.isDisabled)?.key??a}const zt={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"},cf=48,at={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"},Qn={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},ja={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Xn={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},Jn={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},qi=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:r,clearLabel:i,size:c,dataTestId:l,startContent:d,classNames:u})=>{const x=h.useRef(null),m=c==="lg",b=r&&e!==""?t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{a(""),x.current?.focus()},className:o.cn(Xn.button,Jn[c].button),testId:`${l}-search-clear`,children:t.jsx(p.Icon,{icon:"lucide:x","aria-hidden":"true",className:Jn[c].icon})}):void 0;return t.jsx(o.Input,{ref:x,type:"search","aria-label":s,placeholder:n??s,value:e,onValueChange:a,startContent:d,endContent:b,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:o.cn(u.inputWrapper,m&&ja.inputWrapper),innerWrapper:u.innerWrapper,input:o.cn(u.input,m&&ja.input,r&&Xn.input)}})},df=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c,children:l,trailing:d,searchWidth:u="md",size:x,className:m,"data-testid":b="admin-toolbar"})=>{const{ref:f,width:g}=It(),j=g>0&&!ta(g,cf),y=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":b,"data-variant":"framed","data-size":j?"narrow":"wide",className:o.cn(at.base,j&&at.narrow,m),children:[l,t.jsx("div",{"data-testid":`${b}-search-slot`,className:y?at.searchFill:j?at.searchNarrow:at.searchWide,children:t.jsx(qi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:x,dataTestId:b,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-search-icon`,className:o.cn(at.icon,x==="lg"&&ja.icon),children:r??t.jsx(p.Icon,{icon:"lucide:search"})}),classNames:{base:y?Qn.fill:j?at.inputBaseNarrow:Qn[u],inputWrapper:at.inputWrapper,innerWrapper:at.innerWrapper,input:at.input}})}),d]})},Gi=({searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i=!1,clearLabel:c="Clear search",children:l,trailing:d,searchWidth:u="md",size:x="md",variant:m="default",className:b,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(df,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchIcon:r,searchClearable:i,clearLabel:c,trailing:d,searchWidth:u,size:x,className:b,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:o.cn(zt.base,b),children:[t.jsx(qi,{searchValue:e,onSearchChange:a,searchLabel:s,searchPlaceholder:n,searchClearable:i,clearLabel:c,size:x,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:o.cn(zt.icon,x==="lg"&&ja.icon),children:r}):void 0,classNames:{base:of[u],inputWrapper:zt.inputWrapper,input:zt.input}}),l,d?t.jsx("div",{className:zt.trailing,children:d}):null]});Gi.displayName="AdminToolbar";const uf="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",mf="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",ff="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",Ki=h.forwardRef(function({icon:a,children:s,count:n,appearance:r="pill",className:i,testId:c,...l},d){return r==="outline"?t.jsxs(p.Button,{ref:d,"data-testid":c,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:o.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:mf,children:n})]}):t.jsxs(p.Button,{ref:d,"data-testid":c,variant:"light",size:"sm",className:o.cn(ff,i),...l,children:[t.jsx(p.Icon,{icon:a,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),n!==void 0&&n>0&&t.jsx("span",{className:uf,children:n})]})});Ki.displayName="ToolbarButton";const Xa="w-full mb-4 border-b border-pos-line",Ja=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",p.stillTransitionClass].join(" "),xf={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${p.stillTransitionClass}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${p.stillTransitionClass}`},lg:{base:Xa,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${Ja} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${p.stillTransitionClass}`},"sm-primary":{base:Xa,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${Ja} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${p.stillTransitionClass}`},"sm-secondary":{base:Xa,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${Ja} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${p.stillTransitionClass}`}},er={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},pf="inline-flex items-center gap-1.5",hf="data-[animated=true]:transition-none";function Yi({items:e,value:a,onChange:s,ariaLabel:n,size:r="md",level:i="primary",showDivider:c=!0,needsFixLabel:l,className:d,"data-testid":u="underline-tabs"}){const x=p.useReducedMotion(),m=xf[r==="sm"?`sm-${i}`:r],b=r!=="md",f=e.filter(g=>g.isDisabled).map(g=>g.key);return t.jsx(o.Tabs,{"aria-label":n,variant:"underlined",selectedKey:a,onSelectionChange:g=>s(String(g)),disabledKeys:f,disableCursorAnimation:b,"data-testid":u,"data-size":r,classNames:{...m,base:o.cn(m.base,!c&&er.base,d),tabList:o.cn(m.tabList,!c&&er.tabList),cursor:o.cn(m.cursor,x&&hf),panel:"p-0"},children:e.map(g=>{const j=`${u}-${g.key}`;return t.jsx(o.Tab,{title:g.needsFix?t.jsxs("span",{className:pf,children:[g.label," ",t.jsx(Hs,{label:l??"","data-testid":`${j}-needs-fix`})]}):g.label,titleValue:g.hint,"data-testid":j,"data-needs-fix":g.needsFix?"true":void 0,children:g.content},g.key)})})}Yi.displayName="UnderlineTabs";const Ws="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Zi="font-normal normal-case tracking-normal",Qi="ms-0.5 text-acct-danger",Xi="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",Ji="after:content-none",el="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",tl="size-4",al="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",sl=["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(" "),nl="text-[13.5px] text-acct-ink",rl="bg-acct-page text-acct-muted cursor-default",il="mt-[5px] text-xs text-acct-sub",ll="mt-[5px] text-xs text-acct-danger";function bf({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Qi,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function gf({help:e,label:a,labelledBy:s,testId:n}){const r=a?{"aria-label":a}:{"aria-labelledby":s};return t.jsxs(o.Popover,{placement:"top",showArrow:!0,children:[t.jsx(o.PopoverTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:n,className:el,children:t.jsx(p.Icon,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:tl})})}),t.jsx(o.PopoverContent,{...r,"data-testid":`${n}-content`,className:al,children:e})]})}function ol(e,a,s,n){return t.jsxs(t.Fragment,{children:[e,a?t.jsxs("span",{className:Zi,children:[" ",a]}):null,s?t.jsx(bf,{label:n}):null]})}const qs=({children:e,suffix:a,htmlFor:s,id:n,isRequired:r,requiredLabel:i,help:c,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const x=h.useId(),m=ol(e,a,r,i),b=p.hasContent(c),f=n??(b?x:void 0);return t.jsxs("div",{"data-testid":u,className:o.cn(Ws,d),children:[s?t.jsx("label",{id:f,htmlFor:s,children:m}):f?t.jsx("span",{id:f,children:m}):m,b&&f?t.jsx(gf,{help:c,label:l,labelledBy:f,testId:`${u}-help`}):null]})};qs.displayName="AdminFieldLabel";const cl=({label:e,labelSuffix:a,value:s,onChange:n,placeholder:r,disabled:i=!1,readOnly:c=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:x=!1,isRequired:m=!1,requiredLabel:b,help:f,helpLabel:g,className:j,"data-testid":y="admin-text-field"})=>{const v=h.useId(),C=h.useId(),S=p.hasContent(e),k=S&&p.hasContent(f),$=t.jsx(o.Input,{labelPlacement:S&&!k?"outside":void 0,label:S&&!k?ol(e,a,m,b):void 0,id:k?v:void 0,"aria-labelledby":k?C:void 0,value:s,placeholder:r,isDisabled:i,isReadOnly:c,autoFocus:d,isInvalid:x,isRequired:S&&m,validationBehavior:"aria",description:!x&&u?u:void 0,errorMessage:x?u:void 0,onValueChange:n,"data-testid":y,variant:"bordered",radius:"none",classNames:{base:o.cn("w-full",!k&&j),label:o.cn(Ws,Ji),inputWrapper:sl,input:o.cn(nl,(l||c)&&"font-mono",c&&rl),description:il,errorMessage:ll}});return k?t.jsxs("div",{className:o.cn("w-full",j),children:[t.jsx(qs,{id:C,htmlFor:v,suffix:a,isRequired:m,requiredLabel:b,help:f,helpLabel:g,className:Xi,"data-testid":`${y}-label`,children:e}),$]}):$};cl.displayName="AdminTextField";const yf=1440,xt=e=>String(e).padStart(2,"0"),dl=e=>e.toLowerCase().replace(/[\s.]/g,"");function wa(e){const[a=0,s=0]=e.split(":").map(Number);return a*60+s}function vf(e){return`${xt(Math.floor(e/60))}:${xt(e%60)}`}function xs(e){const a=/^(\d{1,2}):?(\d{2})?(?:(a|p)m?)?$/.exec(dl(e));if(!a)return null;let s=Number(a[1]);const n=Number(a[2]??0),r=a[3];if(n>59)return null;if(r){if(s<1||s>12)return null;s=s%12+(r==="p"?12:0)}else{if(s>23)return null;s>=1&&s<=6&&(s+=12)}return`${xt(s)}:${xt(n)}`}function jf(e,a,s){const n=Math.floor(s);if(!(n>=1))return[];const r=[],i=Math.min(wa(a),yf-1);for(let c=wa(e);c<=i;c+=n)r.push(vf(c));return r}function tr(e,a){return a.includes(":")?e.startsWith(a):e.replace(":","").startsWith(a)}function wf(e,a){const s=/^([\d:]*)(?:(a|p)m?)?$/.exec(dl(a));if(!s)return!1;const[,n="",r]=s,[i=0,c=0]=e.split(":").map(Number),l=`${i%12||12}:${xt(c)}`;return r?r==="p"!=i>=12?!1:tr(l,n):[l,`${xt(i)}:${xt(c)}`,`${i}:${xt(c)}`].some(d=>tr(d,n))}const ar=new Map;function sr(e,a){let s=ar.get(a);s||(s=new Intl.DateTimeFormat(a,{hour:"numeric",minute:"2-digit"}),ar.set(a,s));const[n=0,r=0]=e.split(":").map(Number);return s.format(new Date(2e3,0,1,n,r)).replace(/[\u00a0\u202f]/g," ")}const Vt=(e,a)=>a===void 0||wa(e)>=wa(a);function ul({value:e,defaultValue:a=null,onChange:s,label:n,"aria-label":r,placeholder:i,emptyContent:c,invalidMessage:l,minTime:d,minTimeMessage:u,listStart:x="07:00",listEnd:m="21:00",listStep:b=30,locale:f="en-US",isRequired:g=!1,isDisabled:j=!1,isInvalid:y=!1,errorMessage:v,isClearable:C=!1,clearLabel:S,onBlur:k,size:$,variant:_="bordered",labelPlacement:N="outside-top",className:F,inputProps:A,popoverProps:M,"data-testid":E="time-field"}){const[D,I]=_t(e,a,s),B=X=>X?sr(X,f):"",V=B(D),[q,P]=h.useState(V),[te,W]=h.useState(null),[Y,K]=h.useState(!1),[ie,ae]=h.useState(V);V!==ie&&(ae(V),P(V),W(null));const Q=q.trim()!==""&&q!==V,ne=Q?xs(q):null,z=Q?"typed":q.trim()===""&&!Y?"none":"all",O=Q?q:"",Z=h.useMemo(()=>jf(x,m,b),[x,m,b]),Re=h.useMemo(()=>{const X=Z.filter(L=>Vt(L,d));let w;if(z==="typed"){const L=X.filter(H=>wf(H,O)),R=xs(O);w=R!==null&&Vt(R,d)?[R,...L.filter(H=>H!==R)]:L}else z==="none"?w=[]:D!==null&&Vt(D,d)&&!X.includes(D)?w=[...X,D].sort():w=X;return w.map(L=>({key:L,label:sr(L,f)}))},[Z,d,z,O,D,f]),Ae=h.useCallback(X=>t.jsx(o.AutocompleteItem,{textValue:X.label,"data-testid":`${E}-option-${X.key}`,children:X.label},X.key),[E]),De=!Q&&D!==null&&Re.some(X=>X.key===D)?D:null,se=X=>{W(null),I(X),P(B(X))},ge=()=>{if(q.trim()===""){C?se(null):(P(V),W(null));return}Q&&(ne===null?W("invalid"):Vt(ne,d)?se(ne):W("min"))},Ee=h.useRef(!1),Ze=X=>{X!==null&&(Ee.current=!0,queueMicrotask(()=>{Ee.current=!1}),se(String(X)))},pe=D!==null&&!Vt(D,d),Le=te??(pe?"min":null),oe=Le!==null||y,he=Le==="invalid"?l:Le==="min"?u??l:v;return t.jsx(o.Autocomplete,{label:n,"aria-label":r,labelPlacement:N,placeholder:i,size:$,variant:_,className:F,"data-testid":E,allowsCustomValue:!0,isClearable:C,onClear:C?()=>se(null):void 0,clearButtonProps:C&&S?{"aria-label":S}:void 0,isRequired:g,isDisabled:j,isInvalid:oe,errorMessage:oe?he:void 0,validationBehavior:"aria",items:Re,inputValue:q,onInputChange:X=>{P(X),K(!1),te&&W(null)},selectedKey:De,onSelectionChange:Ze,onOpenChange:(X,w)=>K(X&&(w==="focus"||w==="manual")),onBlur:X=>{ge(),k?.(X)},onKeyDown:X=>{X.key==="Enter"&&!Ee.current&&ge(),(X.key==="ArrowDown"||X.key==="ArrowUp")&&K(!0),"continuePropagation"in X&&X.continuePropagation()},inputProps:A,popoverProps:M,listboxProps:{emptyContent:c},children:Ae})}ul.displayName="TimeField";const ml=({children:e,placeholder:a="Select…",onOpen:s,onClear:n,ariaLabel:r,icon:i,trailingIcon:c,clearIcon:l,disabled:d=!1,className:u,"data-testid":x="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":x,className:o.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(p.Button,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${x}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:a}),c?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:c}):null]}),m&&n?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:n,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${x}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};ml.displayName="PickerRow";const Fe={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Nf={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Cf={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"}},fl={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"}},kf={md:void 0,lg:"min-h-12 text-base"},Sf={none:"",sm:"gap-1",md:"gap-2"},xl="m-0 flex list-none flex-col p-0",At={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"]},pl=h.createContext(!1),$f=()=>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"})}),Af=()=>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 Df(e){const a=e.trim().split(/\s+/).filter(Boolean);if(a.length===0)return"—";const s=a[0]?.charAt(0)??"",n=a.length>1?a[a.length-1]?.charAt(0)??"":"";return`${s}${n}`.toUpperCase()}const hl=({title:e,subtitle:a,leading:s,tags:n,onPress:r,href:i,linkAs:c,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:x,actions:m,actionsLabel:b,actionsIcon:f,size:g,variant:j="plain",isDisabled:y=!1,as:v,className:C,"data-testid":S="entity-row"})=>{const k=h.useContext(pl),$=ka(),_=g??($==="touch"?"lg":"md"),N=fl[_],F=Cf[j],A=v??(k?"li":"div"),M=h.useId(),E=h.useId(),D=h.useId(),I=h.useId(),B=i!==void 0||r!==void 0,V=n!==void 0&&n.length>0,q=p.hasContent(a),P=m!==void 0&&m.length>0,te=typeof e=="string"?e:void 0,W=P&&m.some(O=>p.hasContent(O.description)),Y=P?m.filter(O=>O.isDisabled===!0&&p.hasContent(O.description)).map(O=>`${O.label}: ${O.description}`).join(" "):"",K=s?t.jsx(o.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??te,getInitials:s.initials!==void 0?O=>O:Df,showFallback:s.src!==void 0,classNames:{base:Fe.avatar},"data-testid":`${S}-leading`}):null,ie=t.jsxs(t.Fragment,{children:[K,t.jsxs("span",{className:Fe.text,children:[t.jsxs("span",{className:Fe.titleLine,children:[t.jsx("span",{id:M,className:o.cn(Fe.title,N.title),title:te,children:e}),V&&t.jsx("span",{id:E,className:Fe.tags,children:n.map(O=>t.jsx(o.Chip,{size:"sm",variant:"flat",color:O.tone??"default",className:Nf[O.tone??"default"],"data-testid":`${S}-tag-${O.key}`,children:O.label},O.key))})]}),q&&t.jsx("span",{id:D,className:o.cn(Fe.subtitle,N.subtitle),children:a})]})]}),ae=[V?E:null,q?D:null].filter(Boolean).join(" "),Q={"aria-labelledby":M,"aria-describedby":ae===""?void 0:ae,isDisabled:y,className:o.cn(Fe.pressTarget,F.overlay,N.content)},ne=`${S}-trigger`;let z;return i!==void 0?z=t.jsx(o.Link,{...Q,"data-testid":ne,as:c,href:i,color:"foreground",underline:"none",onPress:r,children:ie}):r!==void 0?z=t.jsx(p.Button,{...Q,testId:ne,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ie}):z=t.jsx("div",{className:o.cn(Fe.content,N.content),children:ie}),t.jsxs(A,{"data-testid":S,"data-size":_,"data-disabled":y||void 0,className:o.cn(Fe.base,F.row,N.row,B&&!y&&F.hover,C),children:[z,(p.hasContent(d)||P)&&t.jsxs("div",{className:Fe.side,children:[d,P&&t.jsxs(o.Dropdown,{placement:"bottom-end",children:[t.jsx(o.DropdownTrigger,{children:t.jsx(p.Button,{isIconOnly:!0,size:N.control,variant:"light",color:"default",radius:"full",isDisabled:y,"aria-label":b,"aria-describedby":Y===""?void 0:I,testId:`${S}-menu-trigger`,className:Fe.menuTrigger,children:f??t.jsx(Af,{})})}),t.jsx(o.DropdownMenu,{"aria-label":b,"data-testid":`${S}-menu`,className:W?Fe.menuWithDescriptions:void 0,disabledKeys:m.filter(O=>O.isDisabled).map(O=>O.key),onAction:O=>{m.find(Z=>Z.key===O)?.onAction()},items:m,children:O=>{const Z=O.isDisabled===!0&&p.hasContent(O.description);return t.jsx(o.DropdownItem,{textValue:O.label,description:O.description,color:O.tone==="danger"?"danger":"default",className:o.cn(O.tone==="danger"&&Fe.dangerItem,kf[_],Z&&Fe.menuItemDisabledWithDescription),classNames:{title:Z?Fe.menuItemDimmed:void 0,description:o.cn(Fe.menuItemDescription,N.subtitle)},startContent:Z&&O.icon!==void 0?t.jsx("span",{className:Fe.menuItemDimmedIcon,children:O.icon}):O.icon,"data-testid":O["data-testid"]??`${S}-menu-${O.key}`,children:O.label},O.key)}})]}),Y!==""&&t.jsx("span",{id:I,hidden:!0,"data-testid":`${S}-menu-trigger-description`,children:Y})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Fe.chevron,"data-testid":`${S}-chevron`,children:x??t.jsx($f,{})})]})};hl.displayName="EntityRow";const bl=({children:e,"aria-label":a,"aria-labelledby":s,gap:n="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":a,"aria-labelledby":s,"data-testid":i,className:o.cn(xl,Sf[n],r),children:t.jsx(pl.Provider,{value:!0,children:e})});bl.displayName="EntityList";const gl=({label:e,rows:a=6,size:s,className:n,"data-testid":r="entity-list-skeleton"})=>{const i=ka(),c=s??(i==="touch"?"lg":"md"),{titleWidths:l}=At;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:n,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:xl,children:Array.from({length:a},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:o.cn(At.row,fl[c].row),children:[t.jsx(p.Skeleton,{className:At.avatar[c]}),t.jsxs("span",{className:At.lines,children:[t.jsx(p.Skeleton,{className:o.cn(At.title,l[u%l.length])}),t.jsx(p.Skeleton,{className:At.subtitle})]})]},u))})]})};gl.displayName="EntityListSkeleton";function yl(e,a,s){if(s<=0||a<=0||e<=0)return{from:0,to:0};const n=(e-1)*a+1;return n>s?{from:0,to:0}:{from:n,to:Math.min(s,e*a)}}const vl=({page:e,pageSize:a,total:s,unit:n,announce:r=!0,format:i,className:c,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:x}=yl(e,a,s),m=o.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:o.cn("text-sm text-default-500",c,l.base),children:i?i({from:u,to:x,total:s}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${x}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:s}),n?t.jsxs(t.Fragment,{children:[" ",n]}):null]})})};vl.displayName="PaginationSummary";const La="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",rt={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"},Ef={card:La,flat:""},Lf={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]"},Ff={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:""}},jl=({isLoading:e=!1,isError:a=!1,isEmpty:s=!1,loadingTitle:n="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:c,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:x,emptyTitle:m="Nothing here yet",emptyDescription:b,emptyIcon:f,emptyActions:g,emptyContent:j,children:y,toolbar:v,variant:C="default",className:S,classNames:k={},"data-testid":$="list-panel"})=>{const _=C==="framed",N={base:o.cn("border-0 bg-transparent py-12",k.state)},F=_?{base:o.cn("px-6 py-[3.625rem]",k.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 A;return e?A=r??t.jsx(Bs,{title:n,classNames:N,"data-testid":`${$}-loading`}):a?A=x??t.jsx(Ms,{title:i,description:c,classNames:N,"data-testid":`${$}-error`,actions:u??(d?t.jsx(p.Button,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?A=j??t.jsx(Is,{surface:_?"panel":void 0,title:m,description:b,icon:f,actions:g,classNames:F,"data-testid":`${$}-empty`}):A=y,t.jsxs("section",{"data-testid":$,"data-variant":_?"framed":void 0,className:o.cn(_?`overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`:"rounded-xl bg-white p-2 shadow-sm",S,k.base),children:[v,A]})};jl.displayName="ListPanel";const Gs=(e,a)=>a<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${a}})?$`).test(e),Qt=e=>{const a=Number.parseFloat(e.replace(",","."));return Number.isFinite(a)?a:null},wl=(e,a)=>{const[s,n]=h.useState(()=>a(e)),r=(Qt(s)??0)===(e??0)?s:a(e),i=h.useCallback(()=>{n(c=>{const l=Qt(c);return l===null?"":String(l)})},[]);return{draft:r,setDraft:n,normalize:i}},_f=/^[\d.,]+$/,Nl=(e,a=Object.is)=>{const s=h.useRef(e),n=h.useRef(null);h.useLayoutEffect(()=>{s.current=e},[e]);const r=h.useCallback(()=>{const l=n.current,d=s.current;return l===null||!(a(d,l.source)||a(d,l.emitted))},[a]),i=h.useCallback(l=>{n.current={source:s.current,emitted:l}},[]),c=h.useCallback(()=>{n.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:c}),[r,i,c])},Cl=(e,a)=>{const s=h.useRef(null),n=h.useRef(a);return h.useLayoutEffect(()=>{n.current=a},[a]),h.useEffect(()=>{const r=s.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&_f.test(l.data)?(l.preventDefault(),n.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),n.current("")))},c=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",c),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",c)}},[e]),s},Rf=350,If={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}"},Mf=7,Bf=e=>[...new Set((e??[]).filter(a=>Number.isFinite(a)&&a>0))].sort((a,s)=>a-s).slice(0,Mf),Pf=(e,a,s)=>{if(!Number.isInteger(e))return me(e,a,s);try{return new Intl.NumberFormat(a,{style:"currency",currency:s,minimumFractionDigits:0}).format(e)}catch{return me(e,a,s)}},Tf=(e,a)=>(e??0)===(a??0),Ut=(e,a)=>Object.entries(a).reduce((s,[n,r])=>s.replace(`{${n}}`,r),e),Of=({dueAmount:e,received:a,defaultReceived:s=null,onChange:n,locale:r="en-US",labels:i,isDisabled:c=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:x=!1,className:m,"data-testid":b="cash-tender-form"})=>{const f={...If,...i},g=Rt(e.currency,r),j=a!==void 0,[y,v]=h.useState(s??null),C=j?a:y,{draft:S,setDraft:k,normalize:$}=wl(C,z=>z==null?"":String(z)),{isUntouched:_,markEdited:N,markUntouched:F}=Nl(C,Tf),A=h.useMemo(()=>{const z=typeof C=="number"&&Number.isFinite(C)?C:0,O=is(z,e.value,e.currency,r);return{received:z,change:O>0?O:0,isValid:z>=e.value&&z>0}},[C,e.value,e.currency,r]),M=h.useCallback(z=>{const O=z.currentTarget;requestAnimationFrame(()=>{O.isConnected&&O.select()})},[]),E=h.useCallback(z=>{j||v(z);const O=typeof z=="number"&&Number.isFinite(z)?z:0,Z=is(O,e.value,e.currency,r);n?.({received:O,change:Z>0?Z:0,isValid:O>=e.value&&O>0})},[j,e.value,e.currency,r,n]),D=h.useCallback(z=>{if(c)return;const O=z.replace(/[^\d.,]/g,"");if(!Gs(O,g))return;const Z=Qt(O);Z!==null&&l!==void 0&&Z>l||(k(O),N(Z),E(Z))},[c,l,k,N,g,E]),I=Cl(_,D),B=h.useMemo(()=>Bf(d),[d]),V=z=>l!==void 0&&z>l,q=()=>{c||V(e.value)||(k(String(e.value)),F(),E(e.value))},P=z=>{if(c)return;const O=_()||typeof C!="number"||!Number.isFinite(C)?0:C,Z=ks(O+z,e.currency,r);V(Z)||(k(String(Z)),N(Z),E(Z))},te=A.isValid&&A.change>0,W=!A.isValid&&A.received>0,Y=me(A.change,r,e.currency),K=me(e.value,r,e.currency),[ie,ae]=h.useState(""),Q=h.useRef(null);h.useEffect(()=>{Q.current&&clearTimeout(Q.current);const z=te?Ut(f.changeMessageTemplate,{change:Y}):"",O=te?Rf:0;return Q.current=setTimeout(()=>ae(z),O),()=>{Q.current&&clearTimeout(Q.current)}},[te,Y,f.changeMessageTemplate]);const ne=`${b}-received`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[t.jsx(o.Input,{ref:I,id:ne,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:S,onChange:z=>D(z.target.value),onFocus:M,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:c,isInvalid:W,errorMessage:W?Ut(f.insufficientMessageTemplate,{due:K}):void 0,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${b}-received-input`}),B.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${b}-quick-amounts`,children:[u&&t.jsxs(p.Button,{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:c,"aria-label":Ut(f.exactAmountAriaTemplate,{amount:K}),onPress:q,"data-testid":`${b}-quick-amount-exact`,children:[f.exactAmountLabel," ",K]}),B.map(z=>{const O=Pf(z,r,e.currency);return t.jsx(p.Button,{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:c,"aria-label":Ut(f.quickAmountAriaTemplate,{amount:O}),onPress:()=>P(z),"data-testid":`${b}-quick-amount-${z}`,children:O},z)})]})}),te&&t.jsx(o.Alert,{"data-testid":`${b}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Ut(f.changeMessageTemplate,{change:Y}),icon:t.jsx(p.Icon,{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:ie})]})},zf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},nr=()=>{const e=new Date,a=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${a(e.getMonth()+1)}-${a(e.getDate())}`},kl=({dueAmount:e,value:a,defaultValue:s,onChange:n,labels:r,hideDate:i=!1,hideBankName:c=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:x=!1,className:m,"data-testid":b="check-tender-form"})=>{const f={...zf,...r},g=a!==void 0,[j,y]=h.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??nr()}),[v,C]=h.useState(!!s?.checkNumber),S=h.useMemo(()=>g?{checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??nr()}:j,[g,a,j]),k=h.useCallback(E=>{g||y(E);const D=E.checkNumber.trim(),I={amount:e.value,checkNumber:D,bankName:E.bankName.trim()||void 0,date:i?void 0:E.date,isValid:D.length>0&&e.value>0};n?.(I)},[g,e.value,i,n]),$=h.useCallback(E=>D=>{l||(E==="checkNumber"&&D.length>0&&C(!0),k({...S,[E]:D}))},[S,k,l]),_=h.useCallback(()=>{l||C(!0)},[l]),N=v&&S.checkNumber.trim()==="",F=`${b}-check-number`,A=`${b}-bank-name`,M=`${b}-date`;return t.jsxs("div",{className:o.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":b,children:[t.jsx(o.Input,{id:F,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:E=>$("checkNumber")(E.target.value),onBlur:_,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:N,errorMessage:N?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${b}-check-number-input`}),!c&&t.jsx(o.Input,{id:A,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:E=>$("bankName")(E.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-bank-name-input`}),!i&&t.jsx(o.Input,{id:M,label:f.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:E=>$("date")(E.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${b}-date-input`,className:"sm:col-span-2"})]})};kl.displayName="CheckTenderForm";const Vf={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Uf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Sl=({dueAmount:e,methodOptions:a=Uf,value:s,defaultValue:n,onChange:r,labels:i,showReference:c=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const x={...Vf,...i},m=s!==void 0,[b,f]=h.useState({method:n?.method??"",reference:n?.reference??""}),g=h.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:b,[m,s,b]),j=h.useCallback($=>a.find(_=>_.value===$)?.label??"",[a]),y=h.useCallback($=>{m||f($);const _=j($.method),N={amount:e.value,method:$.method,description:_,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(N)},[m,e.value,r,j]),v=h.useCallback($=>{if(l)return;const _=typeof $=="string"?$:Array.from($)[0]?.toString()??"";y({...g,method:_})},[g,y,l]),C=h.useCallback($=>{l||y({...g,reference:$})},[g,y,l]),S=`${u}-method`,k=`${u}-reference`;return t.jsxs("div",{className:o.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(p.Select,{id:S,label:x.methodLabel,labelPlacement:"outside",placeholder:x.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:v,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:a.map($=>t.jsx(o.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),c&&t.jsx(o.Input,{id:k,label:x.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:$=>C($.target.value),placeholder:x.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Sl.displayName="OtherTenderForm";const Hf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Wf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},qf={pending:"warning",recorded:"success",failed:"danger"},Gf=e=>e==="pending"||e==="recorded",Kf=e=>`#${e+1}`,$l=({total:e,tenders:a,onRemove:s,locale:n="en-US",labels:r,hideCollectedList:i=!1,variant:c="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...Hf,...r},{collected:x,remaining:m,isComplete:b}=h.useMemo(()=>{const g=a.reduce((y,v)=>Gf(v.status)?y+v.amount:y,0),j=Math.max(e.value-g,0);return{collected:g,remaining:j,isComplete:g>=e.value&&e.value>0}},[a,e.value]),f=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:o.cn("flex flex-col gap-4",l),"data-testid":d,children:[c==="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:b?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:me(b?x:m,n,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:b?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:me(b?x:m,n,e.currency)})]}),!i&&a.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}),a.map((g,j)=>t.jsx(Yf,{index:j,tender:g,locale:n,currency:e.currency,removable:!!s&&g.status!=="recorded",onRemove:s?()=>s(g.id):void 0,statusLabel:f(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},g.id))]})]})};$l.displayName="SplitPaymentSummary";const Yf=({index:e,tender:a,locale:s,currency:n,removable:r,onRemove:i,statusLabel:c,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const x=i?t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:o.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(p.Icon,{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:Kf(e)}),t.jsx(p.Icon,{icon:Wf[a.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:a.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:me(a.amount,s,n)}),t.jsx(o.Chip,{size:"sm",radius:"full",variant:"flat",color:qf[a.status],startContent:a.status==="recorded"?t.jsx(p.Icon,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):a.status==="failed"?t.jsx(p.Icon,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:c}),x&&(r?x:t.jsx(o.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:x})}))]})},Zf=`
|
|
17
17
|
@keyframes pp-modal-in {
|
|
18
18
|
from { opacity: 0; transform: scale(0.96); }
|
|
19
19
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -38,5 +38,5 @@ ${n}${a}
|
|
|
38
38
|
from { opacity: 0; transform: translateY(-6px); }
|
|
39
39
|
to { opacity: 1; transform: translateY(0); }
|
|
40
40
|
}
|
|
41
|
-
`,Ro=h.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:oh}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));Ro.displayName="ModalShell";const Mo=({title:e,subtitle:s,leading:n,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(P,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Mo.displayName="ModalShellHeader";const Po=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",n),"data-testid":a,children:e});Po.displayName="ModalShellFooter";const ch={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"},dh={1:"grid-cols-1",2:"grid-cols-2"},Ct={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},qe={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${ke}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},vs=e=>typeof e=="string"?t.jsx(P,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,uh=(e,s,n)=>{const a=`${e}-${s.key}`;return{badge:n&&s.badge!==void 0?`${a}-badge`:void 0,reason:`${a}-reason`,description:n&&s.description!==void 0?`${a}-description`:void 0}},mh=e=>t.jsx("span",{"aria-hidden":"true",className:Ct.icon,children:typeof e=="string"?t.jsx(P,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),js=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${ke}`,fh="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Wr="flex-none",ph=typeof window<"u"?h.useLayoutEffect:h.useEffect,qr=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",To=({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:p="md",className:m,"data-testid":x="tile-select"})=>{const f=p==="sm",b=e.find(y=>y.key===s),v=e.some(y=>y.badge!==void 0||y.isLocked===!0),g=!f&&v;return i==="compact"?t.jsx(xh,{options:e,selectedKey:s,onSelect:n,ariaLabel:r,moreLabel:l,dataTestId:x,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":x,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${x}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(it,{"aria-label":a?void 0:r,"aria-labelledby":a?`${x}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const k=Array.from(y)[0];typeof k=="string"&&n(k)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${x}-mobile-select`,startContent:b?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:vs(b.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled||y.isLocked,...v&&y.description!==void 0?{description:y.description}:{},endContent:y.badge!==void 0?t.jsx("span",{className:qe.badge,children:y.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:vs(y.icon)}),"data-testid":y["data-testid"]??`${x}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${x}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",f?Ct.grid:"gap-3",dh[u],ch[d]),"data-size":p,children:e.map(y=>{const w=s===y.key,k=y.isLocked===!0&&y.isDisabled!==!0,N=y.lockedReason??y.badge,$=uh(x,y,g),D=[$.badge,k&&N!==void 0&&(f||N!==y.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":w,"aria-label":y.label,"aria-disabled":k||void 0,"aria-describedby":D||void 0,isDisabled:y.isDisabled,onPress:()=>{k||n(y.key)},"data-testid":y["data-testid"]??`${x}-${y.key}`,"data-locked":k||void 0,className:f?c.cn(Ct.tile,k?Ct.locked:w?Ct.active:Ct.idle):c.cn(qe.tile,g&&qe.detailed,k?qe.locked:w?qe.active:qe.idle),"data-size":p,children:[f?t.jsxs(t.Fragment,{children:[mh(y.icon),t.jsx("span",{className:Ct.label,children:y.label})]}):g?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:qe.header,children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:vs(y.icon)}),y.badge!==void 0?t.jsx("span",{id:$.badge,className:qe.badge,children:y.badge}):null]}),t.jsx("span",{className:qe.label,children:y.label}),y.description!==void 0?t.jsx("span",{id:$.description,className:c.cn(qe.description,k&&qe.lockedDescription),children:y.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:k?qe.lockedIcon:void 0,children:vs(y.icon)}),t.jsx("span",{className:qe.label,children:y.label})]}),k&&N!==void 0&&(f||N!==y.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:N}):null]},y.key)})})]})};To.displayName="TileSelect";function xh({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),p=h.useRef(null),m=h.useMemo(()=>e.map((L,S)=>({option:L,index:S})).filter(({option:L})=>L.alwaysInMenu!==!0).map(({index:L})=>L),[e]),x=m.length<e.length,f=h.useCallback(L=>{const S=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,A)=>E.priority-A.priority||A.index-E.index),M=new Set(S.slice(0,m.length-L).map(E=>E.index));return m.filter(E=>!M.has(E))},[e,m]),[b,v]=h.useState(e.length);ph(()=>{const L=u.current,S=p.current;if(!L||!S)return;const M=()=>{const A=Array.from(S.children),R=A.slice(0,e.length).map(q=>q.getBoundingClientRect().width),T=A[e.length]?.getBoundingClientRect().width??0,U=window.getComputedStyle(L),G=Number.parseFloat(U.columnGap)||0,I=L.clientWidth-(Number.parseFloat(U.paddingLeft)||0)-(Number.parseFloat(U.paddingRight)||0);if(I<=0||R.some(q=>q===0)){v(m.length);return}const se=q=>{const Q=x||q<m.length,Y=q+(Q?1:0);return f(q).reduce((ne,X)=>ne+(R[X]??0),0)+(Q?T:0)+G*(Y-1)<=I};for(let q=m.length;q>=1;q-=1)if(se(q)){v(q);return}v(1)};M();const E=new ResizeObserver(M);return E.observe(L),()=>E.disconnect()},[e,o,f,m,x]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),w=!x&&g===m.length-1&&b===m.length?m.length:g,k=x||w<m.length,N=new Set(f(w)),$=e.filter((L,S)=>N.has(S)),D=k?e.filter((L,S)=>!N.has(S)):[],j=D.find(L=>L.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(L=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":s===L.key,isDisabled:L.isDisabled||L.isLocked,onPress:()=>n(L.key),"data-testid":L["data-testid"]??`${d}-${L.key}`,className:c.cn(js,qr(s===L.key)),children:L.label},L.key)),D.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":j!==void 0,"data-testid":`${d}-more`,className:c.cn(js,"gap-1",j!==void 0?"min-w-0":"min-w-fit",qr(j!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:j?.label??o}),t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:j?[j.key]:[],disabledKeys:D.filter(L=>L.isDisabled||L.isLocked).map(L=>L.key),onAction:L=>n(String(L)),children:D.map(L=>t.jsx(c.DropdownItem,{textValue:L.label,...L.description!==void 0?{description:L.description}:{},"data-testid":L["data-testid"]??`${d}-${L.key}`,children:L.label},L.key))})]})]}),t.jsxs("div",{ref:p,"aria-hidden":"true",className:fh,children:[e.map(L=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(js,Wr),children:L.label},L.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(js,Wr,"gap-1"),children:[o,t.jsx(P,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const hh={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Io=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=hh[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:xe(e.value,n,e.currency)})]})};Io.displayName="PaymentTotalBanner";const bh={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Oo=({title:e,subtitle:s,backdrop:n="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",bh[n],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});Oo.displayName="LoadingOverlay";const Ca=({cashChange:e,label:s="Cash to return",secondaryLine:n,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(P,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),r&&t.jsx(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(P,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Ca.displayName="PaymentCashChangeBanner";const Bo=({title:e,subtitle:s,emailLine:n,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":p="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":p,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(P,{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":`${p}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Ca,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${p}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${p}-close`,className:"mt-4 w-full",children:l})]})};Bo.displayName="PaymentSuccessView";const ka=({heading:e,amountLabel:s,value:n,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:p,maxAmount:m,hideHeading:x=!1,className:f,"data-testid":b="payment-sub-amount-input"})=>{const v=`${b}-input`,g=n!==void 0,[y,w]=h.useState(a??""),k=g?n:y,{isUntouched:N,markEdited:$}=Eo(k),D=h.useCallback(S=>{if(m!==void 0){const M=Number.parseFloat(S.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(S),g||w(S),r?.(S)},[m,r,$,g]),j=Do(N,D),L=h.useCallback(S=>{const M=S.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",f),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",x&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{ref:j,id:v,label:s,labelPlacement:"outside",classNames:x?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:k,onChange:S=>D(S.target.value),onFocus:L,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:p,"data-testid":`${b}-field`})]})};ka.displayName="PaymentSubAmountInput";const gh={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"}},yh=e=>typeof e=="string"?t.jsx(P,{icon:e,className:"size-5","aria-hidden":"true"}):e,Sa=({isOpen:e,title:s,confirmLabel:n,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:p,isKeyboardDismissDisabled:m=!1,hideIcon:x=!1,icon:f,"data-testid":b="confirm-dialog"})=>{const v=i??o??null,g=gh[d],y=x?null:yh(f??g.icon);return t.jsx(cs,{isOpen:e,onOpenChange:w=>r?.(w),placement:"center",size:"md",isDismissable:(p??!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:[y?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:y}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),v!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof v=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:l}),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:n})]})]})})};Sa.displayName="ConfirmDialog";const wt={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"},vh={danger:"bg-danger-50",warning:"bg-warning-50"},zo=({message:e,description:s,confirmLabel:n,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:p="sm",as:m="div",className:x,"data-testid":f="inline-confirm"})=>{const b=h.useId(),v=h.useId(),g=h.useRef(null),y=h.useRef(null),w=h.useRef(null),k=s!=null,N=h.useRef({isPending:l,containEscape:u,onCancel:i});N.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?y:w).current?.focus()},[]),h.useEffect(()=>{const j=g.current;if(j===null)return;const L=S=>{S.key==="Escape"&&(N.current.containEscape&&S.stopPropagation(),!N.current.isPending&&N.current.onCancel())};return j.addEventListener("keydown",L),()=>j.removeEventListener("keydown",L)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const j=g.current;if(j===null)return;const L=document.activeElement;if(l){const S=L===null||L===document.body||!j.contains(L),M=L instanceof HTMLButtonElement&&L.disabled;$.current&&(S||M)&&j.focus({preventScroll:!0});return}L===j&&(d==="confirm"?y:w).current?.focus()},[l,d]);const D=t.jsx(c.Card,{ref:g,role:"alertdialog","aria-modal":"false","aria-labelledby":b,"aria-describedby":k?v:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:j=>{const L=j.relatedTarget;$.current=L instanceof Node&&j.currentTarget.contains(L)},className:c.cn(wt.box,vh[o],m==="div"&&x),"data-testid":f,children:t.jsxs(c.CardBody,{className:wt.body,children:[t.jsxs("div",{className:wt.text,children:[t.jsx("p",{id:b,className:wt.message,children:e}),k?t.jsx("p",{id:v,className:wt.description,children:s}):null]}),t.jsxs("div",{className:wt.actions,children:[t.jsx(O,{ref:y,size:p,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:n}),t.jsx(O,{ref:w,size:p,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(wt.item,x),children:D}):D};zo.displayName="InlineConfirm";const jh={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Ys=h.createContext(jh),$a=h.createContext(null);function wh(e){const{report:s,unreport:n}=h.useContext(Ys),a=h.useContext($a),r=h.useId();h.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),h.useEffect(()=>()=>n(r),[n,r])}function Nh(){const{guardScope:e,bypass:s}=h.useContext(Ys);return h.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function Vo(){const{guardScope:e}=h.useContext(Ys),s=h.useContext($a);return h.useCallback(n=>e(s,n),[e,s])}const Ch=({scope:e,children:s})=>t.jsx($a.Provider,{value:e,children:s}),Uo=({guard:e,children:s,title:n="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:p,report:m,unreport:x,guardScope:f}=e.internals,b=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:x}),[f,e.bypass,m,x]);return t.jsxs(Ys.Provider,{value:b,children:[s,t.jsx(Sa,{isOpen:l!==null,onOpenChange:v=>{v||p()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};Uo.displayName="DiscardGuard";const Aa=h.createContext(null);function kh(){const e=h.useContext(Aa),s=Vo(),n=e?.back,a=h.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const Sh=["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 $h(e){for(const s of e.querySelectorAll(Sh))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function Gr(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const Ah=new Set(["menu","listbox","dialog","grid","tree"]);function Eh(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||Ah.has(n.getAttribute("role")??""))return n}return null}const Kr="react-aria-focus-scope-restore";class Dh{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&Gr(s.last,n)?s.last:null)??(Gr(s.entry,n)?s.entry:null)??$h(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?Eh(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const Lh="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Fh="min-w-0 flex-1 truncate text-large font-semibold",_h="flex shrink-0 items-center gap-2",Rh="size-5";function Mh({panels:e,children:s}){const[n]=h.useState(()=>new Dh),{entries:a,back:r}=e,i=a[a.length-1].key,o=h.useRef(null);return h.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(Ph,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const Ph=({entryKey:e,isActive:s,canGoBack:n,back:a,memory:r,children:i})=>{const o=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const p=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Kr,p),()=>{u.removeEventListener(Kr,p),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(Aa.Provider,{value:d,children:t.jsx(Ch,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Ho=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(Aa),u=Vo(),p=h.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Lh,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":p,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(P,{icon:"solar:arrow-left-outline",className:Rh,"aria-hidden":"true"})}):null,t.jsx("h2",{id:p,className:Fh,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:_h,children:i}):null]})};Ho.displayName="ModalPanelHeader";function Th(e){const s=h.useRef(1),[n]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(p=>{const m=`panel-${s.current}`;return s.current+=1,{key:m,panel:p}},[]),o=h.useCallback(p=>{const m=i(p);r(x=>[...x,m])},[i]),l=h.useCallback(()=>{r(p=>p.length>1?p.slice(0,-1):p)},[]),d=h.useCallback(p=>{const m=i(p);r(x=>[...x.slice(0,-1),m])},[i]),u=h.useCallback(p=>{r([i(p===void 0?n:p)])},[i,n]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function Ih(){const e=h.useRef(new Map),[s,n]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let g=0;for(const y of e.current.values())y.isDirty&&(g+=1);n(g)},[]),d=h.useCallback((g,y)=>{e.current.set(g,y),l()},[l]),u=h.useCallback(g=>{e.current.delete(g),l()},[l]),p=h.useCallback((g,y)=>{let w=!1;for(const k of e.current.values())k.isDirty&&(g===null||k.scope===g)&&(w=!0);w?r({leave:y}):y()},[]),m=h.useCallback(g=>p(null,g),[p]),x=h.useCallback(g=>{for(const y of e.current.values())y.isDirty=!1;l(),r(null),g()},[l]),f=h.useCallback(g=>y=>{y?g(!0):m(()=>g(!1))},[m]),b=h.useCallback(()=>{const g=a?.leave;r(null),o(y=>y+1),g?.()},[a]),v=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:s>0,guard:m,bypass:x,guardOpenChange:f,internals:{pending:a,confirmKey:i,confirm:b,keepEditing:v,report:d,unreport:u,guardScope:p}}),[s,m,x,f,a,i,b,v,d,u,p])}const Oh=60,Bh=(e,s,n=Oh)=>s?e>n:e<-n,Wo=(e,s)=>Math.max(0,Math.min(e,s)),zh=160,Vh=(e,s,n=zh)=>Math.min(e,Math.max(0,s-n)),Uh=(e,s,n)=>Wo(e-s,n),Hh=(e,s,n)=>e!==null?Wo(e,n):s?n:0,Wh=e=>e?"":"transition-[height] duration-300 ease-out",qh=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Uh(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{Bh(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),$t=(e,s)=>xe(e.value,s,e.currency),Yr=`opacity-60 transition-opacity ${ke}`,Ea=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:Je[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&Yr),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&&Yr),children:$t(e.amount,s)}),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:()=>n(e.id),children:t.jsx(P,{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(P,{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(P,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,p)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??p}`,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??p}`,className:"flex shrink-0 items-center",children:t.jsx(P,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??p)),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(Ea,{item:u,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};Ea.displayName="SummaryItemRow";const qo=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:$t(e.amount,s)})]});qo.displayName="SummaryServiceFeeRow";const Da=({row:e,locale:s,emphasized:n,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(n?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(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(P,{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:$t(e.amount,s)})]})};Da.displayName="SummaryTotalsLineRow";const Go=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:p,emptyState:m,compact:x=!1,classNames:f})=>{const b=(n?.length??0)>0;return t.jsxs(t.Fragment,{children:[!x&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),b?t.jsx("div",{className:c.cn(x?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:n.map(v=>t.jsx(Ea,{item:v,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:p,compact:x},v.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(qo,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(x?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((v,g)=>t.jsx(Da,{row:v,locale:i,emphasized:!x&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:p,compact:x},v.key))})]})};Go.displayName="SummaryBody";const Ko=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:$t(e.amount,s)})]})};Ko.displayName="SummaryGrandTotalRow";const Yo=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:$t(e.amount,s)})]});Yo.displayName="SummarySecondaryTotalRow";const Is=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(P,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Is.displayName="SummaryPrimaryCta";const Qo=({title:e,total:s,secondaryTotal:n,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(P,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:$t(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:$t(n.amount,a)})]})]})]})});Qo.displayName="SummaryCollapseHeader";const Zo=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(P,{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})]});Zo.displayName="SummaryCartButton";const Xo=({open:e,progress:s,dragging:n,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:p})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",p.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(Zo,{cart:i,ariaLabel:o,className:p.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(Is,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",p.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(Is,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",p.cta)})})]}),l&&t.jsx("div",{children:l})]});Xo.displayName="SummaryActionBar";const Gh="(max-width: 767px)",Kh=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Yh=(e=Gh)=>{const[s,n]=h.useState(()=>Kh(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Jo=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:p,secondaryTotal:m,collapsible:x,isOpen:f,onToggleOpen:b,defaultOpen:v=!1,primaryAction:g,isLoading:y=!1,onRemoveItem:w,showRemoveButton:k,ctaCaption:N,ctaError:$,variant:D,cart:j,emptyState:L,labels:S,classNames:M={},density:E="default","data-testid":A="summary",className:R})=>{const T=S?.removeAriaLabel??"Remove item",U=S?.removeTotalRowAriaLabel??"Remove discount",G=S?.removePostTotalRowAriaLabel??"Remove applied code",I=S?.toggleAriaLabel??"Toggle summary",se=S?.cartAriaLabel??"View cart",q=E==="compact",Q=Yh(),ce=x??(D??(Q?"mobile":"main"))==="mobile",[ne,X]=h.useState(v),ie=f!==void 0,V=!ce||(ie?f:ne),z=h.useCallback(()=>{ie||X(B=>!B),b?.()},[ie,b]),[Z,Ie]=h.useState(0),[Fe,_e]=h.useState(null),ae=h.useRef(null),je=h.useRef(null),Re=h.useCallback(()=>{const B=ae.current;B&&Ie(Vh(B.scrollHeight,window.innerHeight))},[]),et=h.useCallback(B=>{je.current?.disconnect(),je.current=null,ae.current=B,B&&(Re(),typeof ResizeObserver<"u"&&(je.current=new ResizeObserver(Re),je.current.observe(B)))},[Re]);h.useEffect(()=>(window.addEventListener("resize",Re),()=>window.removeEventListener("resize",Re)),[Re]);const ge=qh({open:V,fullHeight:Z,setDragHeight:_e,onToggleOpen:z}),Me=Fe!==null,ue=Hh(Fe,V,Z),ye=Z>0?Math.min(1,Math.max(0,ue/Z)):V?1:0,J=t.jsx(Ko,{total:l,locale:a,compact:q,className:M.total}),C=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(B=>t.jsx(Da,{row:B,locale:a,emphasized:!1,onRemove:p,removeAriaLabel:G,showRemoveButton:k,compact:q},B.key))}),F=m&&t.jsx(Yo,{secondaryTotal:m,locale:a,className:M.secondaryTotal}),_=N!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:N}),W=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",M.ctaError),children:$}),H=t.jsx(Go,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:T,onRemoveTotalRow:u,removeTotalRowAriaLabel:U,showRemoveButton:k,emptyState:L,compact:q,classNames:M});return ce?t.jsxs(We.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ge.onDrag,onDragEnd:ge.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,M.base),children:[t.jsx(Qo,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:ye,dragging:Me,toggleAriaLabel:I,onToggleOpen:z,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:ue},className:c.cn("min-h-0",V&&!Me?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",Wh(Me)),children:t.jsxs("div",{ref:et,className:q?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[H,!q&&t.jsx(c.Divider,{className:"bg-default-200"}),J,C,F]})}),t.jsx(Xo,{open:V,progress:ye,dragging:Me,primaryAction:g,isLoading:y,cart:j,cartAriaLabel:se,ctaCaption:_,ctaError:W,onToggleOpen:z,classNames:M})]}):t.jsxs("section",{"data-testid":A,className:c.cn(q?"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,M.base),children:[!q&&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})}),H,!q&&t.jsx(c.Divider,{className:"bg-default-200"}),J,C,F,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(Is,{action:g,disabledByLoading:y,className:c.cn("w-full",M.cta)}),W,_]})};Jo.displayName="Summary";const ot={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},Qr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Qh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Zh={ariaLabel:"Progress",completed:"completed"},La=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...Zh,...i},u=e.filter(x=>x.state!=="skipped"),p=Math.max(0,u.findIndex(x=>x.id===s)),m=x=>x<p?"done":x===p?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(ot.list,o),"data-testid":l,children:u.map((x,f)=>{const b=m(f),v=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(ot.segment,"w-full",Qr[b]),"data-testid":`${l}-segment-${x.id}`}),t.jsxs("span",{className:c.cn(ot.name,Qh[b]),"data-testid":`${l}-name-${x.id}`,children:[b==="done"&&t.jsx("span",{"aria-hidden":"true",className:ot.check,"data-testid":`${l}-check-${x.id}`,children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:x.label}),b==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),g=r?r(x.id,f):f<p,y=b==="active"?"step":void 0;return t.jsx("li",{className:ot.item,"aria-current":a?void 0:y,"data-state":b,"data-testid":`${l}-step-${x.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(ot.step,ot.button),disabled:!g,"aria-current":y,onClick:()=>a(x.id),"data-testid":`${l}-button-${x.id}`,children:v}):t.jsx("div",{className:ot.step,children:v})},x.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(ot.bare,o),"data-testid":l,children:u.map((x,f)=>t.jsx("span",{className:c.cn(ot.segment,"flex-1",Qr[m(f)]),"data-state":m(f)},x.id))})};La.displayName="StepProgress";const Xh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},Jh={backgroundColor:de.destructive,color:"#fff"},eb={warn:{backgroundColor:de["warn-fill"],color:de.warn},ok:{backgroundColor:de["ok-fill"],color:de.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${de.line}`}},vn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",jn="absolute top-0 h-5 w-5 opacity-0",ec=({onClose:e,steps:s,activeStepId:n,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:p,className:m,"data-testid":x="wizard-shell",children:f})=>{const b={...Xh,...p},v=s.find(w=>w.id===n),g=r??e,y=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":x,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":`${x}-header`,children:[g&&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:g,"data-testid":`${x}-header-back`,startContent:t.jsx(P,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:y}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${x}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${x}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${x}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(jn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(jn,"left-6"),"data-testid":`${x}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(jn,"left-12"),"data-testid":`${x}-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":`${x}-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:b.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${x}-total-of`,children:xe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(vn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:b.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(vn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:b.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:vn,style:eb[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${x}-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"?Jh:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${x}-primary`,children:i.label})]})]}),t.jsx(La,{steps:s,activeStepId:n,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${x}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:f}),u]})};ec.displayName="WizardShell";const tb=(e,s,n)=>Math.min(Math.max(e,s),n);function On(e,s,n){const a=Math.max(1,Math.trunc(s)),r=tb(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Bt(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 sb(e,s){return On(e,s,1)}const nb=e=>Number.isFinite(e)?e.toFixed(2):"",Bn=({value:e,expected:s,max:n,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,p]=h.useState(null),m=h.useRef(null),x=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",x?"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??nb(e),onChange:f=>{const b=f.target.value,v=Number.parseFloat(b.replace(",","."));n!==void 0&&Number.isFinite(v)&&v>n+.004||(p(b),Number.isFinite(v)&&v>=0?a(v):b.trim()===""&&a(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>p(null),"data-testid":d})]})};Bn.displayName="AmountCell";const ab={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"},rb="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",Zr="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",ib=e=>{const s=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=sb(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(n.value,void 0,n.currency)} · ${s}`},tc=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...ab,...o},p=[{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 x=s[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,v=Math.max(1,Math.trunc(m.quantity)),g=x?.quantity,y=x?.selected?Math.min(g??v,v):g??0,w=On(m.paidAmount,v,y).value,k=x?.amount??(x?.selected?w:0),N=y===0&&k>.004,$=j=>n(m.id,{selected:j.quantity>0||j.amount>.004,mode:"full",...j}),D=j=>{const L=Math.min(Math.max(j,0),v);$({quantity:L,amount:On(m.paidAmount,v,L).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":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(P,{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??ib(m)}),N&&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:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(Bn,{value:k,expected:w,max:m.paidAmount.value,onChange:j=>$({quantity:y,amount:j}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),f?t.jsx("span",{className:rb,"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:Zr,"aria-label":u.decrease.replace("{name}",m.name),disabled:y===0,onClick:()=>D(y-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:y}),t.jsx("button",{type:"button",className:Zr,"aria-label":u.increase.replace("{name}",m.name),disabled:y===v,onClick:()=>D(y+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),y>=v&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(v))}),x?.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(P,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),y>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(it,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:j=>{if(j==="all")return;const L=[...j][0];L&&(r?.(m.id,L),a(m.id,L==="stock"))},"data-testid":`${b}-restock`,children:p.map(j=>t.jsx(c.SelectItem,{children:j.label},j.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(wn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:j=>n(m.id,{selected:j,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:()=>$({quantity:y,amount:w}),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(P,{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(P,{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(Bn,{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(P,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};tc.displayName="LineItemList";const lb={color:de.danger},sc=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});sc.displayName="MetaCard";const nc=({label:e,htmlFor:s,required:n,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:lb,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});nc.displayName="MetaCard.Row";const ac=({label:e,children:s,className:n,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});ac.displayName="MetaCard.Section";const ob=Object.assign(sc,{Row:nc,Section:ac}),rc=({heading:e,icon:s="lucide:rotate-ccw",action:n,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(P,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(P,{icon:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});rc.displayName="SectionPanel";const ic=({name:e,detail:s,icon:n="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(P,{icon:n,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});ic.displayName="CustomerCard";const cb={label:"Reason for the return",placeholder:"Select a reason…"},lc=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...cb,...i};return t.jsx(it,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const p=[...u][0];p&&n(String(p))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};lc.displayName="ReasonSelect";const db={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},oc=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...db,...i},[u,p]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>p(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};oc.displayName="NotesField";const ub={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},mb="solar:close-circle-linear",fb={callout:{root:"flex items-start gap-[0.5625rem] rounded-xl px-3.5 py-3 text-[0.78125rem] leading-normal",iconWrapper:"flex h-[1.5em] shrink-0 items-center",iconSize:"1.25em",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"",actions:"mt-2 flex flex-wrap items-center gap-2",dismiss:"-my-1.5 -me-2 size-8 min-w-8 shrink-0 text-current"},banner:{root:"flex items-start gap-3.5 rounded-[0.875rem] px-[1.125rem] py-4 text-pos-ink",iconWrapper:"flex size-10 shrink-0 items-center justify-center rounded-full",iconSize:"1.375rem",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"text-[0.8125rem] text-pos-neutral",actions:"mt-3 flex flex-wrap gap-2.5",dismiss:"-my-1 -me-1.5 size-8 min-w-8 shrink-0 text-pos-neutral"}},pb={info:{callout:"bg-pos-info-fill text-pos-info",banner:"bg-pos-info-fill",disc:"bg-pos-info/15 text-pos-info",title:"text-pos-info"},success:{callout:"bg-pos-ok-fill text-pos-ok",banner:"bg-pos-ok-fill",disc:"bg-pos-ok/15 text-pos-ok",title:"text-pos-ok"},warning:{callout:"bg-pos-warn-fill text-pos-warn",banner:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"},danger:{callout:"bg-pos-danger-fill text-pos-danger",banner:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"}},xb={info:"status",success:"status",warning:"alert",danger:"alert"};function Fa({tone:e="info",variant:s="callout",title:n,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=xb[e],className:d,"data-testid":u="notice"}){const p=Bs(),m=fb[s],x=pb[e],f=s==="banner",b=re(n),v=re(a),g=b?f?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,x.title),children:n}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:n}):null,y=v?f?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,b&&"mt-0.5"),children:a}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:a}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":s,"data-testid":u,className:c.cn(m.root,f?x.banner:x.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn(m.iconWrapper,f&&x.disc),children:t.jsx(P,{icon:ub[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[g,y]}):t.jsxs("p",{children:[g,b&&v?" ":null,y]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(O,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":o,onPress:i,disableAnimation:p,className:c.cn(m.dismiss,ke),"data-testid":`${u}-dismiss`,children:t.jsx(P,{icon:mb,width:"1.125rem",height:"1.125rem"})}):null]})}Fa.displayName="Notice";const Xr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Qs=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:p})=>t.jsx(Fa,{variant:"banner",tone:e,title:s,description:n,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[a&&t.jsx(O,{color:"primary",className:Xr,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(Xr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":p,children:o})]})});Qs.displayName="TenderBanner";const hb={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"},bb={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},cc=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...hb,...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(Qs,{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(p=>{const m=p.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(p.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-${p.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(P,{icon:bb[p.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:p.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(p.maxRefundable.value,void 0,p.maxRefundable.currency)})]})]},p.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(P,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};cc.displayName="TenderMethods";const gb=e=>e.refunded!==null,yb={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"},vb="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",jb="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",dc=({parts:e,refundedSoFar:s,remaining:n,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:p,className:m,"data-testid":x="split-tender-panel"})=>{const f={...yb,...p},b=e.filter(gb),v=e.find(j=>j.tenderId===a.tenderId)?.label,g=!!(r?.length&&a.onTenderChange),y=Bt(n.currency),{draft:w,setDraft:k,normalize:N}=Ao(a.amount,String),$=h.useCallback(j=>{Na(j,y)&&(k(j),a.onAmountChange(ls(j)??0))},[a,k,y]),D=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:f.title}),o&&t.jsx(Qs,{tone:D?"danger":"warning",title:D?f.declinedTitle:f.networkTitle,body:D?f.partDeclinedBody:f.partNetworkBody,onRetry:o.onRetry,retryLabel:f.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${x}-part-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{"data-testid":`${x}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",xe(s.value,void 0,s.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:vb,children:f.refundedSoFar}),b.map((j,L)=>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":`${x}-part-${j.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",L+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(P,{icon:j.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:j.label}),j.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:j.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(j.refunded.value,void 0,j.refunded.currency)}),t.jsx("span",{className:c.cn(jb,j.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:j.status==="pending"?f.pending:f.succeeded})]},j.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${x}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:f.partHeading.replace("{n}",String(b.length+1))}),v&&t.jsx("span",{className:"text-xs text-default-500",children:v})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:f.amountForPart}),t.jsx(ka,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:w,onChange:$,onBlur:N,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${x}-methods`,children:r?.map(j=>{const L=j.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":L,disabled:j.disabled||d,onClick:()=>a.onTenderChange?.(j.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",L?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${x}-method-${j.tenderId}`,children:[j.icon&&t.jsx(P,{icon:j.icon,width:15,height:15,"aria-hidden":"true"}),j.label]},j.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(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":`${x}-back`,children:f.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":`${x}-submit`,children:f.submit})]})]})};dc.displayName="SplitTenderPanel";const uc="hsl(var(--heroui-primary))",wb="hsl(var(--heroui-primary) / 0.05)",mc="hsl(var(--heroui-default-100))",fc="hsl(var(--heroui-default-600))",_a={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},me={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"},Nb={idle:{borderColor:de.line,backgroundColor:"#fff"},selected:{borderColor:uc,backgroundColor:wb},declined:{borderColor:de.danger,backgroundColor:de["danger-fill"]}},Os={idle:{backgroundColor:mc,color:fc},selected:{backgroundColor:uc,color:"#fff"}},Cb={backgroundColor:mc,color:fc},kb={borderColor:de.line},Jr={declined:{color:de.danger},pending:{color:de.warn,backgroundColor:de["warn-fill"]},done:{color:de.ok,backgroundColor:de["ok-fill"]}},Sb={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"},$b=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},Ab=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",p=u==="pending"||u==="done",m=n||p,x=!!(e.removable&&l),f=e.cap?.currency??s,b=Bt(f),v=`${d}-amount`,g=a.amountFor.replace("{method}",e.label),y=h.useCallback(D=>{if(!Na(D,b))return;const j=ls(D);e.cap&&j!==null&&j>e.cap.value||i(e.id,D)},[b,e.cap,e.id,i]),w=h.useCallback(D=>{const j=D.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]),k=u==="declined"?"declined":e.selected?"selected":"idle",N=e.statusLabel??(u==="idle"?void 0:a[u]),$=t.jsxs("span",{className:me.toggleHeader,children:[t.jsx("span",{className:me.iconBox,style:e.selected?Os.selected:Os.idle,"data-testid":`${d}-icon`,children:t.jsx(P,{icon:_a[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:me.text,children:[t.jsx("span",{className:me.label,children:e.label}),u==="declined"&&N?t.jsx("span",{className:me.status,style:Jr.declined,"data-testid":`${d}-status`,children:N}):e.subtitle&&t.jsx("span",{className:me.subtitle,children:e.subtitle})]}),p&&N&&t.jsx("span",{className:me.badge,style:Jr[u],"data-testid":`${d}-status`,children:N})]});return t.jsxs("div",{className:me.card,style:Nb[k],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(me.toggle,me.focusRing,x&&me.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:me.amountSlot,children:[t.jsx("label",{htmlFor:v,className:"sr-only",children:g}),t.jsx(c.Input,{id:v,"aria-label":g,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:D=>y(D.target.value),onFocus:w,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:$b(f)}),classNames:{inputWrapper:me.amountWrapper,input:me.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(me.toggle,me.toggleUnselected,me.focusRing,x&&me.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:me.lowerSlot,style:Cb,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",xe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),x&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:n,onClick:()=>l?.(e.id),className:c.cn(me.remove,me.focusRing),"data-testid":`${d}-remove`,children:t.jsx(P,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},pc=({methods:e,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:p,className:m,"data-testid":x="refund-method-cards"})=>{const f={...Sb,...p};return t.jsxs("div",{className:c.cn(me.root,m),"data-testid":x,children:[d&&t.jsx(Qs,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:me.banner,"data-testid":`${x}-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{className:me.eyebrowRow,children:[t.jsx("p",{className:me.eyebrow,children:f.heading}),o&&t.jsx(Gs,{variant:"record",label:o.label,value:o.value,"data-testid":`${x}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:me.grid,"data-testid":`${x}-grid`,children:[e.map(b=>t.jsx(Ab,{method:b,currency:i,busy:u,labels:f,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${x}-method-${b.id}`},b.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:me.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(me.another,me.focusRing),style:kb,"data-testid":`${x}-another`,children:[t.jsx("span",{className:me.iconBox,style:Os.idle,children:t.jsx(P,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:me.label,children:l.label}),t.jsx("span",{className:me.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:b=>l.onPick(String(b)),"data-testid":`${x}-another-menu`,children:b=>t.jsx(c.DropdownItem,{textValue:b.label,description:b.description,className:me.menuItem,startContent:t.jsx("span",{className:me.iconBox,style:Os.idle,children:t.jsx(P,{icon:_a[b.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${x}-another-option-${b.id}`,children:b.label},b.id)})]})]})]})};pc.displayName="RefundMethodCards";const Ge={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"},xc="hsl(var(--heroui-primary))",Eb={idle:{borderColor:de.line,backgroundColor:"#fff"},active:{borderColor:xc,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:de.danger,backgroundColor:de["danger-fill"]}},ei={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:xc,color:"#fff"}},Db={backgroundColor:"#fff",color:de.neutral},Rt=e=>({color:Je[e].fg,backgroundColor:Je[e].bg}),Lb={queued:Rt("neutral"),processing:Rt("info"),waiting_reader:Rt("warn"),waiting_cash:Rt("warn"),done:Rt("ok"),failed:Rt("danger")},Fb={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},_b={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},ti={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Rb=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",hc=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Fb,...n},o=s??e.find(Rb)?.id;return t.jsxs("div",{className:c.cn(Ge.root,a),"data-testid":r,children:[t.jsx("p",{className:Ge.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ge.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,p=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ge.row,style:Eb[p],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ge.main,children:[t.jsx("span",{className:Ge.iconBox,style:d?ei.active:ei.idle,children:t.jsx(P,{icon:_a[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ge.text,children:[t.jsx("span",{className:Ge.label,children:l.label}),l.note&&t.jsx("span",{className:Ge.note,children:l.note})]}),t.jsx("span",{className:Ge.amount,children:xe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ge.badge,style:Lb[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(P,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[_b[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ge.prompt,style:Db,"data-testid":`${u}-prompt`,children:[ti[l.status]&&t.jsx(P,{icon:ti[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ge.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Ge.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};hc.displayName="RefundProgressList";const Mb={label:"Supervisor authorization",placeholder:"••••"},bc=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...Mb,...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(P,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};bc.displayName="PinField";const Pb={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},Tb={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Ib={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Ob="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Xt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",Bb="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",zb=["email","print"],As=`${ke} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Se={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${As}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${As}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${As}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},gc=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:p,onSendReceipt:m,receiptActions:x,emailReceipt:f,onDone:b,frameless:v=!1,labels:g,className:y,"data-testid":w="outcome-view"})=>{const k={...Pb,...Tb[s],...g},N=h.useId(),$=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",y),"aria-live":"polite","data-testid":w,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${w}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${Hn}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:k.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${w}-processing-total`,children:$})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!v&&Bb,y),"aria-live":"polite","data-testid":w,children:[t.jsxs("div",{className:c.cn("text-center",s==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(P,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:Se.changeTitle,"data-testid":`${w}-title`,children:k.title}),t.jsx("p",{className:Se.changeLabel,children:k.changeDue}),t.jsx("p",{className:Se.changeAmount,"data-testid":`${w}-change`,children:xe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:Se.changeCaption,"data-testid":`${w}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${w}-title`,children:k.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${w}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${w}-reason`,children:k.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-paid-with`,children:[t.jsx("p",{className:Xt,children:k.paidWithTitle}),o.map((D,j)=>t.jsxs("div",{className:Se.paidRow,"data-testid":`${w}-paid-with-${j}`,children:[D.icon&&t.jsx("span",{className:Se.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(P,{icon:D.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:Se.paidLabel,children:D.label}),t.jsx("span",{className:Se.paidAmount,children:xe(D.amount.value,void 0,D.amount.currency)}),D.status&&t.jsx("span",{className:Se.paidStatus,children:D.status})]},`${D.label}-${j}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${w}-outcome`,children:[t.jsx("p",{className:Xt,children:k.outcomeTitle}),t.jsx("div",{className:Se.groups,children:l.map((D,j)=>t.jsxs("div",{"data-testid":`${w}-outcome-${j}`,children:[t.jsx("p",{className:Se.groupLabel,children:D.label}),t.jsx("ul",{className:Se.groupItems,"aria-label":D.label,children:D.items.map((L,S)=>t.jsx("li",{className:Se.groupItem,children:L},`${L}-${S}`))})]},`${D.label}-${j}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Xt,children:k.destinationsTitle}),a.map((D,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${w}-destination-${j}-${D.status}`,children:[t.jsx("span",{className:"font-semibold",children:D.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:xe(D.amount.value,void 0,D.amount.currency)}),t.jsx("span",{className:c.cn(Ob,Ib[D.status]),children:D.status==="succeeded"?k.succeeded:k.pending})]})]},`${D.label}-${j}`))]}),x&&x.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${w}-receipt-actions`,children:[t.jsx("p",{className:Xt,children:k.sendReceipt}),t.jsx("div",{className:Se.receiptRow,children:x.map(D=>t.jsx(Vb,{action:D,controls:D.expanded?N:void 0,"data-testid":`${w}-receipt-action-${D.key}`},D.key))}),f&&t.jsx(Ub,{id:N,email:f,labels:k,"data-testid":`${w}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Xt,children:k.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:zb.map(D=>{const j=p?.includes(D)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>m(D),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${ke}`,"data-testid":`${w}-receipt-${D}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:k[D]})]},D)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${w}-authorized-by`,children:k.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${As}`,onPress:b,"data-testid":`${w}-done`,children:k.done})})]})};gc.displayName="OutcomeView";function Vb({action:e,controls:s,"data-testid":n}){return t.jsx(O,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(Se.receiptAction,e.expanded&&Se.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(P,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":n,children:e.label})}function Ub({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:Se.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(Se.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:Se.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(O,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:Se.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(P,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${ke}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(O,{color:"secondary",className:Se.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Ve={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"},Hb="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",Wb="calc(100vw - 1.5rem)",yc=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(f=>f.value===s)?.label:void 0,u=h.useRef(null),p=h.useRef(null),[m,x]=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(Ve.base,l&&Ve.baseActive),style:i===void 0?void 0:{"--filter-select-min":mt(i)},children:[t.jsx(it,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const b=[...f][0];a(b===void 0?null:String(b))},onOpenChange:f=>{f&&x(u.current?.getBoundingClientRect().width)},popoverProps:{ref:p,placement:"bottom-start",style:{minWidth:m,maxWidth:Wb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Ve.select,Ve.cell),trigger:c.cn(Ve.trigger,l&&Ve.triggerActive),value:c.cn(Ve.value,l&&Ve.valueActive),selectorIcon:c.cn(l&&Ve.iconActive)},children:n.map(f=>t.jsx(c.SelectItem,{classNames:{title:Ve.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Ve.sizer,l&&Ve.sizerActive,Ve.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:Ve.clear,children:t.jsx(P,{icon:"lucide:x",className:Ve.clearIcon,"aria-hidden":"true"})})]})};yc.displayName="FilterSelect";const vc=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(Hb,s),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});vc.displayName="FilterSelectGroup";const bt={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"},jc=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(s),u=h.useRef(!1);return h.useEffect(()=>{d.current=s},[s]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const p=l.current;if(!p||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(x=>{u.current||!x.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(p),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:bt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:bt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:bt.base,children:[t.jsx("span",{"aria-hidden":"true",className:bt.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:bt.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:bt.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?bt.base:bt.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};jc.displayName="LoadMoreFooter";const Ee={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 ${ke}`,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"},si=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(Ee.headline,s&&Ee.headlineWithActions),children:[t.jsx("span",{className:Ee.title,children:e.title}),re(e.amount)&&!s&&t.jsx("span",{className:Ee.amount,children:e.amount})]}),s?(re(e.chips)||re(e.amount))&&t.jsxs("span",{className:Ee.chipsLine,children:[re(e.chips)&&t.jsx("span",{className:Ee.chipsInline,children:e.chips}),re(e.amount)&&t.jsx("span",{className:Ee.amount,children:e.amount})]}):re(e.chips)&&t.jsx("span",{className:Ee.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:Ee.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:Ee.row,children:[t.jsx("span",{className:Ee.rowLabel,children:n.label}),t.jsx("span",{className:Ee.rowValue,children:n.value})]},a))})]}),wc=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:Ee.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:Ee.skeletonRow,children:[t.jsx("div",{className:Ns,style:{height:mt(13),width:mt(130)}}),t.jsx("div",{className:Ns,style:{height:mt(11),width:"70%",marginTop:mt(10)}}),t.jsx("div",{className:Ns,style:{height:mt(11),width:"45%",marginTop:mt(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:Ee.list,children:e.map(o=>{const l=re(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:Ee.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn(Ee.card,Ee.cardInteractive),children:t.jsx(si,{item:o,withActions:l})}):t.jsx("div",{className:Ee.card,children:t.jsx(si,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:Ee.actions,children:o.actions})]},o.id)})})});wc.displayName="CardList";const qb=48,le={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Ks}`,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 ${ke}`,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"},Nc=h.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));Nc.displayName="CrumbBase";const Cc=({breadcrumb:e=[],onBack:s,backLabel:n,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:p,stats:m,banner:x,"data-testid":f="record-header"})=>{const{ref:b,width:v}=zt(),g=!ms(v,qb),y=e.length>0||!!s,w=!!(p&&p.length>0),k=!!i||re(o)||re(l)||re(d)||re(u)||w;return t.jsxs("div",{ref:b,"data-testid":f,"data-size":g?"narrow":"wide",className:le.base,children:[y&&t.jsxs("div",{"data-testid":`${f}-band`,className:le.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${f}-back`,className:le.back,children:t.jsx(P,{icon:"lucide:chevron-left",className:le.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:le.breadcrumb,list:le.breadcrumbList},itemClasses:{base:le.crumbBase,item:le.crumb,separator:le.crumbSeparator},children:e.map((N,$)=>t.jsx(c.BreadcrumbItem,{as:Nc,"data-testid":`${f}-crumb-${$}`,isDisabled:!N.onClick&&$<e.length-1,onPress:N.onClick?()=>N.onClick?.():void 0,children:N.label},$))})]}),t.jsxs("div",{className:c.cn(le.body,g?le.bodyNarrow:le.bodyWide),children:[t.jsxs("div",{className:le.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:c.cn(le.title,g?le.titleNarrow:le.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:le.meta,children:r.map((N,$)=>t.jsxs("li",{className:le.metaLine,children:[N.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:le.metaIcon,children:N.icon}),t.jsx("span",{className:le.metaText,children:N.text})]},$))})]}),k&&t.jsxs("div",{"data-testid":`${f}-money`,className:c.cn(le.money,g?le.moneyNarrow:le.moneyWide),children:[i&&t.jsx("div",{className:le.amountLabel,children:i}),re(o)&&t.jsx("div",{"data-testid":`${f}-amount`,className:c.cn(le.amount,g?le.amountNarrow:le.amountWide),children:o}),re(l)&&t.jsx("div",{className:le.amountCaption,children:l}),re(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:le.recordId,children:d}),re(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:c.cn(le.chips,g?le.chipsNarrow:le.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:le.statItems,children:p?.map((N,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:c.cn(le.stat,g?le.statNarrow:le.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:le.statLabel,children:N.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:le.statValue,style:N.tone?{color:Je[N.tone].fg}:void 0,children:N.value})]},N.id??$))})]})]}),re(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:g?le.statsNarrow:le.statsWide,children:m}),re(x)&&t.jsx("div",{"data-testid":`${f}-banner`,children:x})]})};Cc.displayName="RecordHeader";const Gb=50,Jt={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]"},kc=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=zt(),i=re(s),o=i&&r>0&&ms(r,Gb),l=t.jsx("div",{"data-testid":`${n}-main`,className:Jt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:Jt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(Jt.base,o?Jt.split:Jt.stacked),children:o?[l,d]:[d,l]})};kc.displayName="RecordLayout";const Kb=560,es={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"},Sc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=zt(),r=a>=sx?Math.max(e.length,1):a>=Kb?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:es.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:es.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:es.value,style:i.tone?{color:Je[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:es.label,children:i.label}),re(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:es.caption,children:i.caption})]},o))})};Sc.displayName="StatTiles";const ut={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"},Yb={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]"}},Ra="pill-tabs",Ma=(e,s=Ra)=>`${s}-tab-${e}`,Pa=(e,s=Ra)=>`${s}-panel-${e}`,Qb=(e,s=Ra)=>({role:"tabpanel",id:Pa(e,s),"aria-labelledby":Ma(e,s),tabIndex:0}),$c=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=Bs(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,p=Yb[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:ut.base,tabList:ut.tabList,cursor:ut.cursor,tab:c.cn(ut.tab,p.tab,(l||d)&&ut.tabStill),tabContent:c.cn(p.tabContent,ut.tabContent)},children:e.map(m=>{const x=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:Ma(m.key,u),"aria-controls":Pa(m.key,u),"data-testid":x,title:t.jsxs("span",{className:c.cn(ut.title,p.title),children:[re(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn(ut.icon,p.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${x}-count`,className:c.cn(p.count,ut.count),children:m.count})]})},m.key)})})};$c.displayName="PillTabs";const Ce={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 ${ke}`,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"},ni=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Ce.dot,style:{backgroundColor:Je[e.tone].fg}}),t.jsxs("span",{className:Ce.body,children:[t.jsx("span",{className:Ce.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:Ce.meta,children:[e.reference!=null&&t.jsx("span",{className:Ce.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:Ce.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:Ce.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:Ce.detail,children:e.detail})]}),t.jsx("span",{className:Ce.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:Ce.amount,style:fs(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:Ce.note,style:e.noteTone==="warn"?{color:Je.warn.fg}:void 0,children:e.note}):null})]}),Ac=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:Ce.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:Ce.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:Ce.base,children:[t.jsx("ul",{className:Ce.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:Ce.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(Ce.row,Ce.rowInteractive),children:t.jsx(ni,{row:i,testId:o})}):t.jsx("div",{className:Ce.row,children:t.jsx(ni,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:Ce.footer,children:[t.jsx("span",{className:Ce.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:Ce.footerAmount,style:fs(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:Ce.footerNote,children:s.note})]})]});Ac.displayName="AmountList";const Ye={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"},Ec=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ye.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ye.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ye.event,!i&&Ye.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ye.rail,children:[t.jsx("span",{className:Ye.dot,style:{backgroundColor:Je[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ye.connector})]}),t.jsxs("div",{className:Ye.body,children:[t.jsxs("div",{className:Ye.head,children:[t.jsx("span",{className:Ye.title,children:a.title}),t.jsx("span",{className:Ye.timestamp,children:a.timestamp})]}),re(a.detail)&&t.jsx("div",{className:Ye.detail,children:a.detail}),re(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ye.actor,children:a.actor})]})]},a.id)})});Ec.displayName="ActivityTimeline";const Te={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Ks}`,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 ${ke}`,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"},ai=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Te.rowBody,children:[t.jsxs("span",{className:Te.rowHead,children:[t.jsx("span",{className:e.onSelect?Te.primaryLinked:Te.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Te.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Te.amount,style:fs(e.amountTone),children:e.amount})]}),Dc=({title:e,count:s,rows:n,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Te.base,children:[o&&t.jsxs("div",{className:Te.header,children:[t.jsx("h3",{id:i,className:Te.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Te.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Te.empty,!o&&Te.emptyHeadless),children:a}):t.jsx("ul",{className:Te.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Te.item,d===0&&!o&&Te.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Te.row,Te.rowInteractive),children:t.jsx(ai,{row:l,testId:u})}):t.jsx("div",{className:Te.row,children:t.jsx(ai,{row:l,testId:u})})},l.id)})})]})};Dc.displayName="RelatedRecordList";const Lc=({title:e,titleAs:s="h2",icon:n,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:p="card",className:m,children:x,"data-testid":f="record-card"})=>{const b=h.useId(),v=re(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":p,role:v?"group":void 0,"aria-labelledby":v?b:void 0,className:c.cn(dt.base,Vx[p],m),children:[v&&t.jsxs("div",{"data-testid":`${f}-header`,className:Ux[d],children:[re(n)&&t.jsx("span",{"aria-hidden":"true",className:dt.icon,children:n}),t.jsx(s,{id:b,className:dt.title,children:e}),re(a)&&t.jsx("span",{"data-testid":`${f}-count`,className:dt.count,children:a}),r,re(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:dt.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:Hx[d][u],children:[re(o)&&t.jsx("p",{"data-testid":`${f}-description`,className:dt.description,children:o}),x,re(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:c.cn(dt.footer,re(x)?dt.footerAfterContent:dt.footerAfterDescription),children:l})]})]})};Lc.displayName="RecordCard";const Zb={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]"},Fc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(Zb[e],s),children:n});Fc.displayName="CardStack";const ws={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},Xb={regular:"py-[0.5625rem]",compact:"py-2"},_c=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:ws.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(ws.row,Xb[s]),children:[t.jsx("dt",{className:ws.label,children:a.label}),t.jsx("dd",{className:ws.value,children:a.value})]},a.id??r))});_c.displayName="KeyValueRows";const st={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"},Rc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:st.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=re(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:st.row,style:r.tone?{backgroundColor:Je[r.tone].bg}:void 0,children:[t.jsxs("div",{className:st.body,children:[t.jsx("div",{className:st.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:st.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:st.separator,children:"·"}),t.jsx("span",{className:st.detail,children:l})]},d))})]}),t.jsxs("div",{className:st.trailing,children:[t.jsxs("span",{className:st.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:st.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:st.amount,style:o?{color:Je.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Rc.displayName="LineItemRows";const Jb=37.5,Oe={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},Mc=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=zt(),o=i>0&&!ms(i,Jb),l=o?Oe.rowNarrow:Oe.rowWide,d=o?Oe.labelNarrow:Oe.labelWide,u=o?Oe.noteNarrow:Oe.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:Oe.base,children:[e.map(p=>{const m=`${a}-row-${p.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,Oe.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Oe.label),children:p.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Oe.note),children:p.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Oe.value,style:fs(p.tone),children:p.value})]},p.id)}),t.jsx("div",{className:Oe.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,Oe.totalRow),children:[t.jsx("span",{className:c.cn(d,Oe.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Oe.totalValue,children:s.value})]})}),re(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Oe.memo,children:n})]})};Mc.displayName="RecordTotals";const zn={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},eg={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Pc=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(zn.base,eg[e]),style:fs(s),children:[a,re(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:zn.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});Pc.displayName="CellText";const Tc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:zn.chipStack,children:e});Tc.displayName="ChipStack";function Ic({testId:e,title:s,description:n}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}Ic.displayName="SessionExpiredCard";exports.ActivityTimeline=Ec;exports.AdminFieldLabel=wa;exports.AdminTable=Yl;exports.AdminTextField=xo;exports.AdminToolbar=Xl;exports.AmountList=Ac;exports.AppliedCodeCard=Si;exports.Button=O;exports.CardList=wc;exports.CardStack=Fc;exports.CashTenderForm=Xx;exports.CatalogItemCard=Pl;exports.CellText=Pc;exports.CheckTenderForm=Lo;exports.ChipStack=Tc;exports.CommitmentDetails=Vf;exports.ConfirmDialog=Sa;exports.ConfirmationModal=da;exports.ConfirmationPageTemplate=am;exports.CustomerCard=ic;exports.DATE_PICKER_DAY_DEFAULTS=zu;exports.DatePicker=Jn;exports.DensityProvider=wd;exports.DimensionChip=Gs;exports.DiscardGuard=Uo;exports.DonationAmounts=ll;exports.Drawer=Yi;exports.EmptyState=ua;exports.EntityList=No;exports.EntityListSkeleton=Co;exports.EntityRow=wo;exports.ErrorState=ma;exports.EventDetails=Gm;exports.EventDetailsTemplate=im;exports.ExpandableTable=Ql;exports.ExpireCartTimer=ol;exports.FeedbackState=us;exports.FilterPopover=Vl;exports.FilterSelect=yc;exports.FilterSelectGroup=vc;exports.Footer=pm;exports.HeroUIProvider=hd;exports.HorizontalSteps=Xi;exports.InlineConfirm=zo;exports.InstallmentFundAssignment=Tf;exports.InstallmentFundAssignmentSkeleton=Bf;exports.InstallmentSchedule=lp;exports.InstallmentScheduleSkeleton=xp;exports.InstallmentTable=yp;exports.ItemCard=Ml;exports.KeyValueChip=Gs;exports.KeyValueRows=_c;exports.LineItemList=tc;exports.LineItemRows=Rc;exports.ListPanel=$o;exports.LoadMoreFooter=jc;exports.LoadingOverlay=Oo;exports.LoadingState=fa;exports.MembershipSelectCards=Cp;exports.MetaCard=ob;exports.Modal=cs;exports.ModalPanelHeader=Ho;exports.ModalPanels=Mh;exports.ModalShell=Ro;exports.ModalShellFooter=Po;exports.ModalShellHeader=Mo;exports.Multiselect=xm;exports.Navbar=nm;exports.NeedsFixDot=va;exports.NotesField=oc;exports.Notice=Fa;exports.OfferCard=Ls;exports.OfferCardEmpty=cl;exports.OfferCardError=dl;exports.OfferCardList=pl;exports.OfferCardSkeleton=ul;exports.OtherTenderForm=Fo;exports.OutcomeView=gc;exports.PageHeader=Wl;exports.PaginationSummary=So;exports.PaymentCashChangeBanner=Ca;exports.PaymentSubAmountInput=ka;exports.PaymentSuccessView=Bo;exports.PaymentTotalBanner=Io;exports.PickerRow=go;exports.PillTabs=$c;exports.PinField=bc;exports.ProgramListItem=Tl;exports.RICH_TEXT_PRESETS=rl;exports.ReasonSelect=lc;exports.RecordCard=Lc;exports.RecordHeader=Cc;exports.RecordLayout=kc;exports.RecordTotals=Mc;exports.RedeemCodeInput=Ju;exports.RefundMethodCards=pc;exports.RefundProgressList=hc;exports.RelatedRecordList=Dc;exports.RevenueDistributionCard=Sl;exports.RevenueDistributionEmpty=$l;exports.RevenueDistributionError=Al;exports.RevenueDistributionSkeleton=El;exports.RichTextArea=il;exports.RowActions=ya;exports.SectionPanel=rc;exports.Select=it;exports.SessionExpiredCard=Ic;exports.SessionTimeline=Ul;exports.Skeleton=oe;exports.SplitPaymentSummary=_o;exports.SplitTenderPanel=dc;exports.StatTiles=Sc;exports.StatusChip=ql;exports.StepPager=sl;exports.StepProgress=La;exports.Stepper=Zi;exports.StepsReadiness=tl;exports.SuccessState=Ol;exports.Summary=Jo;exports.Table=ea;exports.TableSkeleton=Gl;exports.TenderMethods=cc;exports.TicketSelection=Kp;exports.TileSelect=To;exports.TimeField=bo;exports.ToastProvider=vd;exports.Toggle=Bl;exports.ToolbarButton=Jl;exports.UnderlineTabs=eo;exports.VerticalSteps=el;exports.WizardShell=ec;exports.adminFieldErrorClass=fo;exports.adminFieldHelpButtonClass=ro;exports.adminFieldHelpContentClass=lo;exports.adminFieldHelpIconClass=io;exports.adminFieldHintClass=mo;exports.adminFieldLabelClass=ja;exports.adminFieldLabelNoAutoMarkClass=ao;exports.adminFieldLabelRowClass=no;exports.adminFieldLabelSuffixClass=to;exports.adminFieldRequiredClass=so;exports.adminInputClass=co;exports.adminInputReadOnlyClass=uo;exports.adminInputWrapperClass=oo;exports.adminRowClass=ba;exports.adminSurfaceCss=xd;exports.adminSurfaceTokens=os;exports.adminTableClass=ga;exports.adminTableFooterClass=Kl;exports.adminTdClass=ha;exports.adminThClass=xa;exports.assistantSurfaceTokens=Un;exports.calculateAllocationDifference=Sf;exports.computeChange=Dn;exports.currencyFractionDigits=Bt;exports.firstNeedsFixKey=yx;exports.formatMoney=xe;exports.formatOfferCurrency=Fn;exports.formatRevenueAmount=wf;exports.formatRevenueCurrency=Nf;exports.generateAutomaticInstallments=Fl;exports.generateDistributionId=ca;exports.getCurrencySymbol=Cf;exports.offerCardVariants=fl;exports.offerListVariants=ml;exports.pageRange=ko;exports.parseOfferCurrency=Km;exports.parseRevenueCurrency=kf;exports.parseTimeInput=In;exports.pillTabId=Ma;exports.pillTabPanelId=Pa;exports.pillTabPanelProps=Qb;exports.posSurfaceTokens=de;exports.roundToCurrency=ta;exports.useControlSize=jd;exports.useDensity=zs;exports.useDiscardGuard=Ih;exports.useDiscardGuardActions=Nh;exports.useModalPanel=kh;exports.useModalPanels=Th;exports.useReportUnsavedChanges=wh;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
41
|
+
`,Al=h.forwardRef(({children:e,relativeOverlayRoot:a=!0,className:s,style:n,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Zf}),t.jsx("div",{ref:i,"data-testid":r,style:n,className:o.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",a&&"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})]}));Al.displayName="ModalShell";const Dl=({title:e,subtitle:a,leading:s,titleClassName:n,onClose:r,closeLabel:i="Close",actions:c,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:o.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:o.cn("text-xl font-semibold",n),"data-testid":`${d}-title`,children:e}),a&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:a})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[c,r&&t.jsx(p.Button,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Dl.displayName="ModalShellHeader";const El=({children:e,columns:a=2,className:s,"data-testid":n="modal-shell-footer"})=>t.jsx("footer",{className:o.cn("mt-2 gap-3",a===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":n,children:e});El.displayName="ModalShellFooter";const Qf={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"},Xf={1:"grid-cols-1",2:"grid-cols-2"},yt={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},Ve={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${p.stillTransitionClass}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},ca=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Jf=(e,a,s)=>{const n=`${e}-${a.key}`;return{badge:s&&a.badge!==void 0?`${n}-badge`:void 0,reason:`${n}-reason`,description:s&&a.description!==void 0?`${n}-description`:void 0}},ex=e=>t.jsx("span",{"aria-hidden":"true",className:yt.icon,children:typeof e=="string"?t.jsx(p.Icon,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),da=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${p.stillTransitionClass}`,tx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",rr="flex-none",ax=typeof window<"u"?h.useLayoutEffect:h.useEffect,ir=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",Ll=({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:c,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:x="md",className:m,"data-testid":b="tile-select"})=>{const f=x==="sm",g=e.find(v=>v.key===a),j=e.some(v=>v.badge!==void 0||v.isLocked===!0),y=!f&&j;return i==="compact"?t.jsx(sx,{options:e,selectedKey:a,onSelect:s,ariaLabel:r,moreLabel:l,dataTestId:b,...n!==void 0?{heading:n}:{},...c!==void 0?{maxVisible:c}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:o.cn("flex flex-col gap-3",m),"data-testid":b,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${b}-heading`,children:n}),t.jsx("div",{className:"md:hidden",children:t.jsx(p.Select,{"aria-label":n?void 0:r,"aria-labelledby":n?`${b}-heading`:void 0,selectedKeys:a?[a]:[],onSelectionChange:v=>{const S=Array.from(v)[0];typeof S=="string"&&s(S)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${b}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ca(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(v=>t.jsx(o.SelectItem,{isDisabled:v.isDisabled||v.isLocked,...j&&v.description!==void 0?{description:v.description}:{},endContent:v.badge!==void 0?t.jsx("span",{className:Ve.badge,children:v.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ca(v.icon)}),"data-testid":v["data-testid"]??`${b}-${v.key}-mobile`,children:v.label},v.key))})}),t.jsx("div",{role:"group","aria-labelledby":n?`${b}-heading`:void 0,"aria-label":n?void 0:r,className:o.cn("hidden md:grid",f?yt.grid:"gap-3",Xf[u],Qf[d]),"data-size":x,children:e.map(v=>{const C=a===v.key,S=v.isLocked===!0&&v.isDisabled!==!0,k=v.lockedReason??v.badge,$=Jf(b,v,y),_=[$.badge,S&&k!==void 0&&(f||k!==v.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(p.Button,{variant:"bordered",radius:"lg","aria-pressed":C,"aria-label":v.label,"aria-disabled":S||void 0,"aria-describedby":_||void 0,isDisabled:v.isDisabled,onPress:()=>{S||s(v.key)},"data-testid":v["data-testid"]??`${b}-${v.key}`,"data-locked":S||void 0,className:f?o.cn(yt.tile,S?yt.locked:C?yt.active:yt.idle):o.cn(Ve.tile,y&&Ve.detailed,S?Ve.locked:C?Ve.active:Ve.idle),"data-size":x,children:[f?t.jsxs(t.Fragment,{children:[ex(v.icon),t.jsx("span",{className:yt.label,children:v.label})]}):y?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ve.header,children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:ca(v.icon)}),v.badge!==void 0?t.jsx("span",{id:$.badge,className:Ve.badge,children:v.badge}):null]}),t.jsx("span",{className:Ve.label,children:v.label}),v.description!==void 0?t.jsx("span",{id:$.description,className:o.cn(Ve.description,S&&Ve.lockedDescription),children:v.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:S?Ve.lockedIcon:void 0,children:ca(v.icon)}),t.jsx("span",{className:Ve.label,children:v.label})]}),S&&k!==void 0&&(f||k!==v.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:k}):null]},v.key)})})]})};Ll.displayName="TileSelect";function sx({options:e,selectedKey:a,onSelect:s,heading:n,ariaLabel:r,maxVisible:i,moreLabel:c,className:l,dataTestId:d}){const u=h.useRef(null),x=h.useRef(null),m=h.useMemo(()=>e.map((F,A)=>({option:F,index:A})).filter(({option:F})=>F.alwaysInMenu!==!0).map(({index:F})=>F),[e]),b=m.length<e.length,f=h.useCallback(F=>{const A=m.map(E=>({index:E,priority:e[E]?.priority??0})).sort((E,D)=>E.priority-D.priority||D.index-E.index),M=new Set(A.slice(0,m.length-F).map(E=>E.index));return m.filter(E=>!M.has(E))},[e,m]),[g,j]=h.useState(e.length);ax(()=>{const F=u.current,A=x.current;if(!F||!A)return;const M=()=>{const D=Array.from(A.children),I=D.slice(0,e.length).map(W=>W.getBoundingClientRect().width),B=D[e.length]?.getBoundingClientRect().width??0,V=window.getComputedStyle(F),q=Number.parseFloat(V.columnGap)||0,P=F.clientWidth-(Number.parseFloat(V.paddingLeft)||0)-(Number.parseFloat(V.paddingRight)||0);if(P<=0||I.some(W=>W===0)){j(m.length);return}const te=W=>{const Y=b||W<m.length,K=W+(Y?1:0);return f(W).reduce((ae,Q)=>ae+(I[Q]??0),0)+(Y?B:0)+q*(K-1)<=P};for(let W=m.length;W>=1;W-=1)if(te(W)){j(W);return}j(1)};M();const E=new ResizeObserver(M);return E.observe(F),()=>E.disconnect()},[e,c,f,m,b]);const y=Math.max(1,Math.min(g,i??m.length,m.length)),C=!b&&y===m.length-1&&g===m.length?m.length:y,S=b||C<m.length,k=new Set(f(C)),$=e.filter((F,A)=>k.has(A)),_=S?e.filter((F,A)=>!k.has(A)):[],N=_.find(F=>F.key===a);return t.jsxs("div",{className:o.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[n&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:n}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":n?`${d}-heading`:void 0,"aria-label":n?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(F=>t.jsx(p.Button,{variant:"light",radius:"full","aria-pressed":a===F.key,isDisabled:F.isDisabled||F.isLocked,onPress:()=>s(F.key),"data-testid":F["data-testid"]??`${d}-${F.key}`,className:o.cn(da,ir(a===F.key)),children:F.label},F.key)),_.length>0&&t.jsxs(o.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(o.DropdownTrigger,{children:t.jsxs(p.Button,{variant:"light",radius:"full","aria-pressed":N!==void 0,"data-testid":`${d}-more`,className:o.cn(da,"gap-1",N!==void 0?"min-w-0":"min-w-fit",ir(N!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:N?.label??c}),t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(o.DropdownMenu,{"aria-label":c,className:"w-64 p-2",selectionMode:"single",selectedKeys:N?[N.key]:[],disabledKeys:_.filter(F=>F.isDisabled||F.isLocked).map(F=>F.key),onAction:F=>s(String(F)),children:_.map(F=>t.jsx(o.DropdownItem,{textValue:F.label,...F.description!==void 0?{description:F.description}:{},"data-testid":F["data-testid"]??`${d}-${F.key}`,children:F.label},F.key))})]})]}),t.jsxs("div",{ref:x,"aria-hidden":"true",className:tx,children:[e.map(F=>t.jsx(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(da,rr),children:F.label},F.key)),t.jsxs(p.Button,{variant:"light",radius:"full",tabIndex:-1,className:o.cn(da,rr,"gap-1"),children:[c,t.jsx(p.Icon,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const nx={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Fl=({total:e,label:a,locale:s="en-US",variant:n="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const c=nx[n];return t.jsxs("div",{"data-testid":i,className:o.cn("rounded-2xl px-6 py-5 text-center",c.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:a}),t.jsx("div",{className:o.cn("mt-1 text-4xl font-bold tracking-tight",c.amount),"data-testid":`${i}-amount`,children:me(e.value,s,e.currency)})]})};Fl.displayName="PaymentTotalBanner";const rx={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},_l=({title:e,subtitle:a,backdrop:s="white",exiting:n=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":n?"off":"polite","aria-hidden":n||void 0,"data-testid":i,"data-state":n?"exiting":"visible",className:o.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",rx[s],n?"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}),a&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:a})]})]});_l.displayName="LoadingOverlay";const Ks=({cashChange:e,label:a="Cash to return",secondaryLine:s,locale:n="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:c="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=c==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:o.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(p.Icon,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:o.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:a}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:me(e.value,n,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(p.Button,{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(p.Icon,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Ks.displayName="PaymentCashChangeBanner";const Rl=({title:e,subtitle:a,emailLine:s,confirmationEmail:n,cashChange:r,cashChangeLabel:i="Cash to return",locale:c="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":x="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":x,className:o.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(p.Icon,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${x}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:a}),s&&n&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:n})]})]}),m&&r&&t.jsx(Ks,{cashChange:r,label:i,locale:c,align:"center",className:"max-w-[400px]","data-testid":`${x}-cash-change`}),d&&t.jsx(p.Button,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${x}-close`,className:"mt-4 w-full",children:l})]})};Rl.displayName="PaymentSuccessView";const Ys=({heading:e,amountLabel:a,value:s,defaultValue:n,onChange:r,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:x,maxAmount:m,hideHeading:b=!1,className:f,"data-testid":g="payment-sub-amount-input"})=>{const j=`${g}-input`,y=s!==void 0,[v,C]=h.useState(n??""),S=y?s:v,{isUntouched:k,markEdited:$}=Nl(S),_=h.useCallback(A=>{if(m!==void 0){const M=Number.parseFloat(A.replace(",","."));if(Number.isFinite(M)&&M>m)return}$(A),y||C(A),r?.(A)},[m,r,$,y]),N=Cl(k,_),F=h.useCallback(A=>{const M=A.currentTarget;requestAnimationFrame(()=>{M.isConnected&&M.select()})},[]);return t.jsxs("div",{className:o.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":g,children:[t.jsx("h3",{className:o.cn("text-lg font-semibold",b&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(o.Input,{ref:N,id:j,label:a,labelPlacement:"outside",classNames:b?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:S,onChange:A=>_(A.target.value),onFocus:F,onBlur:i,placeholder:c,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:x,"data-testid":`${g}-field`})]})};Ys.displayName="PaymentSubAmountInput";const ix={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"}},lx=e=>typeof e=="string"?t.jsx(p.Icon,{icon:e,className:"size-5","aria-hidden":"true"}):e,Zs=({isOpen:e,title:a,confirmLabel:s,onConfirm:n,onOpenChange:r,children:i,description:c,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:x,isKeyboardDismissDisabled:m=!1,hideIcon:b=!1,icon:f,"data-testid":g="confirm-dialog"})=>{const j=i??c??null,y=ix[d],v=b?null:lx(f??y.icon);return t.jsx(p.Modal,{isOpen:e,onOpenChange:C=>r?.(C),placement:"center",size:"md",isDismissable:(x??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(o.ModalContent,{role:"alertdialog",children:[t.jsxs(o.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[v?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:o.cn("flex size-10 items-center justify-center rounded-full",y.tile),children:v}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:a})]}),j!==null?t.jsx(o.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof j=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,t.jsxs(o.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(p.Button,{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(p.Button,{color:y.confirmColor,variant:"solid",radius:"full",onPress:n,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Zs.displayName="ConfirmDialog";const bt={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"},ox={danger:"bg-danger-50",warning:"bg-warning-50"},Il=({message:e,description:a,confirmLabel:s,cancelLabel:n="Cancel",onConfirm:r,onCancel:i,variant:c="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:x="sm",as:m="div",className:b,"data-testid":f="inline-confirm"})=>{const g=h.useId(),j=h.useId(),y=h.useRef(null),v=h.useRef(null),C=h.useRef(null),S=a!=null,k=h.useRef({isPending:l,containEscape:u,onCancel:i});k.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?v:C).current?.focus()},[]),h.useEffect(()=>{const N=y.current;if(N===null)return;const F=A=>{A.key==="Escape"&&(k.current.containEscape&&A.stopPropagation(),!k.current.isPending&&k.current.onCancel())};return N.addEventListener("keydown",F),()=>N.removeEventListener("keydown",F)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const N=y.current;if(N===null)return;const F=document.activeElement;if(l){const A=F===null||F===document.body||!N.contains(F),M=F instanceof HTMLButtonElement&&F.disabled;$.current&&(A||M)&&N.focus({preventScroll:!0});return}F===N&&(d==="confirm"?v:C).current?.focus()},[l,d]);const _=t.jsx(o.Card,{ref:y,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":S?j:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:N=>{const F=N.relatedTarget;$.current=F instanceof Node&&N.currentTarget.contains(F)},className:o.cn(bt.box,ox[c],m==="div"&&b),"data-testid":f,children:t.jsxs(o.CardBody,{className:bt.body,children:[t.jsxs("div",{className:bt.text,children:[t.jsx("p",{id:g,className:bt.message,children:e}),S?t.jsx("p",{id:j,className:bt.description,children:a}):null]}),t.jsxs("div",{className:bt.actions,children:[t.jsx(p.Button,{ref:v,size:x,color:c,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:s}),t.jsx(p.Button,{ref:C,size:x,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:n})]})]})});return m==="li"?t.jsx("li",{className:o.cn(bt.item,b),children:_}):_};Il.displayName="InlineConfirm";const cx={guardScope:(e,a)=>a(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Fa=h.createContext(cx),Qs=h.createContext(null);function dx(e){const{report:a,unreport:s}=h.useContext(Fa),n=h.useContext(Qs),r=h.useId();h.useEffect(()=>{a(r,{scope:n,isDirty:e})},[a,r,n,e]),h.useEffect(()=>()=>s(r),[s,r])}function ux(){const{guardScope:e,bypass:a}=h.useContext(Fa);return h.useMemo(()=>({guard:s=>e(null,s),bypass:a}),[e,a])}function Ml(){const{guardScope:e}=h.useContext(Fa),a=h.useContext(Qs);return h.useCallback(s=>e(a,s),[e,a])}const mx=({scope:e,children:a})=>t.jsx(Qs.Provider,{value:e,children:a}),Bl=({guard:e,children:a,title:s="Discard changes?",description:n="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":c="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:x,report:m,unreport:b,guardScope:f}=e.internals,g=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:b}),[f,e.bypass,m,b]);return t.jsxs(Fa.Provider,{value:g,children:[a,t.jsx(Zs,{isOpen:l!==null,onOpenChange:j=>{j||x()},onConfirm:u,variant:"warning",title:s,description:n,confirmLabel:r,cancelLabel:i,"data-testid":c},d)]})};Bl.displayName="DiscardGuard";const Xs=h.createContext(null);function fx(){const e=h.useContext(Xs),a=Ml(),s=e?.back,n=h.useCallback(()=>{s&&a(s)},[a,s]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:n}}const xx=["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 a of e.querySelectorAll(xx))if(!a.closest('[hidden], [inert], [aria-hidden="true"]'))return a;return null}function lr(e,a){return!e||!e.isConnected||!a.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const hx=new Set(["menu","listbox","dialog","grid","tree"]);function bx(e){for(const a of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const s=a.ownerDocument.getElementById(a.getAttribute("aria-controls")??"");if(!s?.isConnected)continue;if((a.getAttribute("aria-haspopup")??"false")!=="false"||hx.has(s.getAttribute("role")??""))return s}return null}const or="react-aria-focus-scope-restore";class gx{panels=new Map;active=null;setContainer(a,s){s?this.panels.set(a,{entry:null,last:null,...this.panels.get(a),container:s}):this.panels.delete(a)}setEntry(a,s){const n=this.panels.get(a);n?n.entry=s:s&&this.panels.set(a,{container:null,entry:s,last:null})}remember(a,s){const n=this.panels.get(a);n&&(n.last=s)}setActive(a,s){this.active={key:a,isReturn:s}}focusActive(){if(!this.active)return;const a=this.panels.get(this.active.key),s=a?.container;if(!a||!s||s.contains(document.activeElement))return;((this.active.isReturn&&lr(a.last,s)?a.last:null)??(lr(a.entry,s)?a.entry:null)??px(s))?.focus()}recoverFocus(){const a=this.active?this.panels.get(this.active.key)?.container:null,s=a?bx(a):null;s?.focus(),s?.contains(document.activeElement)||this.focusActive()}}const yx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",vx="min-w-0 flex-1 truncate text-large font-semibold",jx="flex shrink-0 items-center gap-2",wx="size-5";function Nx({panels:e,children:a}){const[s]=h.useState(()=>new gx),{entries:n,back:r}=e,i=n[n.length-1].key,c=h.useRef(null);return h.useLayoutEffect(()=>{const l=c.current;c.current={activeKey:i,keys:new Set(n.map(d=>d.key))},!(!l||l.activeKey===i)&&(s.setActive(i,l.keys.has(i)),s.focusActive())},[i,n,s]),t.jsx(t.Fragment,{children:n.map((l,d)=>t.jsx(Cx,{entryKey:l.key,isActive:d===n.length-1,canGoBack:d>0,back:r,memory:s,children:a(l.panel,l)},l.key))})}const Cx=({entryKey:e,isActive:a,canGoBack:s,back:n,memory:r,children:i})=>{const c=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=c.current;if(r.setContainer(e,u),!u)return;const x=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(or,x),()=>{u.removeEventListener(or,x),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:a,canGoBack:s,back:n,setEntryFocus:l}),[a,s,n,l]);return t.jsx(Xs.Provider,{value:d,children:t.jsx(mx,{scope:e,children:t.jsx("div",{ref:c,hidden:!a,style:{display:a?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},Pl=({title:e,onBack:a,backLabel:s="Back",isBackDisabled:n,size:r="md",actions:i,className:c,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(Xs),u=Ml(),x=h.useId(),m=a??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:o.cn(yx,c),"data-testid":l,children:[m?t.jsx(p.Button,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":s,"aria-describedby":x,isDisabled:n,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(p.Icon,{icon:"solar:arrow-left-outline",className:wx,"aria-hidden":"true"})}):null,t.jsx("h2",{id:x,className:vx,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:jx,children:i}):null]})};Pl.displayName="ModalPanelHeader";function kx(e){const a=h.useRef(1),[s]=h.useState(e),[n,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(x=>{const m=`panel-${a.current}`;return a.current+=1,{key:m,panel:x}},[]),c=h.useCallback(x=>{const m=i(x);r(b=>[...b,m])},[i]),l=h.useCallback(()=>{r(x=>x.length>1?x.slice(0,-1):x)},[]),d=h.useCallback(x=>{const m=i(x);r(b=>[...b.slice(0,-1),m])},[i]),u=h.useCallback(x=>{r([i(x===void 0?s:x)])},[i,s]);return h.useMemo(()=>({current:n[n.length-1].panel,entries:n,canGoBack:n.length>1,push:c,back:l,replace:d,reset:u}),[n,c,l,d,u])}function Sx(){const e=h.useRef(new Map),[a,s]=h.useState(0),[n,r]=h.useState(null),[i,c]=h.useState(0),l=h.useCallback(()=>{let y=0;for(const v of e.current.values())v.isDirty&&(y+=1);s(y)},[]),d=h.useCallback((y,v)=>{e.current.set(y,v),l()},[l]),u=h.useCallback(y=>{e.current.delete(y),l()},[l]),x=h.useCallback((y,v)=>{let C=!1;for(const S of e.current.values())S.isDirty&&(y===null||S.scope===y)&&(C=!0);C?r({leave:v}):v()},[]),m=h.useCallback(y=>x(null,y),[x]),b=h.useCallback(y=>{for(const v of e.current.values())v.isDirty=!1;l(),r(null),y()},[l]),f=h.useCallback(y=>v=>{v?y(!0):m(()=>y(!1))},[m]),g=h.useCallback(()=>{const y=n?.leave;r(null),c(v=>v+1),y?.()},[n]),j=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:a>0,guard:m,bypass:b,guardOpenChange:f,internals:{pending:n,confirmKey:i,confirm:g,keepEditing:j,report:d,unreport:u,guardScope:x}}),[a,m,b,f,n,i,g,j,d,u,x])}const $x=60,Ax=(e,a,s=$x)=>a?e>s:e<-s,Tl=(e,a)=>Math.max(0,Math.min(e,a)),Dx=160,Ex=(e,a,s=Dx)=>Math.min(e,Math.max(0,a-s)),Lx=(e,a,s)=>Tl(e-a,s),Fx=(e,a,s)=>e!==null?Tl(e,s):a?s:0,_x=e=>e?"":"transition-[height] duration-300 ease-out",Rx=e=>({onDrag:(a,s)=>{const n=e.open?e.fullHeight:0;e.setDragHeight(Lx(n,s?.offset?.y??0,e.fullHeight))},onDragEnd:(a,s)=>{Ax(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),wt=(e,a)=>me(e.value,a,e.currency),cr=`opacity-60 transition-opacity ${p.stillTransitionClass}`,Js=({item:e,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r=!0,compact:i=!1})=>{const c=!!e.children&&e.children.length>0,l=!!s&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:o.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:Ye[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":o.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:o.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&cr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:o.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&cr),children:wt(e.amount,a)}),l&&t.jsx(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":n,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),p.hasContent(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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{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:o.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(p.Icon,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(p.Icon,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,x)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??x}`,className:o.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:o.cn("whitespace-nowrap",u.valueTone==="primary"&&o.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(o.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??x}`,className:"flex shrink-0 items-center",children:t.jsx(p.Icon,{icon:"lucide:info",width:16,height:16,className:o.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??x)),c&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Js,{item:u,locale:a,onRemove:s,removeAriaLabel:n,showRemoveButton:r,compact:i},u.id))})]})};Js.displayName="SummaryItemRow";const Ol=({fee:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:o.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:o.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:wt(e.amount,a)})]});Ol.displayName="SummaryServiceFeeRow";const en=({row:e,locale:a,emphasized:s,onRemove:n,removeAriaLabel:r,showRemoveButton:i=!0,compact:c=!1})=>{const l=!!n&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c?void 0:o.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:c?"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(p.Button,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:o.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",c&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>n(e.id),children:t.jsx(p.Icon,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:o.cn("whitespace-nowrap",!c&&"text-base",e.amountTone==="success"&&"text-success"),children:wt(e.amount,a)})]})};en.displayName="SummaryTotalsLineRow";const zl=({pricesInLabel:e,currency:a,items:s,serviceFee:n,rows:r,locale:i,onRemoveItem:c,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:x,emptyState:m,compact:b=!1,classNames:f})=>{const g=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[!b&&t.jsxs("div",{"data-testid":"summary-prices",className:o.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),a!=null&&t.jsx("span",{children:a})]}),g?t.jsx("div",{className:o.cn(b?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:s.map(j=>t.jsx(Js,{item:j,locale:i,onRemove:c,removeAriaLabel:l,showRemoveButton:x,compact:b},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),n&&t.jsxs(t.Fragment,{children:[t.jsx(o.Divider,{className:"bg-default-100"}),t.jsx(Ol,{fee:n,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:o.cn(b?o.cn("flex flex-col gap-1 pt-3",!n&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((j,y)=>t.jsx(en,{row:j,locale:i,emphasized:!b&&y===0,onRemove:d,removeAriaLabel:u,showRemoveButton:x,compact:b},j.key))})]})};zl.displayName="SummaryBody";const Vl=({total:e,locale:a,compact:s=!1,className:n})=>{const r=s?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:o.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,n),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:wt(e.amount,a)})]})};Vl.displayName="SummaryGrandTotalRow";const Ul=({secondaryTotal:e,locale:a,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:o.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:wt(e.amount,a)})]});Ul.displayName="SummarySecondaryTotalRow";const Na=({action:e,disabledByLoading:a,className:s,testId:n="summary-cta"})=>t.jsx(p.Button,{color:"primary",radius:"full",className:o.cn("px-[18px] py-[14px] font-medium",s),"data-testid":n,isLoading:e.isLoading,isDisabled:e.isDisabled||a,onPress:e.onPress,endContent:t.jsx(p.Icon,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Na.displayName="SummaryPrimaryCta";const Hl=({title:e,total:a,secondaryTotal:s,locale:n,open:r,progress:i,dragging:c,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:o.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:o.cn("col-start-1 row-start-1 flex items-center justify-between",!c&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:o.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(p.Icon,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:o.cn("col-start-1 row-start-1 flex flex-col gap-2",!c&&"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:a.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:wt(a.amount,n)})]}),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:wt(s.amount,n)})]})]})]})});Hl.displayName="SummaryCollapseHeader";const Wl=({cart:e,ariaLabel:a,onPress:s,className:n})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":a,onClick:s,className:o.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",n),children:[t.jsx(p.Icon,{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})]});Wl.displayName="SummaryCartButton";const ql=({open:e,progress:a,dragging:s,primaryAction:n,isLoading:r,cart:i,cartAriaLabel:c,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:x})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:o.cn("flex flex-col gap-4",x.mobileBar),children:[t.jsx(o.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-a},className:o.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(Wl,{cart:i,ariaLabel:c,className:x.cart,onPress:()=>{u?.(),i.onPress?.()}}),n&&t.jsx(Na,{action:n,disabledByLoading:r,className:o.cn("h-[52px] flex-1",x.cta),testId:"summary-cta-compact"})]}),n&&t.jsx("div",{"aria-hidden":!e,style:{opacity:a},className:o.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(Na,{action:n,disabledByLoading:r,className:o.cn("h-[52px] w-full",x.cta)})})]}),l&&t.jsx("div",{children:l})]});ql.displayName="SummaryActionBar";const Ix="(max-width: 767px)",Mx=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Bx=(e=Ix)=>{const[a,s]=h.useState(()=>Mx(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(e),r=()=>s(n.matches);return r(),n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[e]),a},Gl=({title:e="Summary",pricesInLabel:a="Prices are in",currency:s,locale:n="en-US",items:r,serviceFee:i,rows:c,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:x,secondaryTotal:m,collapsible:b,isOpen:f,onToggleOpen:g,defaultOpen:j=!1,primaryAction:y,isLoading:v=!1,onRemoveItem:C,showRemoveButton:S,ctaCaption:k,ctaError:$,variant:_,cart:N,emptyState:F,labels:A,classNames:M={},density:E="default","data-testid":D="summary",className:I})=>{const B=A?.removeAriaLabel??"Remove item",V=A?.removeTotalRowAriaLabel??"Remove discount",q=A?.removePostTotalRowAriaLabel??"Remove applied code",P=A?.toggleAriaLabel??"Toggle summary",te=A?.cartAriaLabel??"View cart",W=E==="compact",Y=Bx(),ie=b??(_??(Y?"mobile":"main"))==="mobile",[ae,Q]=h.useState(j),ne=f!==void 0,z=!ie||(ne?f:ae),O=h.useCallback(()=>{ne||Q(T=>!T),g?.()},[ne,g]),[Z,Re]=h.useState(0),[Ae,De]=h.useState(null),se=h.useRef(null),ge=h.useRef(null),Ee=h.useCallback(()=>{const T=se.current;T&&Re(Ex(T.scrollHeight,window.innerHeight))},[]),Ze=h.useCallback(T=>{ge.current?.disconnect(),ge.current=null,se.current=T,T&&(Ee(),typeof ResizeObserver<"u"&&(ge.current=new ResizeObserver(Ee),ge.current.observe(T)))},[Ee]);h.useEffect(()=>(window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)),[Ee]);const pe=Rx({open:z,fullHeight:Z,setDragHeight:De,onToggleOpen:O}),Le=Ae!==null,oe=Fx(Ae,z,Z),he=Z>0?Math.min(1,Math.max(0,oe/Z)):z?1:0,X=t.jsx(Vl,{total:l,locale:n,compact:W,className:M.total}),w=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(T=>t.jsx(en,{row:T,locale:n,emphasized:!1,onRemove:x,removeAriaLabel:q,showRemoveButton:S,compact:W},T.key))}),L=m&&t.jsx(Ul,{secondaryTotal:m,locale:n,className:M.secondaryTotal}),R=k!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:o.cn("text-center text-sm text-default-500",M.ctaCaption),children:k}),H=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:o.cn("text-center text-sm text-danger",M.ctaError),children:$}),U=t.jsx(zl,{pricesInLabel:a,currency:s,items:r,serviceFee:i,rows:c,locale:n,onRemoveItem:C,removeAriaLabel:B,onRemoveTotalRow:u,removeTotalRowAriaLabel:V,showRemoveButton:S,emptyState:F,compact:W,classNames:M});return ie?t.jsxs(ze.motion.section,{"data-testid":D,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:pe.onDrag,onDragEnd:pe.onDragEnd,className:o.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)]",I,M.base),children:[t.jsx(Hl,{title:e,total:l,secondaryTotal:m,locale:n,open:z,progress:he,dragging:Le,toggleAriaLabel:P,onToggleOpen:O,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!z,style:{height:oe},className:o.cn("min-h-0",z&&!Le?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!z&&"pointer-events-none",_x(Le)),children:t.jsxs("div",{ref:Ze,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),X,w,L]})}),t.jsx(ql,{open:z,progress:he,dragging:Le,primaryAction:y,isLoading:v,cart:N,cartAriaLabel:te,ctaCaption:R,ctaError:H,onToggleOpen:O,classNames:M})]}):t.jsxs("section",{"data-testid":D,className:o.cn(W?"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",I,M.base),children:[!W&&t.jsx("div",{className:o.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:o.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),U,!W&&t.jsx(o.Divider,{className:"bg-default-200"}),X,w,L,m&&y&&t.jsx(o.Divider,{className:"bg-default-200"}),y&&t.jsx(Na,{action:y,disabledByLoading:v,className:o.cn("w-full",M.cta)}),H,R]})};Gl.displayName="Summary";const st={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},dr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},Px={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},Tx={ariaLabel:"Progress",completed:"completed"},tn=({steps:e,activeStepId:a,showLabels:s=!0,onStepPress:n,isStepReachable:r,labels:i,className:c,"data-testid":l="step-progress"})=>{const d={...Tx,...i},u=e.filter(b=>b.state!=="skipped"),x=Math.max(0,u.findIndex(b=>b.id===a)),m=b=>b<x?"done":b===x?"active":"upcoming";return s?t.jsx("ol",{"aria-label":d.ariaLabel,className:o.cn(st.list,c),"data-testid":l,children:u.map((b,f)=>{const g=m(f),j=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:o.cn(st.segment,"w-full",dr[g]),"data-testid":`${l}-segment-${b.id}`}),t.jsxs("span",{className:o.cn(st.name,Px[g]),"data-testid":`${l}-name-${b.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:st.check,"data-testid":`${l}-check-${b.id}`,children:t.jsx(p.Icon,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:b.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),y=r?r(b.id,f):f<x,v=g==="active"?"step":void 0;return t.jsx("li",{className:st.item,"aria-current":n?void 0:v,"data-state":g,"data-testid":`${l}-step-${b.id}`,children:n?t.jsx("button",{type:"button",className:o.cn(st.step,st.button),disabled:!y,"aria-current":v,onClick:()=>n(b.id),"data-testid":`${l}-button-${b.id}`,children:j}):t.jsx("div",{className:st.step,children:j})},b.id)})}):t.jsx("div",{"aria-hidden":"true",className:o.cn(st.bare,c),"data-testid":l,children:u.map((b,f)=>t.jsx("span",{className:o.cn(st.segment,"flex-1",dr[m(f)]),"data-state":m(f)},b.id))})};tn.displayName="StepProgress";const Ox={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},zx={backgroundColor:le.destructive,color:"#fff"},Vx={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},es="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",ts="absolute top-0 h-5 w-5 opacity-0",Kl=({onClose:e,steps:a,activeStepId:s,subtitle:n,onBack:r,primaryAction:i,totalRow:c,secondaryAction:l,hideChrome:d,footerSummary:u,labels:x,className:m,"data-testid":b="wizard-shell",children:f})=>{const g={...Ox,...x},j=a.find(C=>C.id===s),y=r??e,v=r?g.back:g.cancel;return t.jsxs("div",{className:o.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":b,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":`${b}-header`,children:[y&&t.jsx(p.Button,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:y,"data-testid":`${b}-header-back`,startContent:t.jsx(p.Icon,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:v}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${b}-header-title`,children:j?.label??""}),n&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${b}-header-subtitle`,children:n})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${b}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:o.cn(ts,"left-0"),"data-testid":`${b}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:o.cn(ts,"left-6"),"data-testid":`${b}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:o.cn(ts,"left-12"),"data-testid":`${b}-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:[c&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${b}-total`,children:[t.jsx("span",{children:c.label}),c.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:me(c.amount.value,void 0,c.amount.currency)}),c.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${b}-total-of`,children:me(c.of.value,void 0,c.of.currency)})]}),c.badge==="partial"&&t.jsx("span",{className:o.cn(es,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${b}-total-partial`,children:g.partialBadge}),c.badge==="owes"&&t.jsx("span",{className:o.cn(es,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${b}-total-owes`,children:g.owesBadge}),typeof c.badge=="object"&&t.jsx("span",{className:es,style:Vx[c.badge.tone],"data-tone":c.badge.tone,"data-testid":`${b}-total-badge`,children:c.badge.label})]}),t.jsx(p.Button,{color:"primary",className:o.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"?zx:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${b}-primary`,children:i.label})]})]}),t.jsx(tn,{steps:a,activeStepId:s,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${b}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${b}-body`,children:f}),u]})};Kl.displayName="WizardShell";const Ux=(e,a,s)=>Math.min(Math.max(e,a),s);function ps(e,a,s){const n=Math.max(1,Math.trunc(a)),r=Ux(Math.trunc(s),0,n);if(r===n)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Rt(e.currency)),c=Math.round(e.value*i),l=Math.floor(c/n),d=c-l*n;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function Hx(e,a){return ps(e,a,1)}const Wx=e=>Number.isFinite(e)?e.toFixed(2):"",hs=({value:e,expected:a,max:s,onChange:n,ariaLabel:r,isDisabled:i,className:c,"data-testid":l,inputTestId:d})=>{const[u,x]=h.useState(null),m=h.useRef(null),b=Math.abs(e-a)>.004;return t.jsxs("span",{className:o.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",b?"border-primary bg-primary-50":"border-pos-line bg-white",c),"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??Wx(e),onChange:f=>{const g=f.target.value,j=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(j)&&j>s+.004||(x(g),Number.isFinite(j)&&j>=0?n(j):g.trim()===""&&n(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>x(null),"data-testid":d})]})};hs.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"},Gx="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",ur="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",as="absolute h-5 w-5 opacity-0",Kx=e=>{const a=me(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return a;const s=Hx(e.paidAmount,e.quantity);return`${e.quantity} × ${me(s.value,void 0,s.currency)} · ${a}`},Yl=({items:e,selections:a,onSelectionChange:s,onRestockToggle:n,onDispositionChange:r,amountOnly:i,labels:c,className:l,"data-testid":d="line-item-list"})=>{const u={...qx,...c},x=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const b=a[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),y=b?.quantity,v=b?.selected?Math.min(y??j,j):y??0,C=ps(m.paidAmount,j,v).value,S=b?.amount??(b?.selected?C:0),k=v===0&&S>.004,$=N=>s(m.id,{selected:N.quantity>0||N.amount>.004,mode:"full",...N}),_=N=>{const F=Math.min(Math.max(N,0),j);$({quantity:F,amount:ps(m.paidAmount,j,F).value})};return t.jsxs("div",{className:o.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(p.Icon,{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??Kx(m)}),k&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:me(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(hs,{value:S,expected:C,max:m.paidAmount.value,onChange:N=>$({quantity:v,amount:N}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),f?t.jsx("span",{className:Gx,"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:ur,"aria-label":u.decrease.replace("{name}",m.name),disabled:v===0,onClick:()=>_(v-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:v}),t.jsx("button",{type:"button",className:ur,"aria-label":u.increase.replace("{name}",m.name),disabled:v===j,onClick:()=>_(v+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),v>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),b?.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(p.Icon,{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})]}),v>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(p.Select,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:N=>{if(N==="all")return;const F=[...N][0];F&&(r?.(m.id,F),n(m.id,F==="stock"))},"data-testid":`${g}-restock`,children:x.map(N=>t.jsx(o.SelectItem,{children:N.label},N.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(o.Checkbox,{className:o.cn(as,"right-0 top-0 m-0 p-0"),isSelected:!!b?.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:o.cn(as,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:v,amount:C}),className:o.cn(as,"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(p.Icon,{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(p.Icon,{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}",me(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(hs,{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(p.Icon,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Yl.displayName="LineItemList";const Yx={color:le.danger},Zl=({children:e,className:a,"data-testid":s="meta-card"})=>t.jsx("div",{className:o.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",a),"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})});Zl.displayName="MetaCard";const Ql=({label:e,htmlFor:a,required:s,children:n,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:o.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:a,className:"text-[13px] font-medium text-default-600",children:[e,s&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Yx,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:n})]});Ql.displayName="MetaCard.Row";const Xl=({label:e,children:a,className:s,"data-testid":n="meta-card-section"})=>t.jsxs("div",{className:o.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":n,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),a]});Xl.displayName="MetaCard.Section";const Zx=Object.assign(Zl,{Row:Ql,Section:Xl}),Jl=({heading:e,icon:a="lucide:rotate-ccw",action:s,children:n,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:o.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(p.Icon,{icon:a,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:o.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(p.Icon,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),n]});Jl.displayName="SectionPanel";const eo=({name:e,detail:a,icon:s="lucide:users",labels:n,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:o.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(p.Icon,{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:n?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),a&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:a})]})]});eo.displayName="CustomerCard";const Qx={label:"Reason for the return",placeholder:"Select a reason…"},to=({options:e,value:a,onChange:s,error:n,isRequired:r,labels:i,className:c,"data-testid":l="reason-select"})=>{const d={...Qx,...i};return t.jsx(p.Select,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:a?[a]:[],isRequired:r,isInvalid:!!n,errorMessage:n,className:o.cn(c),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const x=[...u][0];x&&s(String(x))},children:e.map(u=>t.jsx(o.SelectItem,{children:u.label},u.id))})};to.displayName="ReasonSelect";const Xx={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},ao=({value:e,onChange:a,maxLength:s,alwaysExpanded:n=!1,hideLabel:r=!1,labels:i,className:c,"data-testid":l="notes-field"})=>{const d={...Xx,...i},[u,x]=h.useState(e!=="");return n?t.jsxs("div",{className:o.cn("flex flex-col gap-2",c),"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=>a(m.target.value),maxLength:s,placeholder:d.placeholder,className:o.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:o.cn(c),"data-testid":l,children:u?t.jsx(o.Textarea,{value:e,onChange:m=>a(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(p.Button,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>x(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};ao.displayName="NotesField";const Jx={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},ep="solar:close-circle-linear",tp={callout:{root:"flex items-start gap-[0.5625rem] rounded-xl px-3.5 py-3 text-[0.78125rem] leading-normal",iconWrapper:"flex h-[1.5em] shrink-0 items-center",iconSize:"1.25em",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"",actions:"mt-2 flex flex-wrap items-center gap-2",dismiss:"-my-1.5 -me-2 size-8 min-w-8 shrink-0 text-current"},banner:{root:"flex items-start gap-3.5 rounded-[0.875rem] px-[1.125rem] py-4 text-pos-ink",iconWrapper:"flex size-10 shrink-0 items-center justify-center rounded-full",iconSize:"1.375rem",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"text-[0.8125rem] text-pos-neutral",actions:"mt-3 flex flex-wrap gap-2.5",dismiss:"-my-1 -me-1.5 size-8 min-w-8 shrink-0 text-pos-neutral"}},ap={info:{callout:"bg-pos-info-fill text-pos-info",banner:"bg-pos-info-fill",disc:"bg-pos-info/15 text-pos-info",title:"text-pos-info"},success:{callout:"bg-pos-ok-fill text-pos-ok",banner:"bg-pos-ok-fill",disc:"bg-pos-ok/15 text-pos-ok",title:"text-pos-ok"},warning:{callout:"bg-pos-warn-fill text-pos-warn",banner:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"},danger:{callout:"bg-pos-danger-fill text-pos-danger",banner:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"}},sp={info:"status",success:"status",warning:"alert",danger:"alert"};function an({tone:e="info",variant:a="callout",title:s,description:n,actions:r,onDismiss:i,dismissLabel:c="Dismiss",role:l=sp[e],className:d,"data-testid":u="notice"}){const x=p.useReducedMotion(),m=tp[a],b=ap[e],f=a==="banner",g=p.hasContent(s),j=p.hasContent(n),y=g?f?t.jsx("p",{"data-testid":`${u}-title`,className:o.cn(m.title,b.title),children:s}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:s}):null,v=j?f?t.jsx("p",{"data-testid":`${u}-description`,className:o.cn(m.description,g&&"mt-0.5"),children:n}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:n}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":a,"data-testid":u,className:o.cn(m.root,f?b.banner:b.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:o.cn(m.iconWrapper,f&&b.disc),children:t.jsx(p.Icon,{icon:Jx[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[y,v]}):t.jsxs("p",{children:[y,g&&j?" ":null,v]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(p.Button,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":c,onPress:i,disableAnimation:x,className:o.cn(m.dismiss,p.stillTransitionClass),"data-testid":`${u}-dismiss`,children:t.jsx(p.Icon,{icon:ep,width:"1.125rem",height:"1.125rem"})}):null]})}an.displayName="Notice";const mr="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",_a=({tone:e,title:a,body:s,onRetry:n,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:c,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:x})=>t.jsx(an,{variant:"banner",tone:e,title:a,description:s,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[n&&t.jsx(p.Button,{color:"primary",className:mr,onPress:n,"data-testid":u,children:r}),t.jsx(p.Button,{variant:"bordered",className:o.cn(mr,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":x,children:c})]})});_a.displayName="TenderBanner";const np={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"},rp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},so=({tenders:e,selectedTenderId:a,onSelect:s,onSplit:n,error:r,labels:i,className:c,"data-testid":l="tender-methods"})=>{const d={...np,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",c),"data-testid":l,children:[r&&t.jsx(_a,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(x=>{const m=x.tenderId===a;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(x.tenderId),className:o.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${x.tenderId}`,children:[t.jsx("span",{className:o.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(p.Icon,{icon:rp[x.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:x.label}),t.jsx("span",{className:"block text-xs text-default-500",children:me(x.maxRefundable.value,void 0,x.maxRefundable.currency)})]})]},x.tenderId)}),t.jsxs("button",{type:"button",onClick:n,className:o.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(p.Icon,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};so.displayName="TenderMethods";const ip=e=>e.refunded!==null,lp={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"},op="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",cp="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",no=({parts:e,refundedSoFar:a,remaining:s,current:n,methods:r,onRefundPart:i,partError:c,onBack:l,busy:d,hideActions:u,labels:x,className:m,"data-testid":b="split-tender-panel"})=>{const f={...lp,...x},g=e.filter(ip),j=e.find(N=>N.tenderId===n.tenderId)?.label,y=!!(r?.length&&n.onTenderChange),v=Rt(s.currency),{draft:C,setDraft:S,normalize:k}=wl(n.amount,String),$=h.useCallback(N=>{Gs(N,v)&&(S(N),n.onAmountChange(Qt(N)??0))},[n,S,v]),_=c?.kind==="processor_declined";return t.jsxs("div",{className:o.cn("flex flex-col text-default-900",m),"data-testid":b,children:[t.jsx("h3",{className:"sr-only","data-testid":`${b}-title`,children:f.title}),c&&t.jsx(_a,{tone:_?"danger":"warning",title:_?f.declinedTitle:f.networkTitle,body:_?f.partDeclinedBody:f.partNetworkBody,onRetry:c.onRetry,retryLabel:f.retry,onChooseDifferent:c.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${b}-part-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{"data-testid":`${b}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:me(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",me(a.value,void 0,a.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:op,children:f.refundedSoFar}),g.map((N,F)=>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":`${b}-part-${N.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",F+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(p.Icon,{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:me(N.refunded.value,void 0,N.refunded.currency)}),t.jsx("span",{className:o.cn(cp,N.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:N.status==="pending"?f.pending:f.succeeded})]},N.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${b}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:f.partHeading.replace("{n}",String(g.length+1))}),j&&t.jsx("span",{className:"text-xs text-default-500",children:j})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${b}-amount-label`,children:f.amountForPart}),t.jsx(Ys,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:C,onChange:$,onBlur:k,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${b}-amount`}),y&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${b}-methods`,children:r?.map(N=>{const F=N.tenderId===n.tenderId;return t.jsxs("button",{type:"button","aria-pressed":F,disabled:N.disabled||d,onClick:()=>n.onTenderChange?.(N.tenderId),className:o.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",F?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${b}-method-${N.tenderId}`,children:[N.icon&&t.jsx(p.Icon,{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(p.Button,{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":`${b}-back`,children:f.back}),t.jsx(p.Button,{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":`${b}-submit`,children:f.submit})]})]})};no.displayName="SplitTenderPanel";const ro="hsl(var(--heroui-primary))",dp="hsl(var(--heroui-primary) / 0.05)",io="hsl(var(--heroui-default-100))",lo="hsl(var(--heroui-default-600))",sn={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},up={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:ro,backgroundColor:dp},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Ca={idle:{backgroundColor:io,color:lo},selected:{backgroundColor:ro,color:"#fff"}},mp={backgroundColor:io,color:lo},fp={borderColor:le.line},fr={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},xp={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"},pp=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(a=>a.type==="currency")?.value??e}catch{return e}},hp=({method:e,currency:a,busy:s,labels:n,onToggle:r,onAmountChange:i,onAmountBlur:c,onRemove:l,testId:d})=>{const u=e.status??"idle",x=u==="pending"||u==="done",m=s||x,b=!!(e.removable&&l),f=e.cap?.currency??a,g=Rt(f),j=`${d}-amount`,y=n.amountFor.replace("{method}",e.label),v=h.useCallback(_=>{if(!Gs(_,g))return;const N=Qt(_);e.cap&&N!==null&&N>e.cap.value||i(e.id,_)},[g,e.cap,e.id,i]),C=h.useCallback(_=>{const N=_.currentTarget;requestAnimationFrame(()=>{N.isConnected&&N.select()})},[]),S=u==="declined"?"declined":e.selected?"selected":"idle",k=e.statusLabel??(u==="idle"?void 0:n[u]),$=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Ca.selected:Ca.idle,"data-testid":`${d}-icon`,children:t.jsx(p.Icon,{icon:sn[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&k?t.jsx("span",{className:ce.status,style:fr.declined,"data-testid":`${d}-status`,children:k}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),x&&k&&t.jsx("span",{className:ce.badge,style:fr[u],"data-testid":`${d}-status`,children:k})]});return t.jsxs("div",{className:ce.card,style:up[S],"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:o.cn(ce.toggle,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:j,className:"sr-only",children:y}),t.jsx(o.Input,{id:j,"aria-label":y,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:_=>v(_.target.value),onFocus:C,onBlur:()=>c?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:pp(f)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:o.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,b&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:ce.lowerSlot,style:mp,"data-testid":`${d}-cap`,children:e.cap?n.upTo.replace("{amount}",me(e.cap.value,void 0,e.cap.currency)):n.noCap})]}),b&&t.jsx("button",{type:"button","aria-label":n.remove.replace("{method}",e.label),disabled:s,onClick:()=>l?.(e.id),className:o.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(p.Icon,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},oo=({methods:e,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,currency:i="USD",paidWith:c,anotherMethod:l,error:d,busy:u=!1,labels:x,className:m,"data-testid":b="refund-method-cards"})=>{const f={...xp,...x};return t.jsxs("div",{className:o.cn(ce.root,m),"data-testid":b,children:[d&&t.jsx(_a,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:ce.banner,"data-testid":`${b}-error`,retryTestId:`${b}-retry`,chooseDifferentTestId:`${b}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:f.heading}),c&&t.jsx(Ea,{variant:"record",label:c.label,value:c.value,"data-testid":`${b}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:ce.grid,"data-testid":`${b}-grid`,children:[e.map(g=>t.jsx(hp,{method:g,currency:i,busy:u,labels:f,onToggle:a,onAmountChange:s,onAmountBlur:n,onRemove:r,testId:`${b}-method-${g.id}`},g.id)),l&&t.jsxs(o.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(o.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:o.cn(ce.another,ce.focusRing),style:fp,"data-testid":`${b}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Ca.idle,children:t.jsx(p.Icon,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(o.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${b}-another-menu`,children:g=>t.jsx(o.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Ca.idle,children:t.jsx(p.Icon,{icon:sn[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${b}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};oo.displayName="RefundMethodCards";const Ue={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"},co="hsl(var(--heroui-primary))",bp={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:co,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},xr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:co,color:"#fff"}},gp={backgroundColor:"#fff",color:le.neutral},Dt=e=>({color:Ye[e].fg,backgroundColor:Ye[e].bg}),yp={queued:Dt("neutral"),processing:Dt("info"),waiting_reader:Dt("warn"),waiting_cash:Dt("warn"),done:Dt("ok"),failed:Dt("danger")},vp={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},jp={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},pr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},wp=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",uo=({parts:e,activeId:a,labels:s,className:n,"data-testid":r="refund-progress-list"})=>{const i={...vp,...s},c=a??e.find(wp)?.id;return t.jsxs("div",{className:o.cn(Ue.root,n),"data-testid":r,children:[t.jsx("p",{className:Ue.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Ue.list,children:e.map(l=>{const d=l.id===c,u=`${r}-part-${l.id}`,x=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Ue.row,style:bp[x],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Ue.main,children:[t.jsx("span",{className:Ue.iconBox,style:d?xr.active:xr.idle,children:t.jsx(p.Icon,{icon:sn[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Ue.text,children:[t.jsx("span",{className:Ue.label,children:l.label}),l.note&&t.jsx("span",{className:Ue.note,children:l.note})]}),t.jsx("span",{className:Ue.amount,children:me(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Ue.badge,style:yp[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(p.Icon,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[jp[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Ue.prompt,style:gp,"data-testid":`${u}-prompt`,children:[pr[l.status]&&t.jsx(p.Icon,{icon:pr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Ue.promptText,children:l.prompt}),l.action&&t.jsx(p.Button,{color:"primary",className:Ue.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};uo.displayName="RefundProgressList";const Np={label:"Supervisor authorization",placeholder:"••••"},mo=({pin:e,onChange:a,hint:s,error:n,labels:r,className:i,"data-testid":c="pin-field"})=>{const l={...Np,...r};return t.jsxs("div",{className:o.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":c,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(p.Icon,{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(o.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>a(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!n,errorMessage:n,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":`${c}-input`})]})};mo.displayName="PinField";const Cp={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},kp={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Sp={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},$p="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Ht="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",Ap="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",Dp=["email","print"],xa=`${p.stillTransitionClass} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,we={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${xa}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${xa}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${xa}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},fo=({state:e,kind:a="refund",total:s,destinations:n,subtitle:r,reason:i,paidWith:c,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:x,onSendReceipt:m,receiptActions:b,emailReceipt:f,onDone:g,frameless:j=!1,labels:y,className:v,"data-testid":C="outcome-view"})=>{const S={...Cp,...kp[a],...y},k=h.useId(),$=s?me(s.value,void 0,s.currency):null;return e==="processing"?t.jsx("div",{className:o.cn("flex flex-col items-center justify-center text-center text-pos-ink",v),"aria-live":"polite","data-testid":C,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${C}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${p.stillAnimationClass}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:S.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${C}-processing-total`,children:$})]})}):t.jsxs("div",{className:o.cn("flex flex-col text-pos-ink",!j&&Ap,v),"aria-live":"polite","data-testid":C,children:[t.jsxs("div",{className:o.cn("text-center",a==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(p.Icon,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:we.changeTitle,"data-testid":`${C}-title`,children:S.title}),t.jsx("p",{className:we.changeLabel,children:S.changeDue}),t.jsx("p",{className:we.changeAmount,"data-testid":`${C}-change`,children:me(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:we.changeCaption,"data-testid":`${C}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${C}-title`,children:S.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${C}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${C}-reason`,children:S.reason.replace("{reason}",i)})]}),c&&c.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-paid-with`,children:[t.jsx("p",{className:Ht,children:S.paidWithTitle}),c.map((_,N)=>t.jsxs("div",{className:we.paidRow,"data-testid":`${C}-paid-with-${N}`,children:[_.icon&&t.jsx("span",{className:we.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(p.Icon,{icon:_.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:we.paidLabel,children:_.label}),t.jsx("span",{className:we.paidAmount,children:me(_.amount.value,void 0,_.amount.currency)}),_.status&&t.jsx("span",{className:we.paidStatus,children:_.status})]},`${_.label}-${N}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${C}-outcome`,children:[t.jsx("p",{className:Ht,children:S.outcomeTitle}),t.jsx("div",{className:we.groups,children:l.map((_,N)=>t.jsxs("div",{"data-testid":`${C}-outcome-${N}`,children:[t.jsx("p",{className:we.groupLabel,children:_.label}),t.jsx("ul",{className:we.groupItems,"aria-label":_.label,children:_.items.map((F,A)=>t.jsx("li",{className:we.groupItem,children:F},`${F}-${A}`))})]},`${_.label}-${N}`))})]}),n&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ht,children:S.destinationsTitle}),n.map((_,N)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${C}-destination-${N}-${_.status}`,children:[t.jsx("span",{className:"font-semibold",children:_.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:me(_.amount.value,void 0,_.amount.currency)}),t.jsx("span",{className:o.cn($p,Sp[_.status]),children:_.status==="succeeded"?S.succeeded:S.pending})]})]},`${_.label}-${N}`))]}),b&&b.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${C}-receipt-actions`,children:[t.jsx("p",{className:Ht,children:S.sendReceipt}),t.jsx("div",{className:we.receiptRow,children:b.map(_=>t.jsx(Ep,{action:_,controls:_.expanded?k:void 0,"data-testid":`${C}-receipt-action-${_.key}`},_.key))}),f&&t.jsx(Lp,{id:k,email:f,labels:S,"data-testid":`${C}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ht,children:S.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Dp.map(_=>{const N=x?.includes(_)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":N,onClick:()=>m(_),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${p.stillTransitionClass}`,"data-testid":`${C}-receipt-${_}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(o.Checkbox,{isSelected:N,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:S[_]})]},_)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${C}-authorized-by`,children:S.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(p.Button,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${xa}`,onPress:g,"data-testid":`${C}-done`,children:S.done})})]})};fo.displayName="OutcomeView";function Ep({action:e,controls:a,"data-testid":s}){return t.jsx(p.Button,{variant:"bordered",color:"default",disableRipple:!0,className:o.cn(we.receiptAction,e.expanded&&we.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":a,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(p.Icon,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":s,children:e.label})}function Lp({id:e,email:a,labels:s,"data-testid":n}){const r=a.isSendDisabled??a.emails.length===0;return t.jsxs("div",{id:e,className:we.emailBox,"data-testid":n,children:[t.jsxs("div",{className:o.cn(we.chipWrap,a.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":a.isInvalid||void 0,"data-testid":`${n}-recipients`,children:[a.emails.map(i=>t.jsxs("span",{className:we.chip,"data-testid":`${n}-chip`,children:[i,t.jsx(p.Button,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:we.chipRemove,"aria-label":s.removeEmail.replace("{email}",i),onPress:()=>a.onRemoveEmail(i),"data-testid":`${n}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(p.Icon,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(o.Input,{"aria-label":s.emailAriaLabel,placeholder:s.emailPlaceholder,type:"email",value:a.draft,onValueChange:a.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&a.draft.trim()!==""&&(i.preventDefault(),a.onAddEmail(a.draft.trim()))},isInvalid:a.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${p.stillTransitionClass}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${n}-input`})]}),t.jsx(p.Button,{color:"secondary",className:we.send,isDisabled:r,isLoading:a.isSending,onPress:a.onSend,"data-testid":`${n}-send`,children:s.sendEmail})]})}const Pe={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"},Fp="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",_p="calc(100vw - 1.5rem)",xo=({label:e,value:a,options:s,onChange:n,clearLabel:r,minWidth:i,"data-testid":c="filter-select"})=>{const l=a!==null,d=l?s.find(f=>f.value===a)?.label:void 0,u=h.useRef(null),x=h.useRef(null),[m,b]=h.useState();return t.jsxs("div",{ref:u,"data-testid":c,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:o.cn(Pe.base,l&&Pe.baseActive),style:i===void 0?void 0:{"--filter-select-min":lt(i)},children:[t.jsx(p.Select,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:a===null?[]:[a],onSelectionChange:f=>{if(f==="all")return;const g=[...f][0];n(g===void 0?null:String(g))},onOpenChange:f=>{f&&b(u.current?.getBoundingClientRect().width)},popoverProps:{ref:x,placement:"bottom-start",style:{minWidth:m,maxWidth:_p}},"data-testid":`${c}-trigger`,classNames:{base:o.cn(Pe.select,Pe.cell),trigger:o.cn(Pe.trigger,l&&Pe.triggerActive),value:o.cn(Pe.value,l&&Pe.valueActive),selectorIcon:o.cn(l&&Pe.iconActive)},children:s.map(f=>t.jsx(o.SelectItem,{classNames:{title:Pe.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${c}-sizer`,className:o.cn(Pe.sizer,l&&Pe.sizerActive,Pe.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{n(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${c}-clear`,className:Pe.clear,children:t.jsx(p.Icon,{icon:"lucide:x",className:Pe.clearIcon,"aria-hidden":"true"})})]})};xo.displayName="FilterSelect";const po=({children:e,className:a,"data-testid":s="filter-select-group"})=>t.jsx("div",{"data-testid":s,"data-slot":"filter-select-group",className:o.cn(Fp,a),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});po.displayName="FilterSelectGroup";const mt={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"},ho=({status:e,onLoadMore:a,loadingLabel:s,errorLabel:n,retryLabel:r,endLabel:i,"data-testid":c="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(a),u=h.useRef(!1);return h.useEffect(()=>{d.current=a},[a]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const x=l.current;if(!x||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(b=>{u.current||!b.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(x),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":c,"data-status":"idle",className:mt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${c}-sentinel`,className:mt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":c,"data-status":"loading",role:"status","aria-live":"polite",className:mt.base,children:[t.jsx("span",{"aria-hidden":"true",className:mt.spinner,children:t.jsx(o.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${c}-loading`,children:s})]}):e==="error"?t.jsxs("div",{"data-testid":c,"data-status":"error",className:mt.base,children:[t.jsx("span",{role:"alert","data-testid":`${c}-error`,className:mt.error,children:n}),t.jsx(p.Button,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:a,testId:`${c}-retry`,children:r})]}):t.jsx("div",{"data-testid":c,"data-status":"end",className:i?mt.base:mt.idle,children:i&&t.jsx("span",{"data-testid":`${c}-end`,children:i})})};ho.displayName="LoadMoreFooter";const ke={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 ${p.stillTransitionClass}`,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"},hr=({item:e,withActions:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:o.cn(ke.headline,a&&ke.headlineWithActions),children:[t.jsx("span",{className:ke.title,children:e.title}),p.hasContent(e.amount)&&!a&&t.jsx("span",{className:ke.amount,children:e.amount})]}),a?(p.hasContent(e.chips)||p.hasContent(e.amount))&&t.jsxs("span",{className:ke.chipsLine,children:[p.hasContent(e.chips)&&t.jsx("span",{className:ke.chipsInline,children:e.chips}),p.hasContent(e.amount)&&t.jsx("span",{className:ke.amount,children:e.amount})]}):p.hasContent(e.chips)&&t.jsx("span",{className:ke.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:ke.rows,children:e.rows.map((s,n)=>t.jsxs("span",{className:ke.row,children:[t.jsx("span",{className:ke.rowLabel,children:s.label}),t.jsx("span",{className:ke.rowValue,children:s.value})]},n))})]}),bo=({items:e,ariaLabel:a,onSelect:s,loading:n=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:ke.base,children:n?t.jsx("div",{role:"status","aria-busy":"true","aria-label":a,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(c,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:ke.skeletonRow,children:[t.jsx("div",{className:p.shimmerClass,style:{height:lt(13),width:lt(130)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"70%",marginTop:lt(10)}}),t.jsx("div",{className:p.shimmerClass,style:{height:lt(11),width:"45%",marginTop:lt(8)}})]},l))})}):t.jsx("ul",{"aria-label":a,className:ke.list,children:e.map(c=>{const l=p.hasContent(c.actions);return t.jsxs("li",{"data-testid":`${i}-item-${c.id}`,className:ke.item,children:[s?t.jsx("button",{type:"button",onClick:()=>s(c.id),className:o.cn(ke.card,ke.cardInteractive),children:t.jsx(hr,{item:c,withActions:l})}):t.jsx("div",{className:ke.card,children:t.jsx(hr,{item:c,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${c.id}-actions`,className:ke.actions,children:c.actions})]},c.id)})})});bo.displayName="CardList";const Rp=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`,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 ${p.stillTransitionClass}`,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"},go=h.forwardRef((e,a)=>t.jsx("li",{ref:a,...Object.fromEntries(Object.entries(e).filter(([s])=>s!=="data-testid"))}));go.displayName="CrumbBase";const yo=({breadcrumb:e=[],onBack:a,backLabel:s,title:n,meta:r,amountLabel:i,amount:c,amountCaption:l,recordId:d,chips:u,statItems:x,stats:m,banner:b,"data-testid":f="record-header"})=>{const{ref:g,width:j}=It(),y=!ta(j,Rp),v=e.length>0||!!a,C=!!(x&&x.length>0),S=!!i||p.hasContent(c)||p.hasContent(l)||p.hasContent(d)||p.hasContent(u)||C;return t.jsxs("div",{ref:g,"data-testid":f,"data-size":y?"narrow":"wide",className:re.base,children:[v&&t.jsxs("div",{"data-testid":`${f}-band`,className:re.band,children:[a&&t.jsx("button",{type:"button",onClick:a,"aria-label":s,"data-testid":`${f}-back`,className:re.back,children:t.jsx(p.Icon,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(o.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((k,$)=>t.jsx(o.BreadcrumbItem,{as:go,"data-testid":`${f}-crumb-${$}`,isDisabled:!k.onClick&&$<e.length-1,onPress:k.onClick?()=>k.onClick?.():void 0,children:k.label},$))})]}),t.jsxs("div",{className:o.cn(re.body,y?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:o.cn(re.title,y?re.titleNarrow:re.titleWide),children:n}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:re.meta,children:r.map((k,$)=>t.jsxs("li",{className:re.metaLine,children:[k.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:k.icon}),t.jsx("span",{className:re.metaText,children:k.text})]},$))})]}),S&&t.jsxs("div",{"data-testid":`${f}-money`,className:o.cn(re.money,y?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),p.hasContent(c)&&t.jsx("div",{"data-testid":`${f}-amount`,className:o.cn(re.amount,y?re.amountNarrow:re.amountWide),children:c}),p.hasContent(l)&&t.jsx("div",{className:re.amountCaption,children:l}),p.hasContent(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:re.recordId,children:d}),p.hasContent(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:o.cn(re.chips,y?re.chipsNarrow:re.chipsWide),children:u}),C&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:re.statItems,children:x?.map((k,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:o.cn(re.stat,y?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:re.statLabel,children:k.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:re.statValue,style:k.tone?{color:Ye[k.tone].fg}:void 0,children:k.value})]},k.id??$))})]})]}),p.hasContent(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:y?re.statsNarrow:re.statsWide,children:m}),p.hasContent(b)&&t.jsx("div",{"data-testid":`${f}-banner`,children:b})]})};yo.displayName="RecordHeader";const Ip=50,Wt={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]"},vo=({children:e,aside:a,"data-testid":s="record-layout"})=>{const{ref:n,width:r}=It(),i=p.hasContent(a),c=i&&r>0&&ta(r,Ip),l=t.jsx("div",{"data-testid":`${s}-main`,className:Wt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${s}-aside`,className:Wt.aside,children:a},"aside"):null;return t.jsx("div",{ref:n,"data-testid":s,"data-layout":c?"split":"stacked",className:o.cn(Wt.base,c?Wt.split:Wt.stacked),children:c?[l,d]:[d,l]})};vo.displayName="RecordLayout";const Mp=560,qt={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"},jo=({items:e,"data-testid":a="stat-tiles"})=>{const{ref:s,width:n}=It(),r=n>=Um?Math.max(e.length,1):n>=Mp?2:1;return t.jsx("div",{ref:s,"data-testid":a,"data-columns":r,className:qt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,c)=>t.jsxs("div",{"data-testid":`${a}-item-${c}`,className:qt.tile,children:[t.jsx("div",{"data-testid":`${a}-item-${c}-value`,className:qt.value,style:i.tone?{color:Ye[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${a}-item-${c}-label`,className:qt.label,children:i.label}),p.hasContent(i.caption)&&t.jsx("div",{"data-testid":`${a}-item-${c}-caption`,className:qt.caption,children:i.caption})]},c))})};jo.displayName="StatTiles";const it={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"},Bp={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]"}},nn="pill-tabs",rn=(e,a=nn)=>`${a}-tab-${e}`,ln=(e,a=nn)=>`${a}-panel-${e}`,Pp=(e,a=nn)=>({role:"tabpanel",id:ln(e,a),"aria-labelledby":rn(e,a),tabIndex:0}),wo=({items:e,value:a,onChange:s,ariaLabel:n,idPrefix:r,size:i="md","data-testid":c="pill-tabs"})=>{const l=p.useReducedMotion(),d=!!o.useProviderContext()?.disableAnimation,u=r??c,x=Bp[i];return t.jsx(o.Tabs,{"aria-label":n,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:a,onSelectionChange:m=>s(String(m)),"data-testid":c,"data-size":i,classNames:{base:it.base,tabList:it.tabList,cursor:it.cursor,tab:o.cn(it.tab,x.tab,(l||d)&&it.tabStill),tabContent:o.cn(x.tabContent,it.tabContent)},children:e.map(m=>{const b=m["data-testid"]??`${c}-${m.key}`;return t.jsx(o.Tab,{id:rn(m.key,u),"aria-controls":ln(m.key,u),"data-testid":b,title:t.jsxs("span",{className:o.cn(it.title,x.title),children:[p.hasContent(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${b}-icon`,className:o.cn(it.icon,x.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${b}-count`,className:o.cn(x.count,it.count),children:m.count})]})},m.key)})})};wo.displayName="PillTabs";const je={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 ${p.stillTransitionClass}`,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"},br=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:je.dot,style:{backgroundColor:Ye[e.tone].fg}}),t.jsxs("span",{className:je.body,children:[t.jsx("span",{className:je.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:je.meta,children:[e.reference!=null&&t.jsx("span",{className:je.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:je.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:je.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:je.detail,children:e.detail})]}),t.jsx("span",{className:je.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${a}-amount`,className:je.amount,style:aa(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${a}-note`,className:je.note,style:e.noteTone==="warn"?{color:Ye.warn.fg}:void 0,children:e.note}):null})]}),No=({rows:e,footer:a,emptyContent:s,onSelect:n,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:je.base,children:s!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:je.empty,children:s})}):t.jsxs("div",{"data-testid":r,className:je.base,children:[t.jsx("ul",{className:je.list,children:e.map(i=>{const c=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":c,className:je.item,children:n?t.jsx("button",{type:"button",onClick:()=>n(i.id),className:o.cn(je.row,je.rowInteractive),children:t.jsx(br,{row:i,testId:c})}):t.jsx("div",{className:je.row,children:t.jsx(br,{row:i,testId:c})})},i.id)})}),a&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:je.footer,children:[t.jsx("span",{className:je.footerLabel,children:a.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:je.footerAmount,style:aa(a.amountTone),children:a.amount})]}),a.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:je.footerNote,children:a.note})]})]});No.displayName="AmountList";const We={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"},Co=({events:e,emptyContent:a,"data-testid":s="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":s,children:a!=null&&t.jsx("div",{"data-testid":`${s}-empty`,className:We.empty,children:a})}):t.jsx("ol",{"data-testid":s,className:We.list,children:e.map((n,r)=>{const i=r===e.length-1,c=`${s}-event-${n.id}`;return t.jsxs("li",{"data-testid":c,className:o.cn(We.event,!i&&We.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:We.rail,children:[t.jsx("span",{className:We.dot,style:{backgroundColor:Ye[n.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${c}-connector`,className:We.connector})]}),t.jsxs("div",{className:We.body,children:[t.jsxs("div",{className:We.head,children:[t.jsx("span",{className:We.title,children:n.title}),t.jsx("span",{className:We.timestamp,children:n.timestamp})]}),p.hasContent(n.detail)&&t.jsx("div",{className:We.detail,children:n.detail}),p.hasContent(n.actor)&&t.jsx("div",{"data-testid":`${c}-actor`,className:We.actor,children:n.actor})]})]},n.id)})});Co.displayName="ActivityTimeline";const _e={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${La}`,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 ${p.stillTransitionClass}`,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"},gr=({row:e,testId:a})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:_e.rowBody,children:[t.jsxs("span",{className:_e.rowHead,children:[t.jsx("span",{className:e.onSelect?_e.primaryLinked:_e.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:_e.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${a}-amount`,className:_e.amount,style:aa(e.amountTone),children:e.amount})]}),ko=({title:e,count:a,rows:s,emptyContent:n,"data-testid":r="related-record-list"})=>{const i=h.useId(),c=!!e;return t.jsxs("section",{"data-testid":r,role:c?"group":void 0,"aria-labelledby":c?i:void 0,className:_e.base,children:[c&&t.jsxs("div",{className:_e.header,children:[t.jsx("h3",{id:i,className:_e.title,children:e}),a!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:_e.count,children:a})]}),s.length===0?!!n&&t.jsx("div",{"data-testid":`${r}-empty`,className:o.cn(_e.empty,!c&&_e.emptyHeadless),children:n}):t.jsx("ul",{className:_e.list,children:s.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:o.cn(_e.item,d===0&&!c&&_e.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:o.cn(_e.row,_e.rowInteractive),children:t.jsx(gr,{row:l,testId:u})}):t.jsx("div",{className:_e.row,children:t.jsx(gr,{row:l,testId:u})})},l.id)})})]})};ko.displayName="RelatedRecordList";const So=({title:e,titleAs:a="h2",icon:s,count:n,badge:r,action:i,description:c,footer:l,variant:d="section",body:u="padded",surface:x="card",className:m,children:b,"data-testid":f="record-card"})=>{const g=h.useId(),j=p.hasContent(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":x,role:j?"group":void 0,"aria-labelledby":j?g:void 0,className:o.cn(rt.base,Ef[x],m),children:[j&&t.jsxs("div",{"data-testid":`${f}-header`,className:Lf[d],children:[p.hasContent(s)&&t.jsx("span",{"aria-hidden":"true",className:rt.icon,children:s}),t.jsx(a,{id:g,className:rt.title,children:e}),p.hasContent(n)&&t.jsx("span",{"data-testid":`${f}-count`,className:rt.count,children:n}),r,p.hasContent(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:rt.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:Ff[d][u],children:[p.hasContent(c)&&t.jsx("p",{"data-testid":`${f}-description`,className:rt.description,children:c}),b,p.hasContent(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:o.cn(rt.footer,p.hasContent(b)?rt.footerAfterContent:rt.footerAfterDescription),children:l})]})]})};So.displayName="RecordCard";const Tp={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]"},$o=({layout:e="stack",className:a,children:s,"data-testid":n="card-stack",...r})=>t.jsx("div",{...r,"data-testid":n,"data-layout":e,className:o.cn(Tp[e],a),children:s});$o.displayName="CardStack";const ua={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]"},Op={regular:"py-[0.5625rem]",compact:"py-2"},Ao=({rows:e,density:a="regular","data-testid":s="key-value-rows"})=>t.jsx("dl",{"data-testid":s,className:ua.list,children:e.map((n,r)=>t.jsxs("div",{"data-testid":`${s}-row-${n.id??r}`,className:o.cn(ua.row,Op[a]),children:[t.jsx("dt",{className:ua.label,children:n.label}),t.jsx("dd",{className:ua.value,children:n.value})]},n.id??r))});Ao.displayName="KeyValueRows";const Xe={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"},Do=({items:e,ariaLabel:a,originalAmountLabel:s,"data-testid":n="line-item-rows"})=>t.jsx("ul",{"aria-label":a,"data-testid":n,className:Xe.list,children:e.map(r=>{const i=`${n}-item-${r.id}`,c=p.hasContent(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Xe.row,style:r.tone?{backgroundColor:Ye[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Xe.body,children:[t.jsx("div",{className:Xe.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Xe.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Xe.separator,children:"·"}),t.jsx("span",{className:Xe.detail,children:l})]},d))})]}),t.jsxs("div",{className:Xe.trailing,children:[t.jsxs("span",{className:Xe.amounts,children:[c&&t.jsxs("s",{"data-testid":`${i}-original`,className:Xe.original,children:[s&&t.jsxs("span",{className:"sr-only",children:[s," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Xe.amount,style:c?{color:Ye.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Do.displayName="LineItemRows";const zp=37.5,Ie={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"},Eo=({rows:e,total:a,memo:s,"data-testid":n="record-totals"})=>{const{ref:r,width:i}=It(),c=i>0&&!ta(i,zp),l=c?Ie.rowNarrow:Ie.rowWide,d=c?Ie.labelNarrow:Ie.labelWide,u=c?Ie.noteNarrow:Ie.noteWide;return t.jsxs("div",{ref:r,"data-testid":n,"data-size":c?"narrow":"wide",className:Ie.base,children:[e.map(x=>{const m=`${n}-row-${x.id}`;return t.jsxs("div",{"data-testid":m,className:o.cn(l,Ie.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:o.cn(d,Ie.label),children:x.label}),t.jsx("span",{"data-testid":`${m}-note`,className:o.cn(u,Ie.note),children:x.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ie.value,style:aa(x.tone),children:x.value})]},x.id)}),t.jsx("div",{className:Ie.totalRule,children:t.jsxs("div",{"data-testid":`${n}-total`,className:o.cn(l,Ie.totalRow),children:[t.jsx("span",{className:o.cn(d,Ie.totalLabel),children:a.label}),t.jsx("span",{"data-testid":`${n}-total-value`,className:Ie.totalValue,children:a.value})]})}),p.hasContent(s)&&t.jsx("div",{"data-testid":`${n}-memo`,className:Ie.memo,children:s})]})};Eo.displayName="RecordTotals";const bs={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},Vp={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},Lo=({variant:e="text",tone:a,secondary:s,children:n,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:o.cn(bs.base,Vp[e]),style:aa(a),children:[n,p.hasContent(s)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:bs.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),s]})]});Lo.displayName="CellText";const Fo=({children:e,"data-testid":a="chip-stack"})=>t.jsx("span",{"data-testid":a,className:bs.chipStack,children:e});Fo.displayName="ChipStack";function _o({testId:e,title:a,description:s}){return t.jsx(o.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(o.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:a}),t.jsx("p",{className:"text-default-600 leading-snug",children:s})]})})}_o.displayName="SessionExpiredCard";exports.Button=p.Button;exports.Drawer=p.Drawer;exports.Modal=p.Modal;exports.Select=p.Select;exports.Skeleton=p.Skeleton;exports.Table=p.Table;exports.ActivityTimeline=Co;exports.AdminFieldLabel=qs;exports.AdminTable=Hi;exports.AdminTextField=cl;exports.AdminToolbar=Gi;exports.AmountList=No;exports.AppliedCodeCard=Nr;exports.CardList=bo;exports.CardStack=$o;exports.CashTenderForm=Of;exports.CatalogItemCard=Li;exports.CellText=Lo;exports.CheckTenderForm=kl;exports.ChipStack=Fo;exports.CommitmentDetails=Du;exports.ConfirmDialog=Zs;exports.ConfirmationModal=Rs;exports.ConfirmationPageTemplate=qc;exports.CustomerCard=eo;exports.DATE_PICKER_DAY_DEFAULTS=Rc;exports.DatePicker=Cs;exports.DensityProvider=hc;exports.DimensionChip=Ea;exports.DiscardGuard=Bl;exports.DonationAmounts=ai;exports.EmptyState=Is;exports.EntityList=bl;exports.EntityListSkeleton=gl;exports.EntityRow=hl;exports.ErrorState=Ms;exports.EventDetails=Id;exports.EventDetailsTemplate=Kc;exports.ExpandableTable=Wi;exports.ExpireCartTimer=si;exports.FeedbackState=ea;exports.FilterPopover=Bi;exports.FilterSelect=xo;exports.FilterSelectGroup=po;exports.Footer=ad;exports.HeroUIProvider=uc;exports.HorizontalSteps=Gr;exports.InlineConfirm=Il;exports.InstallmentFundAssignment=Cu;exports.InstallmentFundAssignmentSkeleton=$u;exports.InstallmentSchedule=Ku;exports.InstallmentScheduleSkeleton=am;exports.InstallmentTable=im;exports.ItemCard=Ei;exports.KeyValueChip=Ea;exports.KeyValueRows=Ao;exports.LineItemList=Yl;exports.LineItemRows=Do;exports.ListPanel=jl;exports.LoadMoreFooter=ho;exports.LoadingOverlay=_l;exports.LoadingState=Bs;exports.MembershipSelectCards=um;exports.MetaCard=Zx;exports.ModalPanelHeader=Pl;exports.ModalPanels=Nx;exports.ModalShell=Al;exports.ModalShellFooter=El;exports.ModalShellHeader=Dl;exports.Multiselect=sd;exports.Navbar=Wc;exports.NeedsFixDot=Hs;exports.NotesField=ao;exports.Notice=an;exports.OfferCard=ha;exports.OfferCardEmpty=ni;exports.OfferCardError=ri;exports.OfferCardList=ci;exports.OfferCardSkeleton=ii;exports.OtherTenderForm=Sl;exports.OutcomeView=fo;exports.PageHeader=Oi;exports.PaginationSummary=vl;exports.PaymentCashChangeBanner=Ks;exports.PaymentSubAmountInput=Ys;exports.PaymentSuccessView=Rl;exports.PaymentTotalBanner=Fl;exports.PickerRow=ml;exports.PillTabs=wo;exports.PinField=mo;exports.ProgramListItem=Fi;exports.RICH_TEXT_PRESETS=ei;exports.ReasonSelect=to;exports.RecordCard=So;exports.RecordHeader=yo;exports.RecordLayout=vo;exports.RecordTotals=Eo;exports.RedeemCodeInput=zc;exports.RefundMethodCards=oo;exports.RefundProgressList=uo;exports.RelatedRecordList=ko;exports.RevenueDistributionCard=ji;exports.RevenueDistributionEmpty=wi;exports.RevenueDistributionError=Ni;exports.RevenueDistributionSkeleton=Ci;exports.RichTextArea=ti;exports.RowActions=Us;exports.SectionPanel=Jl;exports.SessionExpiredCard=_o;exports.SessionTimeline=Pi;exports.SplitPaymentSummary=$l;exports.SplitTenderPanel=no;exports.StatTiles=jo;exports.StatusChip=zi;exports.StepPager=Qr;exports.StepProgress=tn;exports.Stepper=qr;exports.StepsReadiness=Zr;exports.SuccessState=Ri;exports.Summary=Gl;exports.TableSkeleton=Vi;exports.TenderMethods=so;exports.TicketSelection=Im;exports.TileSelect=Ll;exports.TimeField=ul;exports.ToastProvider=xc;exports.Toggle=Ii;exports.ToolbarButton=Ki;exports.UnderlineTabs=Yi;exports.VerticalSteps=Yr;exports.WizardShell=Kl;exports.adminFieldErrorClass=ll;exports.adminFieldHelpButtonClass=el;exports.adminFieldHelpContentClass=al;exports.adminFieldHelpIconClass=tl;exports.adminFieldHintClass=il;exports.adminFieldLabelClass=Ws;exports.adminFieldLabelNoAutoMarkClass=Ji;exports.adminFieldLabelRowClass=Xi;exports.adminFieldLabelSuffixClass=Zi;exports.adminFieldRequiredClass=Qi;exports.adminInputClass=nl;exports.adminInputReadOnlyClass=rl;exports.adminInputWrapperClass=sl;exports.adminRowClass=zs;exports.adminSurfaceCss=dc;exports.adminSurfaceTokens=Xt;exports.adminTableClass=Vs;exports.adminTableFooterClass=Ui;exports.adminTdClass=Os;exports.adminThClass=Ts;exports.assistantSurfaceTokens=ys;exports.calculateAllocationDifference=fu;exports.computeChange=is;exports.currencyFractionDigits=Rt;exports.firstNeedsFixKey=lf;exports.formatMoney=me;exports.formatOfferCurrency=os;exports.formatRevenueAmount=cu;exports.formatRevenueCurrency=du;exports.generateAutomaticInstallments=$i;exports.generateDistributionId=_s;exports.getCurrencySymbol=uu;exports.offerCardVariants=oi;exports.offerListVariants=li;exports.pageRange=yl;exports.parseOfferCurrency=Md;exports.parseRevenueCurrency=mu;exports.parseTimeInput=xs;exports.pillTabId=rn;exports.pillTabPanelId=ln;exports.pillTabPanelProps=Pp;exports.posSurfaceTokens=le;exports.roundToCurrency=ks;exports.useControlSize=pc;exports.useDensity=ka;exports.useDiscardGuard=Sx;exports.useDiscardGuardActions=ux;exports.useModalPanel=fx;exports.useModalPanels=kx;exports.useReportUnsavedChanges=dx;Object.keys(o).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>o[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)}})();
|