@veevarts/design-system 2.1.0-beta.8 → 2.1.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),p=require("react"),G=require("lucide-react"),De=require("framer-motion"),na=require("@tiptap/react"),Oa=require("@tiptap/core"),Ol=require("@tiptap/extension-bold"),zl=require("@tiptap/extension-italic"),Bl=require("@tiptap/extension-strike"),Vl=require("@tiptap/extension-underline"),Ul=require("@tiptap/extension-code"),Hl=require("@tiptap/extension-color"),ql=require("@tiptap/extension-highlight"),Wl=require("@tiptap/extension-link"),Yl=require("@tiptap/extension-text-style"),Gl=require("@tiptap/extension-heading"),Kl=require("@tiptap/extension-paragraph"),Ql=require("@tiptap/extension-bullet-list"),Zl=require("@tiptap/extension-ordered-list"),Xl=require("@tiptap/extension-task-list"),Jl=require("@tiptap/extension-task-item"),eo=require("@tiptap/extension-list-item"),to=require("@tiptap/extension-code-block"),no=require("@tiptap/extension-blockquote"),ao=require("@tiptap/extension-horizontal-rule"),so=require("@tiptap/extension-hard-break"),za=require("@tiptap/extension-history"),ro=require("@tiptap/extension-text-align"),io=require("@tiptap/extension-document"),lo=require("@tiptap/extension-text"),oo=require("@tiptap/extension-dropcursor"),co=require("@tiptap/extension-gapcursor"),we={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},de={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},fe={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:Ot}=we.neutral,uo=we.palettes.warning[700],mo=we.palettes.warning[100],tt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},aa={"--rust":we.brand.primary[500],"--rust-fill":tt.rustFill,"--rust-border":tt.rustBorder,"--page":tt.page,"--surface":we.neutral.white,"--border":tt.border,"--hair":tt.hair,"--ink":Ot[900],"--ink2":Ot[700],"--sub":Ot[500],"--muted":Ot[400],"--ok":we.semantic.success,"--ok-fill":tt.okFill,"--warn":uo,"--warn-fill":mo,"--danger":we.semantic.danger,"--danger-fill":tt.dangerFill,"--info":we.semantic.info,"--info-fill":tt.infoFill};Object.fromEntries(Object.entries(aa).map(([e,n])=>[e.replace(/^--/,""),n]));function fo({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const a=Object.entries(aa).map(([r,i])=>` ${r}: ${i};`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),p=require("react"),K=require("lucide-react"),De=require("framer-motion"),na=require("@tiptap/react"),Oa=require("@tiptap/core"),Ol=require("@tiptap/extension-bold"),zl=require("@tiptap/extension-italic"),Bl=require("@tiptap/extension-strike"),Vl=require("@tiptap/extension-underline"),Ul=require("@tiptap/extension-code"),Hl=require("@tiptap/extension-color"),ql=require("@tiptap/extension-highlight"),Wl=require("@tiptap/extension-link"),Yl=require("@tiptap/extension-text-style"),Gl=require("@tiptap/extension-heading"),Kl=require("@tiptap/extension-paragraph"),Ql=require("@tiptap/extension-bullet-list"),Zl=require("@tiptap/extension-ordered-list"),Xl=require("@tiptap/extension-task-list"),Jl=require("@tiptap/extension-task-item"),eo=require("@tiptap/extension-list-item"),to=require("@tiptap/extension-code-block"),no=require("@tiptap/extension-blockquote"),ao=require("@tiptap/extension-horizontal-rule"),so=require("@tiptap/extension-hard-break"),za=require("@tiptap/extension-history"),ro=require("@tiptap/extension-text-align"),io=require("@tiptap/extension-document"),lo=require("@tiptap/extension-text"),oo=require("@tiptap/extension-dropcursor"),co=require("@tiptap/extension-gapcursor"),we={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},de={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},fe={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:Ot}=we.neutral,uo=we.palettes.warning[700],mo=we.palettes.warning[100],tt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},aa={"--rust":we.brand.primary[500],"--rust-fill":tt.rustFill,"--rust-border":tt.rustBorder,"--page":tt.page,"--surface":we.neutral.white,"--border":tt.border,"--hair":tt.hair,"--ink":Ot[900],"--ink2":Ot[700],"--sub":Ot[500],"--muted":Ot[400],"--ok":we.semantic.success,"--ok-fill":tt.okFill,"--warn":uo,"--warn-fill":mo,"--danger":we.semantic.danger,"--danger-fill":tt.dangerFill,"--info":we.semantic.info,"--info-fill":tt.infoFill};Object.fromEntries(Object.entries(aa).map(([e,n])=>[e.replace(/^--/,""),n]));function fo({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const a=Object.entries(aa).map(([r,i])=>` ${r}: ${i};`).join(`
2
2
  `),s=n?`
3
3
  font-family: ${n};
4
4
  color: var(--ink);`:"";return`${e} {
5
5
  ${a}${s}
6
6
  }
7
- `}const je={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:we.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...je});function xo({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function ho(e,n){const a=e.icons,s=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(a[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=s[l]&&s[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(a).concat(Object.keys(s)).forEach(i),r}const zs=Object.freeze({left:0,top:0,width:16,height:16}),Zt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),sa=Object.freeze({...zs,...Zt}),On=Object.freeze({...sa,body:"",hidden:!1});function po(e,n){const a={};!e.hFlip!=!n.hFlip&&(a.hFlip=!0),!e.vFlip!=!n.vFlip&&(a.vFlip=!0);const s=((e.rotate||0)+(n.rotate||0))%4;return s&&(a.rotate=s),a}function Ba(e,n){const a=po(e,n);for(const s in On)s in Zt?s in e&&!(s in a)&&(a[s]=Zt[s]):s in n?a[s]=n[s]:s in e&&(a[s]=e[s]);return a}function go(e,n,a){const s=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=Ba(s[o]||r[o],i)}return l(n),a.forEach(l),Ba(e,i)}function Bs(e,n){const a=[];if(typeof e!="object"||typeof e.icons!="object")return a;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),a.push(r)});const s=ho(e);for(const r in s){const i=s[r];i&&(n(r,go(e,r,i)),a.push(r))}return a}const bo={provider:"",aliases:{},not_found:{},...zs};function pn(e,n){for(const a in n)if(a in e&&typeof e[a]!=typeof n[a])return!1;return!0}function Vs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!pn(e,bo))return null;const a=n.icons;for(const r in a){const i=a[r];if(!r||typeof i.body!="string"||!pn(i,On))return null}const s=n.aliases||Object.create(null);for(const r in s){const i=s[r],l=i.parent;if(!r||typeof l!="string"||!a[l]&&!s[l]||!pn(i,On))return null}return n}const Va=Object.create(null);function yo(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function pt(e,n){const a=Va[e]||(Va[e]=Object.create(null));return a[n]||(a[n]=yo(e,n))}function Us(e,n){return Vs(n)?Bs(n,(a,s)=>{s?e.icons[a]=s:e.missing.add(a)}):[]}function vo(e,n,a){try{if(typeof a.body=="string")return e.icons[n]={...a},!0}catch{}return!1}const Hs=/^[a-z0-9]+(-[a-z0-9]+)*$/,ln=(e,n,a,s="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;s=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:s,prefix:d,name:o};return n&&!Wt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:s,prefix:l.shift(),name:l.join("-")};return n&&!Wt(o)?null:o}if(a&&s===""){const o={provider:s,prefix:"",name:i};return n&&!Wt(o,a)?null:o}return null},Wt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let Et=!1;function qs(e){return typeof e=="boolean"&&(Et=e),Et}function Ua(e){const n=typeof e=="string"?ln(e,!0,Et):e;if(n){const a=pt(n.provider,n.prefix),s=n.name;return a.icons[s]||(a.missing.has(s)?null:void 0)}}function jo(e,n){const a=ln(e,!0,Et);if(!a)return!1;const s=pt(a.provider,a.prefix);return n?vo(s,a.name,n):(s.missing.add(a.name),!0)}function wo(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),Et&&!n&&!e.prefix){let r=!1;return Vs(e)&&(e.prefix="",Bs(e,(i,l)=>{jo(i,l)&&(r=!0)})),r}const a=e.prefix;if(!Wt({prefix:a,name:"a"}))return!1;const s=pt(n,a);return!!Us(s,e)}const Ws=Object.freeze({width:null,height:null}),Ys=Object.freeze({...Ws,...Zt}),No=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Co=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ha(e,n,a){if(n===1)return e;if(a=a||100,typeof e=="number")return Math.ceil(e*n*a)/a;if(typeof e!="string")return e;const s=e.split(No);if(s===null||!s.length)return e;const r=[];let i=s.shift(),l=Co.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*a)/a)}else r.push(i);if(i=s.shift(),i===void 0)return r.join("");l=!l}}function ko(e,n="defs"){let a="";const s=e.indexOf("<"+n);for(;s>=0;){const r=e.indexOf(">",s),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;a+=e.slice(r+1,i).trim(),e=e.slice(0,s).trim()+e.slice(l+1)}return{defs:a,content:e}}function So(e,n){return e?"<defs>"+e+"</defs>"+n:n}function $o(e,n,a){const s=ko(e);return So(s.defs,n+s.content+a)}const Ao=e=>e==="unset"||e==="undefined"||e==="none";function Do(e,n){const a={...sa,...e},s={...Ys,...n},r={left:a.left,top:a.top,width:a.width,height:a.height};let i=a.body;[a,s].forEach(j=>{const g=[],w=j.hFlip,N=j.vFlip;let S=j.rotate;w?N?S+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):N&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let v;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:v=r.height/2+r.top,g.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,g.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}S%2===1&&(r.left!==r.top&&(v=r.left,r.left=r.top,r.top=v),r.width!==r.height&&(v=r.width,r.width=r.height,r.height=v)),g.length&&(i=$o(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const l=s.width,o=s.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=Ha(m,d/u)):(f=l==="auto"?d:l,m=o===null?Ha(f,u/d):o==="auto"?u:o);const h={},x=(j,g)=>{Ao(g)||(h[j]=g.toString())};x("width",f),x("height",m);const b=[r.left,r.top,d,u];return h.viewBox=b.join(" "),{attributes:h,viewBox:b,body:i}}const Eo=/\sid="(\S+)"/g,Fo="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Lo=0;function Mo(e,n=Fo){const a=[];let s;for(;s=Eo.exec(e);)a.push(s[1]);if(!a.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return a.forEach(i=>{const l=typeof n=="function"?n(i):n+(Lo++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const zn=Object.create(null);function _o(e,n){zn[e]=n}function Bn(e){return zn[e]||zn[""]}function ra(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const ia=Object.create(null),vt=["https://api.simplesvg.com","https://api.unisvg.com"],Yt=[];for(;vt.length>0;)vt.length===1||Math.random()>.5?Yt.push(vt.shift()):Yt.push(vt.pop());ia[""]=ra({resources:["https://api.iconify.design"].concat(Yt)});function Ro(e,n){const a=ra(n);return a===null?!1:(ia[e]=a,!0)}function la(e){return ia[e]}const To=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let qa=To();function Po(e,n){const a=la(e);if(!a)return 0;let s;if(!a.maxURL)s=0;else{let r=0;a.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";s=a.maxURL-r-a.path.length-i.length}return s}function Io(e){return e===404}const Oo=(e,n,a)=>{const s=[],r=Po(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return a.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(s.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),s.push(l),s};function zo(e){if(typeof e=="string"){const n=la(e);if(n)return n.path}return"/"}const Bo=(e,n,a)=>{if(!qa){a("abort",424);return}let s=zo(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});s+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;s+=i.slice(0,1)==="/"?i.slice(1):i;break}default:a("abort",400);return}let r=503;qa(e+s).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{a(Io(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?a("abort",i):a("next",r)});return}setTimeout(()=>{a("success",i)})}).catch(()=>{a("next",r)})},Vo={prepare:Oo,send:Bo};function Gs(e,n){e.forEach(a=>{const s=a.loaderCallbacks;s&&(a.loaderCallbacks=s.filter(r=>r.id!==n))})}function Uo(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let a=!1;const s=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:s,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:s,prefix:r,name:u});else return a=!0,!0;return!1}),l.pending.length!==o&&(a||Gs([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Ho=0;function qo(e,n,a){const s=Ho++,r=Gs.bind(null,a,s);if(!n.pending.length)return r;const i={id:s,icons:n,callback:e,abort:r};return a.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function Wo(e){const n={loaded:[],missing:[],pending:[]},a=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 s={provider:"",prefix:"",name:""};return e.forEach(r=>{if(s.name===r.name&&s.prefix===r.prefix&&s.provider===r.provider)return;s=r;const i=r.provider,l=r.prefix,o=r.name,d=a[i]||(a[i]=Object.create(null)),u=d[l]||(d[l]=pt(i,l));let f;o in u.icons?f=n.loaded:l===""||u.missing.has(o)?f=n.missing:f=n.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),n}function Yo(e,n=!0,a=!1){const s=[];return e.forEach(r=>{const i=typeof r=="string"?ln(r,n,a):r;i&&s.push(i)}),s}const Go={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ko(e,n,a,s){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let M=e.resources.slice(0);for(l=[];M.length>1;){const k=Math.floor(Math.random()*M.length);l.push(M[k]),M=M.slice(0,k).concat(M.slice(k+1))}l=l.concat(M)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,h=[],x=[];typeof s=="function"&&x.push(s);function b(){m&&(clearTimeout(m),m=null)}function j(){d==="pending"&&(d="aborted"),b(),h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function g(M,k){k&&(x=[]),typeof M=="function"&&x.push(M)}function w(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:h.length,subscribe:g,abort:j}}function N(){d="failed",x.forEach(M=>{M(void 0,f)})}function S(){h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function v(M,k,E){const C=k!=="success";switch(h=h.filter(R=>R!==M),d){case"pending":break;case"failed":if(C||!e.dataAfterTimeout)return;break;default:return}if(k==="abort"){f=E,N();return}if(C){f=E,h.length||(l.length?D():N());return}if(b(),S(),!e.random){const R=e.resources.indexOf(M.resource);R!==-1&&R!==e.index&&(e.index=R)}d="completed",x.forEach(R=>{R(E)})}function D(){if(d!=="pending")return;b();const M=l.shift();if(M===void 0){if(h.length){m=setTimeout(()=>{b(),d==="pending"&&(S(),N())},e.timeout);return}N();return}const k={status:"pending",resource:M,callback:(E,C)=>{v(k,E,C)}};h.push(k),u++,m=setTimeout(D,e.rotate),a(M,n,k.callback)}return setTimeout(D),w}function Ks(e){const n={...Go,...e};let a=[];function s(){a=a.filter(o=>o().status==="pending")}function r(o,d,u){const f=Ko(n,o,d,(m,h)=>{s(),u&&u(m,h)});return a.push(f),f}function i(o){return a.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:s}}function Wa(){}const gn=Object.create(null);function Qo(e){if(!gn[e]){const n=la(e);if(!n)return;const a=Ks(n),s={config:n,redundancy:a};gn[e]=s}return gn[e]}function Zo(e,n,a){let s,r;if(typeof e=="string"){const i=Bn(e);if(!i)return a(void 0,424),Wa;r=i.send;const l=Qo(e);l&&(s=l.redundancy)}else{const i=ra(e);if(i){s=Ks(i);const l=e.resources?e.resources[0]:"",o=Bn(l);o&&(r=o.send)}}return!s||!r?(a(void 0,424),Wa):s.query(n,r,a)().abort}function Ya(){}function Xo(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Uo(e)}))}function Jo(e){const n=[],a=[];return e.forEach(s=>{(s.match(Hs)?n:a).push(s)}),{valid:n,invalid:a}}function jt(e,n,a){function s(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(a&&typeof a=="object")try{if(!Us(e,a).length){s();return}}catch(r){console.error(r)}s(),Xo(e)}function Ga(e,n){e instanceof Promise?e.then(a=>{n(a)}).catch(()=>{n(null)}):n(e)}function ec(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:a,prefix:s}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ga(e.loadIcons(r,s,a),f=>{jt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,s,a);Ga(m,h=>{const x=h?{prefix:s,icons:{[f]:h}}:null;jt(e,[f],x)})});return}const{valid:l,invalid:o}=Jo(r);if(o.length&&jt(e,o,null),!l.length)return;const d=s.match(Hs)?Bn(a):null;if(!d){jt(e,l,null);return}d.prepare(a,s,l).forEach(f=>{Zo(a,f,m=>{jt(e,f.icons,m)})})}))}const tc=(e,n)=>{const a=Yo(e,!0,qs()),s=Wo(a);if(!s.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(s.loaded,s.missing,s.pending,Ya)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return s.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(pt(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),s.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,h=pt(u,f),x=h.pendingIcons||(h.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&ec(d,u)}),n?qo(n,s,i):Ya};function nc(e,n){const a={...e};for(const s in n){const r=n[s],i=typeof r;s in Ws?(r===null||r&&(i==="string"||i==="number"))&&(a[s]=r):i===typeof a[s]&&(a[s]=s==="rotate"?r%4:r)}return a}const ac=/[\s,]+/;function sc(e,n){n.split(ac).forEach(a=>{switch(a.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function rc(e,n=0){const a=e.replace(/^-?[0-9.]*/,"");function s(r){for(;r<0;)r+=4;return r%4}if(a===""){const r=parseInt(e);return isNaN(r)?0:s(r)}else if(a!==e){let r=0;switch(a){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-a.length));return isNaN(i)?0:(i=i/r,i%1===0?s(i):0)}}return n}function ic(e,n){let a=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const s in n)a+=" "+s+'="'+n[s]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+a+">"+e+"</svg>"}function lc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function oc(e){return"data:image/svg+xml,"+lc(e)}function cc(e){return'url("'+oc(e)+'")'}let $t;function dc(){try{$t=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{$t=null}}function uc(e){return $t===void 0&&dc(),$t?$t.createHTML(e):e}const Qs={...Ys,inline:!1},mc={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},fc={display:"inline-block"},Vn={backgroundColor:"currentColor"},Zs={backgroundColor:"transparent"},Ka={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Qa={WebkitMask:Vn,mask:Vn,background:Zs};for(const e in Qa){const n=Qa[e];for(const a in Ka)n[e+a]=Ka[a]}const xc={...Qs,inline:!0};function Za(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const hc=(e,n,a)=>{const s=n.inline?xc:Qs,r=nc(s,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?mc:{}};if(a){const g=ln(a,!1,!0);if(g){const w=["iconify"],N=["provider","prefix"];for(const S of N)g[S]&&w.push("iconify--"+g[S]);d.className=w.join(" ")}}for(let g in n){const w=n[g];if(w!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[g]=(d[g]?d[g]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[g]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&sc(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[g]=rc(w):typeof w=="number"&&(r[g]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:s[g]===void 0&&(d[g]=w)}}const u=Do(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let g=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:uc(Mo(u.body,w?()=>w+"ID"+g++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:h,height:x}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),j=ic(m,{...f,width:h+"",height:x+""});return d.style={...l,"--svg":cc(j),width:Za(f.width),height:Za(f.height),...fc,...b?Vn:Zs,...o},p.createElement("span",d)};qs(!0);_o("",Vo);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,a="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(s=>{try{(typeof s!="object"||s===null||s instanceof Array||typeof s.icons!="object"||typeof s.prefix!="string"||!wo(s))&&console.error(a)}catch{console.error(a)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let a in n){const s="IconifyProviders["+a+"] is invalid.";try{const r=n[a];if(typeof r!="object"||!r||r.resources===void 0)continue;Ro(a,r)||console.error(s)}catch{console.error(s)}}}}function Xs(e){const[n,a]=p.useState(!!e.ssr),[s,r]=p.useState({});function i(x){if(x){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const j=Ua(b);if(j)return{name:b,data:j}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const x=s.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(l)!==JSON.stringify(x))return d(),o(x),!0}function f(){var x;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const j=Ua(b);if(u({name:b,data:j}))if(j===void 0){const g=tc([b],f);r({callback:g})}else j&&((x=e.onLoad)===null||x===void 0||x.call(e,b))}p.useEffect(()=>(a(!0),d),[]),p.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:h}=l;return h?hc({...sa,...h},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const I=p.forwardRef((e,n)=>Xs({...e,_ref:n}));p.forwardRef((e,n)=>Xs({inline:!0,...e,_ref:n}));const V=p.forwardRef(({color:e="primary",radius:n="full",testId:a="veevart-button",...s},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":a,...s}));V.displayName="Button";function Js({code:e,amount:n,onRemove:a,label:s="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:s}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(V,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:a,children:t.jsx(I,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function bn(e,n){return e-n*Math.floor(e/n)}const er=1721426;function zt(e,n,a,s){n=oa(e,n);let r=n-1,i=-2;return a<=2?i=0:Gt(n)&&(i=-1),er-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*a-362)/12+i+s)}function Gt(e){return e%4===0&&(e%100!==0||e%400===0)}function oa(e,n){return e==="BC"?1-n:n}function pc(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,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 on{fromJulianDay(n){let a=n,s=a-er,r=Math.floor(s/146097),i=bn(s,146097),l=Math.floor(i/36524),o=bn(i,36524),d=Math.floor(o/1461),u=bn(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[h,x]=pc(m),b=a-zt(h,x,1,1),j=2;a<zt(h,x,3,1)?j=0:Gt(x)&&(j=1);let g=Math.floor(((b+j)*12+373)/367),w=a-zt(h,x,g,1)+1;return new Ft(h,x,g,w)}toJulianDay(n){return zt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return gc[Gt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return Gt(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function bc(e,n){var a,s,r,i;return(i=(r=(a=e.isEqual)===null||a===void 0?void 0:a.call(e,n))!==null&&r!==void 0?r:(s=n.isEqual)===null||s===void 0?void 0:s.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function tr(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function nr(e,n){return Xa(e)-Xa(n)}function Xa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let yn=null;function ar(){return yn==null&&(yn=new Intl.DateTimeFormat().resolvedOptions().timeZone),yn}function Ja(e){e=ca(e,new on);let n=oa(e.era,e.year);return sr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function sr(e,n,a,s,r,i,l){let o=new Date;return o.setUTCHours(s,r,i,l),o.setUTCFullYear(e,n-1,a),o.getTime()}function es(e,n){if(n==="UTC")return 0;if(e>0&&n===ar())return new Date(e).getTimezoneOffset()*-6e4;let{year:a,month:s,day:r,hour:i,minute:l,second:o}=rr(e,n);return sr(a,s,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const ts=new Map;function rr(e,n){let a=ts.get(n);a||(a=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ts.set(n,a));let s=a.formatToParts(new Date(e)),r={};for(let i of s)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 ns=864e5;function yc(e,n,a,s){return(a===s?[a]:[a,s]).filter(i=>vc(e,n,i))}function vc(e,n,a){let s=rr(a,n);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function jc(e,n,a="compatible"){let s=lr(e);if(n==="UTC")return Ja(s);if(n===ar()&&a==="compatible"){s=ca(s,new on);let d=new Date,u=oa(s.era,s.year);return d.setFullYear(u,s.month-1,s.day),d.setHours(s.hour,s.minute,s.second,s.millisecond),d.getTime()}let r=Ja(s),i=es(r-ns,n),l=es(r+ns,n),o=yc(s,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(a){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(a){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ir(e,n,a="compatible"){return new Date(jc(e,n,a))}function lr(e,n){let a=0,s=0,r=0,i=0;if("timeZone"in e)({hour:a,minute:s,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:a,minute:s,second:r,millisecond:i}=n),new Xt(e.calendar,e.era,e.year,e.month,e.day,a,s,r,i)}function ca(e,n){if(bc(e.calendar,n))return e;let a=n.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=n,s.era=a.era,s.year=a.year,s.month=a.month,s.day=a.day,gt(s),s}function da(e,n){let a=e.copy(),s="hour"in a?xr(a,n):0;Un(a,n.years||0),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e),a.month+=n.months||0,Hn(a),or(a),a.day+=(n.weeks||0)*7,a.day+=n.days||0,a.day+=s,wc(a),a.calendar.balanceDate&&a.calendar.balanceDate(a),a.year<1&&(a.year=1,a.month=1,a.day=1);let r=a.calendar.getYearsInEra(a);if(a.year>r){var i,l;let d=(i=(l=a.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,a);a.year=r,a.month=d?1:a.calendar.getMonthsInYear(a),a.day=d?1:a.calendar.getDaysInMonth(a)}a.month<1&&(a.month=1,a.day=1);let o=a.calendar.getMonthsInYear(a);return a.month>o&&(a.month=o,a.day=a.calendar.getDaysInMonth(a)),a.day=Math.max(1,Math.min(a.calendar.getDaysInMonth(a),a.day)),a}function Un(e,n){var a,s;!((a=(s=e.calendar).isInverseEra)===null||a===void 0)&&a.call(s,e)&&(n=-n),e.year+=n}function Hn(e){for(;e.month<1;)Un(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,Un(e,1)}function wc(e){for(;e.day<1;)e.month--,Hn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Hn(e)}function or(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 gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),or(e)}function cr(e){let n={};for(let a in e)typeof e[a]=="number"&&(n[a]=-e[a]);return n}function dr(e,n){return da(e,cr(n))}function ur(e,n){let a=e.copy();return n.era!=null&&(a.era=n.era),n.year!=null&&(a.year=n.year),n.month!=null&&(a.month=n.month),n.day!=null&&(a.day=n.day),gt(a),a}function mr(e,n){let a=e.copy();return n.hour!=null&&(a.hour=n.hour),n.minute!=null&&(a.minute=n.minute),n.second!=null&&(a.second=n.second),n.millisecond!=null&&(a.millisecond=n.millisecond),fr(a),a}function Nc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Bt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Bt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Bt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=Bt(e.hour,24),n}function fr(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Bt(e,n){let a=e%n;return a<0&&(a+=n),a}function xr(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,Nc(e)}function hr(e,n){let a=e.copy();return xr(a,n),a}function Cc(e,n){return hr(e,cr(n))}function pr(e,n,a,s){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=st(d,a,0,o.length-1,s?.round),r.era=o[d],gt(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(a=-a),r.year=st(e.year,a,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=st(e.month,a,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(e.day,a,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),gt(r),r}function gr(e,n,a,s){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(s?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=st(i,a,l,o,s?.round);break}case"minute":r.minute=st(e.minute,a,0,59,s?.round);break;case"second":r.second=st(e.second,a,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,a,0,999,s?.round);break;default:throw new Error("Unsupported field "+n)}return r}function st(e,n,a,s,r=!1){if(r){e+=Math.sign(n),e<a&&(e=s);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>s&&(e=a)}else e+=n,e<a?e=s-(a-e-1):e>s&&(e=a+(e-s-1));return e}const kc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Sc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function $c(e){let n=e.match(kc);if(!n)throw Sc.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let a=new Ft(vn(n[1],0,9999),vn(n[2],1,12),1);return a.day=vn(n[3],1,a.calendar.getDaysInMonth(a)),a}function vn(e,n,a){let s=Number(e);if(s<n||s>a)throw new RangeError(`Value out of range: ${n} <= ${s} <= ${a}`);return s}function br(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 yr(e){let n=ca(e,new on),a;return n.era==="BC"?a=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):a=String(n.year).padStart(4,"0"),`${a}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function Ac(e){return`${yr(e)}T${br(e)}`}function Dc(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ua(e,n,a){Dc(e,n),n.set(e,a)}function vr(e){let n=typeof e[0]=="object"?e.shift():new on,a;if(typeof e[0]=="string")a=e.shift();else{let l=n.getEras();a=l[l.length-1]}let s=e.shift(),r=e.shift(),i=e.shift();return[n,a,s,r,i]}var Ec=new WeakMap;class Ft{copy(){return this.era?new Ft(this.calendar,this.era,this.year,this.month,this.day):new Ft(this.calendar,this.year,this.month,this.day)}add(n){return da(this,n)}subtract(n){return dr(this,n)}set(n){return ur(this,n)}cycle(n,a,s){return pr(this,n,a,s)}toDate(n){return ir(this,n)}toString(){return yr(this)}compare(n){return tr(this,n)}constructor(...n){ua(this,Ec,{writable:!0,value:void 0});let[a,s,r,i,l]=vr(n);this.calendar=a,this.era=s,this.year=r,this.month=i,this.day=l,gt(this)}}var Fc=new WeakMap;class cn{copy(){return new cn(this.hour,this.minute,this.second,this.millisecond)}add(n){return hr(this,n)}subtract(n){return Cc(this,n)}set(n){return mr(this,n)}cycle(n,a,s){return gr(this,n,a,s)}toString(){return br(this)}compare(n){return nr(this,n)}constructor(n=0,a=0,s=0,r=0){ua(this,Fc,{writable:!0,value:void 0}),this.hour=n,this.minute=a,this.second=s,this.millisecond=r,fr(this)}}var Lc=new WeakMap;class Xt{copy(){return this.era?new Xt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Xt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return da(this,n)}subtract(n){return dr(this,n)}set(n){return ur(mr(this,n),n)}cycle(n,a,s){switch(n){case"era":case"year":case"month":case"day":return pr(this,n,a,s);default:return gr(this,n,a,s)}}toDate(n,a){return ir(this,n,a)}toString(){return Ac(this)}compare(n){let a=tr(this,n);return a===0?nr(this,lr(n)):a}constructor(...n){ua(this,Lc,{writable:!0,value:void 0});let[a,s,r,i,l]=vr(n);this.calendar=a,this.era=s,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,gt(this)}}const Mc="Open time options",_c=320;function as(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function jn(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,a="minute"in e&&typeof e.minute=="number"?e.minute:0,s="second"in e&&typeof e.second=="number"?e.second:0;return new cn(n,a,s)}function Rc(e,n){const a=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(a)}function Tc(e){const n=[];for(let a=0;a<24;a+=1)for(let s=0;s<60;s+=e)n.push(new cn(a,s));return n}function Pc(e){const{minuteStep:n=15,timeListClassName:a,timeListLabel:s=Mc,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[h,x]=p.useState(()=>jn(d)),b=m?jn(o):h,j=p.useMemo(()=>Tc(n),[n]),g=N=>{m||x(N),l?.(N)},w=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":s,...r,onPress:void 0,children:t.jsx(G.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:a??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(N=>{const S=b?.hour===N.hour&&b?.minute===N.minute;return t.jsx(c.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(N),children:Rc(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>g(jn(N))})}function ma(e){if(e.mode==="time")return t.jsx(Pc,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=_c,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:as("min-w-[20rem]",u?.popoverContent),calendarContent:as("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:a="day",...s}=e;return t.jsx(c.DatePicker,{...s,granularity:a})}function Ic(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const He=p.forwardRef(({popoverProps:e,...n},a)=>{const s=p.useRef(null),[r,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(Ic(s.current))},[]),t.jsx("span",{ref:s,className:"contents",children:t.jsx(c.Select,{ref:a,...n,popoverProps:l})})});He.displayName="Select";function Oc({state:e,onSubmit:n,onRemove:a,appliedCredit:s,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),h=p.useId(),[x,b]=p.useState(e);e!==x&&(b(e),e==="applied"&&m(""));const j=()=>{const N=f.trim();N&&n(N)},g=N=>{N.key==="Enter"&&(N.preventDefault(),j())};if(e==="applied"&&s)return t.jsx("div",{"data-testid":u,children:t.jsx(Js,{code:s.code,amount:s.amount,onRemove:a,removeAriaLabel:d,testId:`${u}-card`})});const w=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?h:void 0}),t.jsx(V,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:o})]}),w&&t.jsx("p",{id:h,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const zc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Bc({languages:e,selectedLanguage:n,onLanguageChange:a,label:s}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(He,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":s,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;a?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:s,startContent:t.jsx(G.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||s}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(He,{"aria-label":s,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;a?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(G.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 Vc({isLoggedIn:e,onLogin:n,onLogout:a,labels:s}){return e?t.jsxs(V,{"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:a,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:s.logout})]}):t.jsxs(V,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:s.login})]})}function Uc({logo:e,languages:n=[],selectedLanguage:a,onLanguageChange:s,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...zc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||n.length>0)&&t.jsx(Bc,{languages:n,selectedLanguage:a,onLanguageChange:s,label:m.selectLanguage}),d&&t.jsx(Vc,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Hc(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 wn;const qc=typeof document<"u"?(wn=p.useInsertionEffect)!==null&&wn!==void 0?wn:p.useLayoutEffect:()=>{};function dn(e,n,a){let[s,r]=p.useState(e||n),i=p.useRef(s),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:s;qc(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...h)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),a?.(x,...h))},[a]);return[d,f]}function jr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(De.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 wr=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:a=3,defaultStep:s=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:h,currentStep:x,hideProgressBars:b=!1,stepClassName:j,className:g,isDisabled:w=!1,...N},S)=>{const[v,D]=dn(x,s,h),M=p.useMemo(()=>{let k,E;const C=["[--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":k="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":k="[--step-color:var(--heroui-secondary)]",E="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":k="[--step-color:var(--heroui-success)]",E="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":k="[--step-color:var(--heroui-warning)]",E="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":k="[--step-color:var(--heroui-danger)]",E="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":k="[--step-color:var(--heroui-default)]",E="[--step-fg-color:var(--heroui-default-foreground)]";break;default:k="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break}return C.unshift(E),C.unshift(k),C},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):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",M,g),"data-testid":"stepper-list",children:Array.from({length:a})?.map((k,E)=>{const C=v===E?"active":v<E?"inactive":"complete",R=n==="activeLabel"&&C==="active"&&!!i?.[E],A=l&&C!=="active"&&!!i?.[E];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${E}`,children:[t.jsx(c.Tooltip,{content:A?i?.[E]:void 0,isDisabled:!A,offset:12,placement:o,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":C==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":R},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&D(E),disabled:w,"data-testid":`stepper-step-btn-${E}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:C,className:"relative z-10",children:t.jsx(De.m.div,{animate:C,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":R,"bg-(--complete-background-color)":C==="complete","shadow-lg":C==="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:C==="complete"&&n==="default"?t.jsx(jr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${E}`}):t.jsx("span",{children:E+1})})})})})}),R?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${E}`,children:i[E]}):null]},E)}),E<a-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":E},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":E<v})})})]},E)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null]})});wr.displayName="Stepper";function Wc(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 ge(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a}).format(e)}catch{return`${a} ${e.toFixed(2)}`}}function Mt(e,n="en-US"){try{const a=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof a.maximumFractionDigits=="number"?a.maximumFractionDigits:2}catch{return 2}}function Nr(e,n,a="en-US"){const s=Mt(n,a),r=Math.pow(10,s);return Math.round(e*r)/r}function qn(e,n,a,s){return Nr(e-n,a,s)}const ss={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)",Gc="rgb(107 114 128)",Cr=p.forwardRef(function({color:n="primary",steps:a=[],defaultStep:s=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Yc,inactiveLabelColor:f=Gc,activeStepVariant:m="bordered",stepClassName:h,circleClassName:x,progressBarClassName:b,labelsClassName:j,labelSlotClassName:g,activeLabelClassName:w,inactiveLabelClassName:N,className:S,ariaLabel:v="Progress",invalidLabelSuffix:D=", has errors",testId:M,isStepReachable:k,...E},C){const[R,A]=dn(i,s,r),F=ss[n]??ss.primary,_=o??F.active,T=d??F.fg,q=(B,U)=>{const Q=B.ariaLabel??(typeof B.title=="string"?B.title:null)??`${U+1}`;return B.invalid?`${Q}${D}`:Q};return t.jsxs("nav",{...E,"aria-label":v,...M?{"data-testid":M}:{},children:[t.jsx("div",{className:c.cn("flex items-center",S),children:a?.map((B,U)=>{const K=U===R?"active":U<R?"complete":"inactive",Q=k?k(U):!0;return t.jsxs(p.Fragment,{children:[t.jsx(V,{ref:C,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${M??"horizontal-steps"}-step-${U}`,"aria-current":K==="active"?"step":void 0,"aria-describedby":B.describedBy,"aria-label":q(B,U),"data-invalid":B.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",B.className,h),onPress:()=>{if(i===void 0){A(U);return}r?.(U)},children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:K,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?_:"transparent",borderColor:_,borderWidth:"1.5px",color:m==="solid"?T:_},complete:{backgroundColor:_,borderColor:_,borderWidth:"1.5px",color:_}},children:K==="complete"?t.jsx(jr,{className:"size-4",style:{color:T}}):t.jsx("span",{children:U+1})})})}),U<a.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:U<R?_:u}})]},U)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",j),children:a?.map((B,U)=>{const K=U<=R;return t.jsxs(p.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",K?w:N),style:{color:K?_:f},children:B.title})}),U<a.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},U)})})]})});Cr.displayName="HorizontalSteps";function Kc(){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 Qc=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Zc,{...e},n)},Zc=({allItems:e,selected:n,onSelectedChange:a,titleLeft:s,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,h]=p.useState(null),x=p.useMemo(()=>new Set(n),[n]),b=p.useMemo(()=>new Set(e),[e]),j=p.useMemo(()=>e.filter(A=>!x.has(A)),[e,x]),g=A=>{if(A.length===0)return;const F=Array.from(new Set([...n,...A]));a(F)},w=A=>{if(A.length===0)return;const F=new Set(A);a(n.filter(_=>!F.has(_)))},N=()=>{i.length!==0&&(g(i),l([]))},S=()=>{o.length!==0&&(w(o),d([]))},v=()=>{j.length!==0&&(g(j),l([]))},D=()=>{n.length!==0&&(a([]),d([]))},M=(A,F,_)=>{const T=Math.min(F,_),q=Math.max(F,_);return A.slice(T,q+1)},k=(A,F,_)=>{if(_&&u!==null){l(M(j,u,F)),d([]),f(F);return}const T=i.includes(A);l(T?i.filter(q=>q!==A):[...i,A]),d([]),f(F)},E=(A,F,_)=>{if(_&&m!==null){d(M(n,m,F)),l([]),h(F);return}const T=o.includes(A);d(T?o.filter(q=>q!==A):[...o,A]),l([]),h(F)},C=(A,F,_)=>{const T=_==="available"?i.includes(F)?i:[F]:o.includes(F)?o:[F];A.dataTransfer.setData("text/plain",JSON.stringify({source:_,items:T})),A.dataTransfer.effectAllowed="move"},R=(A,F)=>{A.preventDefault();const _=A.dataTransfer.getData("text/plain");if(_)try{const T=JSON.parse(_),q=(T.items||[]).filter(B=>b.has(B));if(q.length===0||T.source===F)return;F==="selected"?(g(q),l([])):(w(q),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:s}),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:A=>A.preventDefault(),onDrop:A=>R(A,"available"),children:j.map((A,F)=>{const _=i.includes(A);return t.jsx("button",{type:"button",onClick:T=>{k(A,F,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>C(T,A,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:A},A)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(V,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(V,{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:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(V,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:v,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(V,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:D,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:A=>A.preventDefault(),onDrop:A=>R(A,"selected"),children:n.map((A,F)=>{const _=o.includes(A);return t.jsx("button",{type:"button",onClick:T=>{E(A,F,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>C(T,A,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${_?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:A},A)})})})]})]})};function Lt(e){return typeof e=="string"?e:e.type}function it({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function lt({icon:e,label:n,isActive:a=!1,isDisabled:s=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(V,{size:"sm",radius:"sm",color:a?"primary":"default",variant:a?"solid":"bordered",isIconOnly:!0,isDisabled:s,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const Ze={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const a=n?.type==="textColor"?n.color:"";a?e.chain().focus().setColor(a).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const a=n?.type==="highlight"?n.color:"";a?e.chain().focus().setHighlight({color:a}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const a=n?.type==="link"?n.href:"";if(a){const s=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:a,target:s,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const a=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:a}).run()},canExecute:(e,n)=>{const a=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:a}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const a=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(a).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Xc={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Jc({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:a=!1}){const[,s]=p.useState(0);p.useEffect(()=>{const l=()=>s(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Ze.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(V,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,startContent:t.jsx(G.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(G.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Xc[l]},l))})]})}const Nn={bulletList:{label:"Bullet List",icon:G.List},orderedList:{label:"Numbered List",icon:G.ListOrdered},taskList:{label:"Task List",icon:G.ListTodo}};function ed({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:a=!1}){const[,s]=p.useState(0);p.useEffect(()=>{const o=()=>s(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Nn[r].icon:G.List,l=o=>{const u=Ze[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(V,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:n.map(o=>{const d=Nn[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Nn[o].label},o)})})]})}function td({colors:e,selectedColor:n,onColorSelect:a,columns:s=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>a(r),className:`
7
+ `}const je={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:we.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...je});function xo({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function ho(e,n){const a=e.icons,s=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(a[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=s[l]&&s[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(a).concat(Object.keys(s)).forEach(i),r}const zs=Object.freeze({left:0,top:0,width:16,height:16}),Zt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),sa=Object.freeze({...zs,...Zt}),On=Object.freeze({...sa,body:"",hidden:!1});function po(e,n){const a={};!e.hFlip!=!n.hFlip&&(a.hFlip=!0),!e.vFlip!=!n.vFlip&&(a.vFlip=!0);const s=((e.rotate||0)+(n.rotate||0))%4;return s&&(a.rotate=s),a}function Ba(e,n){const a=po(e,n);for(const s in On)s in Zt?s in e&&!(s in a)&&(a[s]=Zt[s]):s in n?a[s]=n[s]:s in e&&(a[s]=e[s]);return a}function go(e,n,a){const s=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=Ba(s[o]||r[o],i)}return l(n),a.forEach(l),Ba(e,i)}function Bs(e,n){const a=[];if(typeof e!="object"||typeof e.icons!="object")return a;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),a.push(r)});const s=ho(e);for(const r in s){const i=s[r];i&&(n(r,go(e,r,i)),a.push(r))}return a}const bo={provider:"",aliases:{},not_found:{},...zs};function pn(e,n){for(const a in n)if(a in e&&typeof e[a]!=typeof n[a])return!1;return!0}function Vs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!pn(e,bo))return null;const a=n.icons;for(const r in a){const i=a[r];if(!r||typeof i.body!="string"||!pn(i,On))return null}const s=n.aliases||Object.create(null);for(const r in s){const i=s[r],l=i.parent;if(!r||typeof l!="string"||!a[l]&&!s[l]||!pn(i,On))return null}return n}const Va=Object.create(null);function yo(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function pt(e,n){const a=Va[e]||(Va[e]=Object.create(null));return a[n]||(a[n]=yo(e,n))}function Us(e,n){return Vs(n)?Bs(n,(a,s)=>{s?e.icons[a]=s:e.missing.add(a)}):[]}function vo(e,n,a){try{if(typeof a.body=="string")return e.icons[n]={...a},!0}catch{}return!1}const Hs=/^[a-z0-9]+(-[a-z0-9]+)*$/,ln=(e,n,a,s="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;s=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:s,prefix:d,name:o};return n&&!Wt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:s,prefix:l.shift(),name:l.join("-")};return n&&!Wt(o)?null:o}if(a&&s===""){const o={provider:s,prefix:"",name:i};return n&&!Wt(o,a)?null:o}return null},Wt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let Et=!1;function qs(e){return typeof e=="boolean"&&(Et=e),Et}function Ua(e){const n=typeof e=="string"?ln(e,!0,Et):e;if(n){const a=pt(n.provider,n.prefix),s=n.name;return a.icons[s]||(a.missing.has(s)?null:void 0)}}function jo(e,n){const a=ln(e,!0,Et);if(!a)return!1;const s=pt(a.provider,a.prefix);return n?vo(s,a.name,n):(s.missing.add(a.name),!0)}function wo(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),Et&&!n&&!e.prefix){let r=!1;return Vs(e)&&(e.prefix="",Bs(e,(i,l)=>{jo(i,l)&&(r=!0)})),r}const a=e.prefix;if(!Wt({prefix:a,name:"a"}))return!1;const s=pt(n,a);return!!Us(s,e)}const Ws=Object.freeze({width:null,height:null}),Ys=Object.freeze({...Ws,...Zt}),No=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Co=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ha(e,n,a){if(n===1)return e;if(a=a||100,typeof e=="number")return Math.ceil(e*n*a)/a;if(typeof e!="string")return e;const s=e.split(No);if(s===null||!s.length)return e;const r=[];let i=s.shift(),l=Co.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*a)/a)}else r.push(i);if(i=s.shift(),i===void 0)return r.join("");l=!l}}function ko(e,n="defs"){let a="";const s=e.indexOf("<"+n);for(;s>=0;){const r=e.indexOf(">",s),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;a+=e.slice(r+1,i).trim(),e=e.slice(0,s).trim()+e.slice(l+1)}return{defs:a,content:e}}function So(e,n){return e?"<defs>"+e+"</defs>"+n:n}function $o(e,n,a){const s=ko(e);return So(s.defs,n+s.content+a)}const Ao=e=>e==="unset"||e==="undefined"||e==="none";function Do(e,n){const a={...sa,...e},s={...Ys,...n},r={left:a.left,top:a.top,width:a.width,height:a.height};let i=a.body;[a,s].forEach(j=>{const g=[],w=j.hFlip,N=j.vFlip;let S=j.rotate;w?N?S+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):N&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let v;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:v=r.height/2+r.top,g.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,g.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}S%2===1&&(r.left!==r.top&&(v=r.left,r.left=r.top,r.top=v),r.width!==r.height&&(v=r.width,r.width=r.height,r.height=v)),g.length&&(i=$o(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const l=s.width,o=s.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=Ha(m,d/u)):(f=l==="auto"?d:l,m=o===null?Ha(f,u/d):o==="auto"?u:o);const h={},x=(j,g)=>{Ao(g)||(h[j]=g.toString())};x("width",f),x("height",m);const b=[r.left,r.top,d,u];return h.viewBox=b.join(" "),{attributes:h,viewBox:b,body:i}}const Eo=/\sid="(\S+)"/g,Fo="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Lo=0;function Mo(e,n=Fo){const a=[];let s;for(;s=Eo.exec(e);)a.push(s[1]);if(!a.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return a.forEach(i=>{const l=typeof n=="function"?n(i):n+(Lo++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const zn=Object.create(null);function _o(e,n){zn[e]=n}function Bn(e){return zn[e]||zn[""]}function ra(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const ia=Object.create(null),vt=["https://api.simplesvg.com","https://api.unisvg.com"],Yt=[];for(;vt.length>0;)vt.length===1||Math.random()>.5?Yt.push(vt.shift()):Yt.push(vt.pop());ia[""]=ra({resources:["https://api.iconify.design"].concat(Yt)});function Ro(e,n){const a=ra(n);return a===null?!1:(ia[e]=a,!0)}function la(e){return ia[e]}const To=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let qa=To();function Po(e,n){const a=la(e);if(!a)return 0;let s;if(!a.maxURL)s=0;else{let r=0;a.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";s=a.maxURL-r-a.path.length-i.length}return s}function Io(e){return e===404}const Oo=(e,n,a)=>{const s=[],r=Po(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return a.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(s.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),s.push(l),s};function zo(e){if(typeof e=="string"){const n=la(e);if(n)return n.path}return"/"}const Bo=(e,n,a)=>{if(!qa){a("abort",424);return}let s=zo(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});s+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;s+=i.slice(0,1)==="/"?i.slice(1):i;break}default:a("abort",400);return}let r=503;qa(e+s).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{a(Io(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?a("abort",i):a("next",r)});return}setTimeout(()=>{a("success",i)})}).catch(()=>{a("next",r)})},Vo={prepare:Oo,send:Bo};function Gs(e,n){e.forEach(a=>{const s=a.loaderCallbacks;s&&(a.loaderCallbacks=s.filter(r=>r.id!==n))})}function Uo(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let a=!1;const s=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:s,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:s,prefix:r,name:u});else return a=!0,!0;return!1}),l.pending.length!==o&&(a||Gs([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Ho=0;function qo(e,n,a){const s=Ho++,r=Gs.bind(null,a,s);if(!n.pending.length)return r;const i={id:s,icons:n,callback:e,abort:r};return a.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function Wo(e){const n={loaded:[],missing:[],pending:[]},a=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 s={provider:"",prefix:"",name:""};return e.forEach(r=>{if(s.name===r.name&&s.prefix===r.prefix&&s.provider===r.provider)return;s=r;const i=r.provider,l=r.prefix,o=r.name,d=a[i]||(a[i]=Object.create(null)),u=d[l]||(d[l]=pt(i,l));let f;o in u.icons?f=n.loaded:l===""||u.missing.has(o)?f=n.missing:f=n.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),n}function Yo(e,n=!0,a=!1){const s=[];return e.forEach(r=>{const i=typeof r=="string"?ln(r,n,a):r;i&&s.push(i)}),s}const Go={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ko(e,n,a,s){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let M=e.resources.slice(0);for(l=[];M.length>1;){const C=Math.floor(Math.random()*M.length);l.push(M[C]),M=M.slice(0,C).concat(M.slice(C+1))}l=l.concat(M)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,h=[],x=[];typeof s=="function"&&x.push(s);function b(){m&&(clearTimeout(m),m=null)}function j(){d==="pending"&&(d="aborted"),b(),h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function g(M,C){C&&(x=[]),typeof M=="function"&&x.push(M)}function w(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:h.length,subscribe:g,abort:j}}function N(){d="failed",x.forEach(M=>{M(void 0,f)})}function S(){h.forEach(M=>{M.status==="pending"&&(M.status="aborted")}),h=[]}function v(M,C,E){const k=C!=="success";switch(h=h.filter(_=>_!==M),d){case"pending":break;case"failed":if(k||!e.dataAfterTimeout)return;break;default:return}if(C==="abort"){f=E,N();return}if(k){f=E,h.length||(l.length?D():N());return}if(b(),S(),!e.random){const _=e.resources.indexOf(M.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",x.forEach(_=>{_(E)})}function D(){if(d!=="pending")return;b();const M=l.shift();if(M===void 0){if(h.length){m=setTimeout(()=>{b(),d==="pending"&&(S(),N())},e.timeout);return}N();return}const C={status:"pending",resource:M,callback:(E,k)=>{v(C,E,k)}};h.push(C),u++,m=setTimeout(D,e.rotate),a(M,n,C.callback)}return setTimeout(D),w}function Ks(e){const n={...Go,...e};let a=[];function s(){a=a.filter(o=>o().status==="pending")}function r(o,d,u){const f=Ko(n,o,d,(m,h)=>{s(),u&&u(m,h)});return a.push(f),f}function i(o){return a.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:s}}function Wa(){}const gn=Object.create(null);function Qo(e){if(!gn[e]){const n=la(e);if(!n)return;const a=Ks(n),s={config:n,redundancy:a};gn[e]=s}return gn[e]}function Zo(e,n,a){let s,r;if(typeof e=="string"){const i=Bn(e);if(!i)return a(void 0,424),Wa;r=i.send;const l=Qo(e);l&&(s=l.redundancy)}else{const i=ra(e);if(i){s=Ks(i);const l=e.resources?e.resources[0]:"",o=Bn(l);o&&(r=o.send)}}return!s||!r?(a(void 0,424),Wa):s.query(n,r,a)().abort}function Ya(){}function Xo(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Uo(e)}))}function Jo(e){const n=[],a=[];return e.forEach(s=>{(s.match(Hs)?n:a).push(s)}),{valid:n,invalid:a}}function jt(e,n,a){function s(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(a&&typeof a=="object")try{if(!Us(e,a).length){s();return}}catch(r){console.error(r)}s(),Xo(e)}function Ga(e,n){e instanceof Promise?e.then(a=>{n(a)}).catch(()=>{n(null)}):n(e)}function ec(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:a,prefix:s}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ga(e.loadIcons(r,s,a),f=>{jt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,s,a);Ga(m,h=>{const x=h?{prefix:s,icons:{[f]:h}}:null;jt(e,[f],x)})});return}const{valid:l,invalid:o}=Jo(r);if(o.length&&jt(e,o,null),!l.length)return;const d=s.match(Hs)?Bn(a):null;if(!d){jt(e,l,null);return}d.prepare(a,s,l).forEach(f=>{Zo(a,f,m=>{jt(e,f.icons,m)})})}))}const tc=(e,n)=>{const a=Yo(e,!0,qs()),s=Wo(a);if(!s.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(s.loaded,s.missing,s.pending,Ya)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return s.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(pt(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),s.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,h=pt(u,f),x=h.pendingIcons||(h.pendingIcons=new Set);x.has(m)||(x.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&ec(d,u)}),n?qo(n,s,i):Ya};function nc(e,n){const a={...e};for(const s in n){const r=n[s],i=typeof r;s in Ws?(r===null||r&&(i==="string"||i==="number"))&&(a[s]=r):i===typeof a[s]&&(a[s]=s==="rotate"?r%4:r)}return a}const ac=/[\s,]+/;function sc(e,n){n.split(ac).forEach(a=>{switch(a.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function rc(e,n=0){const a=e.replace(/^-?[0-9.]*/,"");function s(r){for(;r<0;)r+=4;return r%4}if(a===""){const r=parseInt(e);return isNaN(r)?0:s(r)}else if(a!==e){let r=0;switch(a){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-a.length));return isNaN(i)?0:(i=i/r,i%1===0?s(i):0)}}return n}function ic(e,n){let a=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const s in n)a+=" "+s+'="'+n[s]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+a+">"+e+"</svg>"}function lc(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function oc(e){return"data:image/svg+xml,"+lc(e)}function cc(e){return'url("'+oc(e)+'")'}let $t;function dc(){try{$t=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{$t=null}}function uc(e){return $t===void 0&&dc(),$t?$t.createHTML(e):e}const Qs={...Ys,inline:!1},mc={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},fc={display:"inline-block"},Vn={backgroundColor:"currentColor"},Zs={backgroundColor:"transparent"},Ka={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Qa={WebkitMask:Vn,mask:Vn,background:Zs};for(const e in Qa){const n=Qa[e];for(const a in Ka)n[e+a]=Ka[a]}const xc={...Qs,inline:!0};function Za(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const hc=(e,n,a)=>{const s=n.inline?xc:Qs,r=nc(s,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?mc:{}};if(a){const g=ln(a,!1,!0);if(g){const w=["iconify"],N=["provider","prefix"];for(const S of N)g[S]&&w.push("iconify--"+g[S]);d.className=w.join(" ")}}for(let g in n){const w=n[g];if(w!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[g]=(d[g]?d[g]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[g]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&sc(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[g]=rc(w):typeof w=="number"&&(r[g]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:s[g]===void 0&&(d[g]=w)}}const u=Do(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let g=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:uc(Mo(u.body,w?()=>w+"ID"+g++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:h,height:x}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),j=ic(m,{...f,width:h+"",height:x+""});return d.style={...l,"--svg":cc(j),width:Za(f.width),height:Za(f.height),...fc,...b?Vn:Zs,...o},p.createElement("span",d)};qs(!0);_o("",Vo);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,a="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(s=>{try{(typeof s!="object"||s===null||s instanceof Array||typeof s.icons!="object"||typeof s.prefix!="string"||!wo(s))&&console.error(a)}catch{console.error(a)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let a in n){const s="IconifyProviders["+a+"] is invalid.";try{const r=n[a];if(typeof r!="object"||!r||r.resources===void 0)continue;Ro(a,r)||console.error(s)}catch{console.error(s)}}}}function Xs(e){const[n,a]=p.useState(!!e.ssr),[s,r]=p.useState({});function i(x){if(x){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const j=Ua(b);if(j)return{name:b,data:j}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const x=s.callback;x&&(x(),r({}))}function u(x){if(JSON.stringify(l)!==JSON.stringify(x))return d(),o(x),!0}function f(){var x;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const j=Ua(b);if(u({name:b,data:j}))if(j===void 0){const g=tc([b],f);r({callback:g})}else j&&((x=e.onLoad)===null||x===void 0||x.call(e,b))}p.useEffect(()=>(a(!0),d),[]),p.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:h}=l;return h?hc({...sa,...h},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const I=p.forwardRef((e,n)=>Xs({...e,_ref:n}));p.forwardRef((e,n)=>Xs({inline:!0,...e,_ref:n}));const B=p.forwardRef(({color:e="primary",radius:n="full",testId:a="veevart-button",...s},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":a,...s}));B.displayName="Button";function Js({code:e,amount:n,onRemove:a,label:s="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:s}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(B,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:a,children:t.jsx(I,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function bn(e,n){return e-n*Math.floor(e/n)}const er=1721426;function zt(e,n,a,s){n=oa(e,n);let r=n-1,i=-2;return a<=2?i=0:Gt(n)&&(i=-1),er-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*a-362)/12+i+s)}function Gt(e){return e%4===0&&(e%100!==0||e%400===0)}function oa(e,n){return e==="BC"?1-n:n}function pc(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,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 on{fromJulianDay(n){let a=n,s=a-er,r=Math.floor(s/146097),i=bn(s,146097),l=Math.floor(i/36524),o=bn(i,36524),d=Math.floor(o/1461),u=bn(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[h,x]=pc(m),b=a-zt(h,x,1,1),j=2;a<zt(h,x,3,1)?j=0:Gt(x)&&(j=1);let g=Math.floor(((b+j)*12+373)/367),w=a-zt(h,x,g,1)+1;return new Ft(h,x,g,w)}toJulianDay(n){return zt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return gc[Gt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return Gt(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function bc(e,n){var a,s,r,i;return(i=(r=(a=e.isEqual)===null||a===void 0?void 0:a.call(e,n))!==null&&r!==void 0?r:(s=n.isEqual)===null||s===void 0?void 0:s.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function tr(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function nr(e,n){return Xa(e)-Xa(n)}function Xa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let yn=null;function ar(){return yn==null&&(yn=new Intl.DateTimeFormat().resolvedOptions().timeZone),yn}function Ja(e){e=ca(e,new on);let n=oa(e.era,e.year);return sr(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function sr(e,n,a,s,r,i,l){let o=new Date;return o.setUTCHours(s,r,i,l),o.setUTCFullYear(e,n-1,a),o.getTime()}function es(e,n){if(n==="UTC")return 0;if(e>0&&n===ar())return new Date(e).getTimezoneOffset()*-6e4;let{year:a,month:s,day:r,hour:i,minute:l,second:o}=rr(e,n);return sr(a,s,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const ts=new Map;function rr(e,n){let a=ts.get(n);a||(a=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),ts.set(n,a));let s=a.formatToParts(new Date(e)),r={};for(let i of s)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 ns=864e5;function yc(e,n,a,s){return(a===s?[a]:[a,s]).filter(i=>vc(e,n,i))}function vc(e,n,a){let s=rr(a,n);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function jc(e,n,a="compatible"){let s=lr(e);if(n==="UTC")return Ja(s);if(n===ar()&&a==="compatible"){s=ca(s,new on);let d=new Date,u=oa(s.era,s.year);return d.setFullYear(u,s.month-1,s.day),d.setHours(s.hour,s.minute,s.second,s.millisecond),d.getTime()}let r=Ja(s),i=es(r-ns,n),l=es(r+ns,n),o=yc(s,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(a){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(a){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ir(e,n,a="compatible"){return new Date(jc(e,n,a))}function lr(e,n){let a=0,s=0,r=0,i=0;if("timeZone"in e)({hour:a,minute:s,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:a,minute:s,second:r,millisecond:i}=n),new Xt(e.calendar,e.era,e.year,e.month,e.day,a,s,r,i)}function ca(e,n){if(bc(e.calendar,n))return e;let a=n.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=n,s.era=a.era,s.year=a.year,s.month=a.month,s.day=a.day,gt(s),s}function da(e,n){let a=e.copy(),s="hour"in a?xr(a,n):0;Un(a,n.years||0),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e),a.month+=n.months||0,Hn(a),or(a),a.day+=(n.weeks||0)*7,a.day+=n.days||0,a.day+=s,wc(a),a.calendar.balanceDate&&a.calendar.balanceDate(a),a.year<1&&(a.year=1,a.month=1,a.day=1);let r=a.calendar.getYearsInEra(a);if(a.year>r){var i,l;let d=(i=(l=a.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,a);a.year=r,a.month=d?1:a.calendar.getMonthsInYear(a),a.day=d?1:a.calendar.getDaysInMonth(a)}a.month<1&&(a.month=1,a.day=1);let o=a.calendar.getMonthsInYear(a);return a.month>o&&(a.month=o,a.day=a.calendar.getDaysInMonth(a)),a.day=Math.max(1,Math.min(a.calendar.getDaysInMonth(a),a.day)),a}function Un(e,n){var a,s;!((a=(s=e.calendar).isInverseEra)===null||a===void 0)&&a.call(s,e)&&(n=-n),e.year+=n}function Hn(e){for(;e.month<1;)Un(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,Un(e,1)}function wc(e){for(;e.day<1;)e.month--,Hn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Hn(e)}function or(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 gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),or(e)}function cr(e){let n={};for(let a in e)typeof e[a]=="number"&&(n[a]=-e[a]);return n}function dr(e,n){return da(e,cr(n))}function ur(e,n){let a=e.copy();return n.era!=null&&(a.era=n.era),n.year!=null&&(a.year=n.year),n.month!=null&&(a.month=n.month),n.day!=null&&(a.day=n.day),gt(a),a}function mr(e,n){let a=e.copy();return n.hour!=null&&(a.hour=n.hour),n.minute!=null&&(a.minute=n.minute),n.second!=null&&(a.second=n.second),n.millisecond!=null&&(a.millisecond=n.millisecond),fr(a),a}function Nc(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Bt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Bt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Bt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=Bt(e.hour,24),n}function fr(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function Bt(e,n){let a=e%n;return a<0&&(a+=n),a}function xr(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,Nc(e)}function hr(e,n){let a=e.copy();return xr(a,n),a}function Cc(e,n){return hr(e,cr(n))}function pr(e,n,a,s){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=st(d,a,0,o.length-1,s?.round),r.era=o[d],gt(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(a=-a),r.year=st(e.year,a,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=st(e.month,a,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=st(e.day,a,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),gt(r),r}function gr(e,n,a,s){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(s?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=st(i,a,l,o,s?.round);break}case"minute":r.minute=st(e.minute,a,0,59,s?.round);break;case"second":r.second=st(e.second,a,0,59,s?.round);break;case"millisecond":r.millisecond=st(e.millisecond,a,0,999,s?.round);break;default:throw new Error("Unsupported field "+n)}return r}function st(e,n,a,s,r=!1){if(r){e+=Math.sign(n),e<a&&(e=s);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>s&&(e=a)}else e+=n,e<a?e=s-(a-e-1):e>s&&(e=a+(e-s-1));return e}const kc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Sc=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function $c(e){let n=e.match(kc);if(!n)throw Sc.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let a=new Ft(vn(n[1],0,9999),vn(n[2],1,12),1);return a.day=vn(n[3],1,a.calendar.getDaysInMonth(a)),a}function vn(e,n,a){let s=Number(e);if(s<n||s>a)throw new RangeError(`Value out of range: ${n} <= ${s} <= ${a}`);return s}function br(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 yr(e){let n=ca(e,new on),a;return n.era==="BC"?a=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):a=String(n.year).padStart(4,"0"),`${a}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function Ac(e){return`${yr(e)}T${br(e)}`}function Dc(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ua(e,n,a){Dc(e,n),n.set(e,a)}function vr(e){let n=typeof e[0]=="object"?e.shift():new on,a;if(typeof e[0]=="string")a=e.shift();else{let l=n.getEras();a=l[l.length-1]}let s=e.shift(),r=e.shift(),i=e.shift();return[n,a,s,r,i]}var Ec=new WeakMap;class Ft{copy(){return this.era?new Ft(this.calendar,this.era,this.year,this.month,this.day):new Ft(this.calendar,this.year,this.month,this.day)}add(n){return da(this,n)}subtract(n){return dr(this,n)}set(n){return ur(this,n)}cycle(n,a,s){return pr(this,n,a,s)}toDate(n){return ir(this,n)}toString(){return yr(this)}compare(n){return tr(this,n)}constructor(...n){ua(this,Ec,{writable:!0,value:void 0});let[a,s,r,i,l]=vr(n);this.calendar=a,this.era=s,this.year=r,this.month=i,this.day=l,gt(this)}}var Fc=new WeakMap;class cn{copy(){return new cn(this.hour,this.minute,this.second,this.millisecond)}add(n){return hr(this,n)}subtract(n){return Cc(this,n)}set(n){return mr(this,n)}cycle(n,a,s){return gr(this,n,a,s)}toString(){return br(this)}compare(n){return nr(this,n)}constructor(n=0,a=0,s=0,r=0){ua(this,Fc,{writable:!0,value:void 0}),this.hour=n,this.minute=a,this.second=s,this.millisecond=r,fr(this)}}var Lc=new WeakMap;class Xt{copy(){return this.era?new Xt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Xt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return da(this,n)}subtract(n){return dr(this,n)}set(n){return ur(mr(this,n),n)}cycle(n,a,s){switch(n){case"era":case"year":case"month":case"day":return pr(this,n,a,s);default:return gr(this,n,a,s)}}toDate(n,a){return ir(this,n,a)}toString(){return Ac(this)}compare(n){let a=tr(this,n);return a===0?nr(this,lr(n)):a}constructor(...n){ua(this,Lc,{writable:!0,value:void 0});let[a,s,r,i,l]=vr(n);this.calendar=a,this.era=s,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,gt(this)}}const Mc="Open time options",_c=320;function as(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function jn(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,a="minute"in e&&typeof e.minute=="number"?e.minute:0,s="second"in e&&typeof e.second=="number"?e.second:0;return new cn(n,a,s)}function Rc(e,n){const a=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(a)}function Tc(e){const n=[];for(let a=0;a<24;a+=1)for(let s=0;s<60;s+=e)n.push(new cn(a,s));return n}function Pc(e){const{minuteStep:n=15,timeListClassName:a,timeListLabel:s=Mc,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[h,x]=p.useState(()=>jn(d)),b=m?jn(o):h,j=p.useMemo(()=>Tc(n),[n]),g=N=>{m||x(N),l?.(N)},w=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":s,...r,onPress:void 0,children:t.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:a??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(N=>{const S=b?.hour===N.hour&&b?.minute===N.minute;return t.jsx(c.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(N),children:Rc(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>g(jn(N))})}function ma(e){if(e.mode==="time")return t.jsx(Pc,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=_c,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:as("min-w-[20rem]",u?.popoverContent),calendarContent:as("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:a="day",...s}=e;return t.jsx(c.DatePicker,{...s,granularity:a})}function Ic(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const He=p.forwardRef(({popoverProps:e,...n},a)=>{const s=p.useRef(null),[r,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(Ic(s.current))},[]),t.jsx("span",{ref:s,className:"contents",children:t.jsx(c.Select,{ref:a,...n,popoverProps:l})})});He.displayName="Select";function Oc({state:e,onSubmit:n,onRemove:a,appliedCredit:s,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),h=p.useId(),[x,b]=p.useState(e);e!==x&&(b(e),e==="applied"&&m(""));const j=()=>{const N=f.trim();N&&n(N)},g=N=>{N.key==="Enter"&&(N.preventDefault(),j())};if(e==="applied"&&s)return t.jsx("div",{"data-testid":u,children:t.jsx(Js,{code:s.code,amount:s.amount,onRemove:a,removeAriaLabel:d,testId:`${u}-card`})});const w=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?h:void 0}),t.jsx(B,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:o})]}),w&&t.jsx("p",{id:h,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const zc={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Bc({languages:e,selectedLanguage:n,onLanguageChange:a,label:s}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(He,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":s,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;a?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:s,startContent:t.jsx(K.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||s}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(He,{"aria-label":s,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;a?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(K.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 Vc({isLoggedIn:e,onLogin:n,onLogout:a,labels:s}){return e?t.jsxs(B,{"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:a,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:s.logout})]}):t.jsxs(B,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:s.login})]})}function Uc({logo:e,languages:n=[],selectedLanguage:a,onLanguageChange:s,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...zc,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||n.length>0)&&t.jsx(Bc,{languages:n,selectedLanguage:a,onLanguageChange:s,label:m.selectLanguage}),d&&t.jsx(Vc,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Hc(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 wn;const qc=typeof document<"u"?(wn=p.useInsertionEffect)!==null&&wn!==void 0?wn:p.useLayoutEffect:()=>{};function dn(e,n,a){let[s,r]=p.useState(e||n),i=p.useRef(s),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:s;qc(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...h)=>{let x=typeof m=="function"?m(i.current):m;Object.is(i.current,x)||(i.current=x,r(x),u(),a?.(x,...h))},[a]);return[d,f]}function jr(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(De.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 wr=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:a=3,defaultStep:s=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:h,currentStep:x,hideProgressBars:b=!1,stepClassName:j,className:g,isDisabled:w=!1,...N},S)=>{const[v,D]=dn(x,s,h),M=p.useMemo(()=>{let C,E;const k=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":C="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":C="[--step-color:var(--heroui-secondary)]",E="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":C="[--step-color:var(--heroui-success)]",E="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":C="[--step-color:var(--heroui-warning)]",E="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":C="[--step-color:var(--heroui-danger)]",E="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":C="[--step-color:var(--heroui-default)]",E="[--step-fg-color:var(--heroui-default-foreground)]";break;default:C="[--step-color:var(--heroui-primary)]",E="[--step-fg-color:var(--heroui-primary-foreground)]";break}return k.unshift(E),k.unshift(C),k},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):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",M,g),"data-testid":"stepper-list",children:Array.from({length:a})?.map((C,E)=>{const k=v===E?"active":v<E?"inactive":"complete",_=n==="activeLabel"&&k==="active"&&!!i?.[E],A=l&&k!=="active"&&!!i?.[E];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${E}`,children:[t.jsx(c.Tooltip,{content:A?i?.[E]:void 0,isDisabled:!A,offset:12,placement:o,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":k==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&D(E),disabled:w,"data-testid":`stepper-step-btn-${E}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:k,className:"relative z-10",children:t.jsx(De.m.div,{animate:k,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":k==="complete","shadow-lg":k==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:k==="complete"&&n==="default"?t.jsx(jr,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${E}`}):t.jsx("span",{children:E+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${E}`,children:i[E]}):null]},E)}),E<a-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":E},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":E<v})})})]},E)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,a):`Step ${v+1} of ${a}`}):null]})});wr.displayName="Stepper";function Wc(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 be(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a}).format(e)}catch{return`${a} ${e.toFixed(2)}`}}function Mt(e,n="en-US"){try{const a=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof a.maximumFractionDigits=="number"?a.maximumFractionDigits:2}catch{return 2}}function Nr(e,n,a="en-US"){const s=Mt(n,a),r=Math.pow(10,s);return Math.round(e*r)/r}function qn(e,n,a,s){return Nr(e-n,a,s)}const ss={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)",Gc="rgb(107 114 128)",Cr=p.forwardRef(function({color:n="primary",steps:a=[],defaultStep:s=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Yc,inactiveLabelColor:f=Gc,activeStepVariant:m="bordered",stepClassName:h,circleClassName:x,progressBarClassName:b,labelsClassName:j,labelSlotClassName:g,activeLabelClassName:w,inactiveLabelClassName:N,className:S,ariaLabel:v="Progress",invalidLabelSuffix:D=", has errors",testId:M,isStepReachable:C,...E},k){const[_,A]=dn(i,s,r),F=ss[n]??ss.primary,R=o??F.active,P=d??F.fg,q=(z,V)=>{const W=z.ariaLabel??(typeof z.title=="string"?z.title:null)??`${V+1}`;return z.invalid?`${W}${D}`:W};return t.jsxs("nav",{...E,"aria-label":v,...M?{"data-testid":M}:{},children:[t.jsx("div",{className:c.cn("flex items-center",S),children:a?.map((z,V)=>{const X=V===_?"active":V<_?"complete":"inactive",W=C?C(V):!0;return t.jsxs(p.Fragment,{children:[t.jsx(B,{ref:k,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${M??"horizontal-steps"}-step-${V}`,"aria-current":X==="active"?"step":void 0,"aria-describedby":z.describedBy,"aria-label":q(z,V),"data-invalid":z.invalid?"true":void 0,isDisabled:!W,className:c.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",z.className,h),onPress:()=>{if(i===void 0){A(V);return}r?.(V)},children:t.jsx(De.LazyMotion,{features:De.domAnimation,children:t.jsx(De.m.div,{animate:X,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",x),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?R:"transparent",borderColor:R,borderWidth:"1.5px",color:m==="solid"?P:R},complete:{backgroundColor:R,borderColor:R,borderWidth:"1.5px",color:R}},children:X==="complete"?t.jsx(jr,{className:"size-4",style:{color:P}}):t.jsx("span",{children:V+1})})})}),V<a.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:V<_?R:u}})]},V)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",j),children:a?.map((z,V)=>{const X=V<=_;return t.jsxs(p.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",X?w:N),style:{color:X?R:f},children:z.title})}),V<a.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},V)})})]})});Cr.displayName="HorizontalSteps";function Kc(){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 Qc=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Zc,{...e},n)},Zc=({allItems:e,selected:n,onSelectedChange:a,titleLeft:s,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,h]=p.useState(null),x=p.useMemo(()=>new Set(n),[n]),b=p.useMemo(()=>new Set(e),[e]),j=p.useMemo(()=>e.filter(A=>!x.has(A)),[e,x]),g=A=>{if(A.length===0)return;const F=Array.from(new Set([...n,...A]));a(F)},w=A=>{if(A.length===0)return;const F=new Set(A);a(n.filter(R=>!F.has(R)))},N=()=>{i.length!==0&&(g(i),l([]))},S=()=>{o.length!==0&&(w(o),d([]))},v=()=>{j.length!==0&&(g(j),l([]))},D=()=>{n.length!==0&&(a([]),d([]))},M=(A,F,R)=>{const P=Math.min(F,R),q=Math.max(F,R);return A.slice(P,q+1)},C=(A,F,R)=>{if(R&&u!==null){l(M(j,u,F)),d([]),f(F);return}const P=i.includes(A);l(P?i.filter(q=>q!==A):[...i,A]),d([]),f(F)},E=(A,F,R)=>{if(R&&m!==null){d(M(n,m,F)),l([]),h(F);return}const P=o.includes(A);d(P?o.filter(q=>q!==A):[...o,A]),l([]),h(F)},k=(A,F,R)=>{const P=R==="available"?i.includes(F)?i:[F]:o.includes(F)?o:[F];A.dataTransfer.setData("text/plain",JSON.stringify({source:R,items:P})),A.dataTransfer.effectAllowed="move"},_=(A,F)=>{A.preventDefault();const R=A.dataTransfer.getData("text/plain");if(R)try{const P=JSON.parse(R),q=(P.items||[]).filter(z=>b.has(z));if(q.length===0||P.source===F)return;F==="selected"?(g(q),l([])):(w(q),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:s}),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:A=>A.preventDefault(),onDrop:A=>_(A,"available"),children:j.map((A,F)=>{const R=i.includes(A);return t.jsx("button",{type:"button",onClick:P=>{C(A,F,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>k(P,A,"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:A},A)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(B,{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:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:v,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:D,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:A=>A.preventDefault(),onDrop:A=>_(A,"selected"),children:n.map((A,F)=>{const R=o.includes(A);return t.jsx("button",{type:"button",onClick:P=>{E(A,F,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>k(P,A,"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:A},A)})})})]})]})};function Lt(e){return typeof e=="string"?e:e.type}function it({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function lt({icon:e,label:n,isActive:a=!1,isDisabled:s=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:a?"primary":"default",variant:a?"solid":"bordered",isIconOnly:!0,isDisabled:s,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const Xe={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const a=n?.type==="textColor"?n.color:"";a?e.chain().focus().setColor(a).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const a=n?.type==="highlight"?n.color:"";a?e.chain().focus().setHighlight({color:a}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const a=n?.type==="link"?n.href:"";if(a){const s=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:a,target:s,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const a=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:a}).run()},canExecute:(e,n)=>{const a=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:a}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const a=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(a).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Xc={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Jc({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:a=!1}){const[,s]=p.useState(0);p.useEffect(()=>{const l=()=>s(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Xe.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,startContent:t.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(K.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Xc[l]},l))})]})}const Nn={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function ed({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:a=!1}){const[,s]=p.useState(0);p.useEffect(()=>{const o=()=>s(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Nn[r].icon:K.List,l=o=>{const u=Xe[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:a,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:n.map(o=>{const d=Nn[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Nn[o].label},o)})})]})}function td({colors:e,selectedColor:n,onColorSelect:a,columns:s=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${s}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>a(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 nd=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],ad=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Cn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Ce={min:50,max:200,step:10,default:100},rs={lineHeight:24,toolbarHeight:60},sd={bold:G.Bold,italic:G.Italic,strike:G.Strikethrough,underline:G.Underline,code:G.Code,textColor:G.Palette,highlight:G.Highlighter,link:G.Link2,paragraph:G.FileText,heading:G.Heading,bulletList:G.List,orderedList:G.ListOrdered,taskList:G.ListTodo,codeBlock:G.CodeSquare,blockquote:G.Quote,horizontalRule:G.Minus,clearMarks:G.Eraser,clearNodes:G.Eraser,undo:G.Undo2,redo:G.Redo2,hardBreak:G.CornerDownLeft,textAlign:G.AlignLeft},rd={left:G.AlignLeft,center:G.AlignCenter,right:G.AlignRight,justify:G.AlignJustify};function xt(e){return sd[e]}function id({value:e,onChange:n,onApply:a,placeholder:s="#000000"}){const[r,i]=p.useState(""),l=u=>{const f=u.target.value;n(f),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Cn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),a(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:s,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:Cn(e)?e:"transparent"}})}),t.jsx(V,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Cn(e),children:t.jsx(G.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function is({editor:e,type:n,allowCustomColor:a=!0,label:s,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=n==="textColor"?nd:ad,f=j=>{const g=Ze[n];g&&g.execute({editor:e,config:{type:n,color:j}}),l(!1),d("")},m=j=>{f(j)},h=()=>{const j=Ze[n];j&&j.execute({editor:e,config:{type:n,color:""}}),l(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=n==="textColor"?G.Palette:G.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(V,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":s,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:s}),t.jsx(V,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:t.jsx(G.X,{size:16})})]}),t.jsx(td,{colors:u,onColorSelect:f}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(id,{value:o,onChange:d,onApply:m})]})]})]})})]})}function ld({zoom:e,onZoomChange:n,min:a=Ce.min,max:s=Ce.max,step:r=Ce.step}){const i=()=>{const m=Math.max(a,e-r);n(m)},l=()=>{const m=Math.min(s,e+r);n(m)},o=()=>{n(Ce.default)},d=e<=a,u=e>=s,f=e===Ce.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(V,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(G.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const nd=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],ad=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Cn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Ce={min:50,max:200,step:10,default:100},rs={lineHeight:24,toolbarHeight:60},sd={bold:K.Bold,italic:K.Italic,strike:K.Strikethrough,underline:K.Underline,code:K.Code,textColor:K.Palette,highlight:K.Highlighter,link:K.Link2,paragraph:K.FileText,heading:K.Heading,bulletList:K.List,orderedList:K.ListOrdered,taskList:K.ListTodo,codeBlock:K.CodeSquare,blockquote:K.Quote,horizontalRule:K.Minus,clearMarks:K.Eraser,clearNodes:K.Eraser,undo:K.Undo2,redo:K.Redo2,hardBreak:K.CornerDownLeft,textAlign:K.AlignLeft},rd={left:K.AlignLeft,center:K.AlignCenter,right:K.AlignRight,justify:K.AlignJustify};function xt(e){return sd[e]}function id({value:e,onChange:n,onApply:a,placeholder:s="#000000"}){const[r,i]=p.useState(""),l=u=>{const f=u.target.value;n(f),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Cn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),a(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:s,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:Cn(e)?e:"transparent"}})}),t.jsx(B,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Cn(e),children:t.jsx(K.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function is({editor:e,type:n,allowCustomColor:a=!0,label:s,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=n==="textColor"?nd:ad,f=j=>{const g=Xe[n];g&&g.execute({editor:e,config:{type:n,color:j}}),l(!1),d("")},m=j=>{f(j)},h=()=>{const j=Xe[n];j&&j.execute({editor:e,config:{type:n,color:""}}),l(!1)},x=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=n==="textColor"?K.Palette:K.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":s,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:s}),t.jsx(B,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:t.jsx(K.X,{size:16})})]}),t.jsx(td,{colors:u,onColorSelect:f}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(id,{value:o,onChange:d,onApply:m})]})]})]})})]})}function ld({zoom:e,onZoomChange:n,min:a=Ce.min,max:s=Ce.max,step:r=Ce.step}){const i=()=>{const m=Math.max(a,e-r);n(m)},l=()=>{const m=Math.min(s,e+r);n(m)},o=()=>{n(Ce.default)},d=e<=a,u=e>=s,f=e===Ce.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(K.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
15
  ${f?"cursor-default":"cursor-pointer hover:text-primary"}
16
- `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(V,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(G.ZoomIn,{size:16})})})]})}function od({editor:e,isDisabled:n=!1}){const[a,s]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:b,to:j}=e.state.selection,g=e.isActive("link");let w="";if(g){const S=e.schema.marks.link,v=e.state.doc.resolve(b),D=Oa.getMarkRange(v,S);D&&(w=e.state.doc.textBetween(D.from,D.to,""))}else w=e.state.doc.textBetween(b,j,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(g)}s(x)},h=()=>{if(l.trim()){const{from:x,to:b}=e.state.selection,j=e.schema.marks.link,g=e.state.doc.resolve(x),w=Oa.getMarkRange(g,j),N=w?.from??x,S=w?.to??b,v=e.state.doc.textBetween(N,S,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:S}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}s(!1)};return t.jsxs(c.Popover,{isOpen:a,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(V,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(G.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:x=>o(x.target.value),onKeyDown:x=>x.key==="Enter"&&h(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(V,{size:"sm",color:"primary",onPress:h,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function cd({children:e,id:n,label:a,className:s,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":a,className:s,children:e}):t.jsx("div",{id:n,role:"group","aria-label":a,className:`flex items-center gap-2 ${s||""}`,children:e})}function kr(e,n){const a=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>Lt(o)))).forEach(o=>{const d=Ze[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[s,r]=p.useState(a);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>Lt(d)))).forEach(d=>{const u=Ze[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,a]),s}function Sr(e,n){const a=p.useCallback((l,o)=>{if(!e)return;const d=Ze[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),s=p.useCallback(l=>{a(l)},[a]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Ze[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=p.useCallback((l,o)=>{if(!e)return!1;const d=Ze[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:a,toggleModifier:s,canExecute:r,isActive:i}}function dd(e=Ce.default){const[n,a]=p.useState(e),s=p.useCallback((o=Ce.step)=>{a(d=>Math.min(Ce.max,d+o))},[]),r=p.useCallback((o=Ce.step)=>{a(d=>Math.max(Ce.min,d-o))},[]),i=p.useCallback(()=>{a(Ce.default)},[]),l=p.useCallback(o=>{const d=Math.max(Ce.min,Math.min(Ce.max,o));a(d)},[]);return{zoom:n,setZoom:l,zoomIn:s,zoomOut:r,resetZoom:i,isMinZoom:n<=Ce.min,isMaxZoom:n>=Ce.max,isDefaultZoom:n===Ce.default}}const ud=["bold","italic","strike","underline","code"];function md({editor:e,modifiers:n,onToolbarAction:a}){const s=kr(e,n),{toggleModifier:r}=Sr(e,a);if(!e)return null;const i=n.map(l=>Lt(l)).filter(l=>ud.includes(l));return i.length===0?null:t.jsx(cd,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=s[l],d=xt(l);return t.jsx(lt,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function fd({editor:e,modifiers:n,zoom:a=100,onZoomChange:s,sticky:r=!0,className:i,onToolbarAction:l}){const o=kr(e,n),{toggleModifier:d,executeCommand:u}=Sr(e,l);if(!e)return null;const f=n.map(k=>Lt(k)),m=f.some(k=>["bold","italic","strike","underline","code"].includes(k)),h=f.some(k=>["textColor","highlight"].includes(k)),x=f.includes("heading"),b=f.includes("textAlign"),j=f.some(k=>["bulletList","orderedList","taskList"].includes(k)),g=f.includes("blockquote"),w=f.includes("codeBlock"),N=f.includes("link"),S=f.includes("horizontalRule"),v=f.some(k=>["undo","redo"].includes(k)),D=a!==void 0&&s!==void 0,M=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${M} ${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(md,{editor:e,modifiers:n,onToolbarAction:l}),(h||x||b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(is,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(is,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(x||b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(Jc,{editor:e}),(b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(k=>{const E=rd[k],C=e.isActive({textAlign:k});return t.jsx(lt,{icon:E,label:`Align ${k}`,isActive:C,onClick:()=>u("textAlign",{type:"textAlign",alignment:k})},k)})}),(j||g||w||N||S||v||D)&&t.jsx(it,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(ed,{editor:e,types:f.filter(k=>["bulletList","orderedList","taskList"].includes(k))}),(g||w||N||S||v||D)&&t.jsx(it,{})]}),(g||w||N||S)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(lt,{icon:xt("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(lt,{icon:xt("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(od,{editor:e,isDisabled:o.link?.isDisabled}),S&&t.jsx(lt,{icon:xt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||D)&&t.jsx(it,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(lt,{icon:xt("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(lt,{icon:xt("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),D&&t.jsx(it,{})]}),D&&t.jsx(ld,{zoom:a,onZoomChange:k=>{s?.(k),l?.({type:"zoom",modifier:`${k}%`})}})]})})}const wt={bold:{category:"mark",extension:Ol.Bold,priority:100},italic:{category:"mark",extension:zl.Italic,priority:100},strike:{category:"mark",extension:Bl.Strike,priority:100},underline:{category:"mark",extension:Vl.Underline,priority:100},code:{category:"mark",extension:Ul.Code,priority:100},textColor:{category:"mark",extension:Hl.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:ql.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Wl.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Gl.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ql.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Zl.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Xl.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:to.CodeBlock,priority:100},blockquote:{category:"node",extension:no.Blockquote,priority:100},horizontalRule:{category:"node",extension:ao.HorizontalRule,priority:100},hardBreak:{category:"node",extension:so.HardBreak,priority:100},undo:{category:"extension",extension:za.History,priority:50},redo:{category:"extension",extension:za.History,priority:50},textAlign:{category:"extension",extension:ro.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}},xd=[io.Document,lo.Text,Kl.Paragraph,Yl.TextStyle.configure({HTMLAttributes:{}}),eo.ListItem.configure({HTMLAttributes:{}}),Jl.TaskItem.configure({nested:!0}),oo.Dropcursor,co.Gapcursor];function hd(e){const n=[],a=new Set,s=new Set;xd.forEach(o=>{o&&(n.push(o),s.add(o.name))});const r=e.map(o=>Lt(o)),i=new Set;return r.forEach(o=>{const d=wt[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(a.has(o))return;const d=wt[o];if(!d||d.extension===null)return;const u=d.extension.name;if(s.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),a.add(o),s.add(u)}),r.forEach(o=>{if(a.has(o))return;const d=wt[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){a.add(o);return}const u=d.extension.name;if(s.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),a.add(o),s.add(u)}),n.sort((o,d)=>{const u=Object.values(wt).find(x=>x?.extension?.name===o.name),f=Object.values(wt).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const $r={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"]},pd={h1:`font-size: ${fe.fontSize["4xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h2:`font-size: ${fe.fontSize["2xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h3:`font-size: ${fe.fontSize.xl}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h4:`font-size: ${fe.fontSize.lg}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h5:`font-size: ${fe.fontSize.base}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h6:`font-size: ${fe.fontSize.sm}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,p:`min-height: ${fe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${de.xl}; margin: ${de.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${de.xl}; margin: ${de.md} 0;`,li:`display: list-item; margin: ${de.xs} 0;`,strong:`font-weight: ${fe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${we.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${fe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${fe.fontFamily.mono};`,pre:`background: ${we.neutral.gray[800]}; border-radius: ${de.sm}; color: ${we.neutral.gray[100]}; font-family: ${fe.fontFamily.mono}; margin: ${de.lg} 0; padding: 0.75rem ${de.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${we.neutral.gray[300]}; margin: ${de.lg} 0; padding-left: ${de.md}; color: ${we.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${we.neutral.gray[200]}; margin: ${de.xl} 0;`,a:`color: ${we.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${we.palettes.warning[200]}; border-radius: ${de.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${de.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},gd={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 bd(e){if(!e)return e;let n=e;for(const[a,s]of Object.entries(gd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${a}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${s}"`):`${l} style="${s}">`)}for(const[a,s]of Object.entries(pd)){const r=new RegExp(`<${a}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${s}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${s}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${s}"${i.slice(l)}`}})}return n}const yd=({modifiers:e,zoom:n,onZoomChange:a,onToolbarAction:s})=>{const{editor:r}=na.useCurrentEditor();return t.jsx(fd,{editor:r,modifiers:e,zoom:n,onZoomChange:a,onToolbarAction:s})},vd=({showCharacterCount:e,showWordCount:n})=>{const{editor:a}=na.useCurrentEditor();if(!a||!e&&!n)return null;const s=a.getText(),r=s.length,i=s.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},Wn=p.forwardRef((e,n)=>{const{minRows:a=10,maxRows:s=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=$r.full,variant:u="bordered",initialContent:f,content:m,onContentChange:h,onUpdate:x,onToolbarAction:b,isReadOnly:j=!1,isDisabled:g=!1,includeInlineStyles:w=!0,...N}=e,{zoom:S,setZoom:v}=dd(),D=rs.lineHeight,M=a*D,k=r?void 0:s*D,E=p.useMemo(()=>hd(d),[d]),{Component:C,label:R,shouldLabelBeOutside:A,getBaseProps:F,getLabelProps:_,getInputWrapperProps:T}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),q=R?t.jsx("label",{..._(),children:R}):null,B=p.useCallback(({editor:U})=>{const K=U.getHTML(),Q=w?bd(K):K,le=U.getJSON(),W=U.getText(),X=W.length,Z=W.split(/\s+/).filter(ae=>ae.length>0).length,ee={html:Q,json:le,text:W,characters:X,words:Z};if(h?.(ee),x?.(ee),"onChange"in N&&typeof N.onChange=="function"){const ae={target:{value:Q},currentTarget:{value:Q}};N.onChange(ae)}},[h,x,N,w]);return t.jsxs(C,{...F(),children:[A?q:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:k?`${k+rs.toolbarHeight}px`:void 0,overflow:k?"auto":void 0},children:t.jsx(na.EditorProvider,{editable:!j&&!g,slotBefore:o?t.jsx(yd,{modifiers:d,zoom:S,onZoomChange:v,onToolbarAction:b}):void 0,slotAfter:t.jsx(vd,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${M}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:E,content:m||f||e.defaultValue||"",onUpdate:B})})]})});Wn.displayName="TipTapEditor";const Ar=p.forwardRef((e,n)=>{const{adapter:a="tiptap",variant:s="bordered",...r}=e;return a==="tiptap"?t.jsx(Wn,{...r,variant:s,ref:n}):(console.warn(`Adapter "${a}" is not supported. Using TipTap.`),t.jsx(Wn,{...r,variant:s,ref:n}))});Ar.displayName="RichTextArea";function jd(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}const ls=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],wd={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Dr=({presetAmounts:e=ls,selectedDonation:n,defaultSelectedDonation:a=null,onChange:s,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:h=3,isDisabled:x=!1,buttonVariant:b="bordered",buttonColor:j="default",inputVariant:g="bordered",size:w="md",className:N="",showCard:S=!0})=>{const v={...wd,...f},D=Array.isArray(e)?e:ls,M={2:"grid-cols-2",3:"grid-cols-3"},k={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},E=`${M[m]} ${k[h]}`,[C,R]=dn(n,a,s),[A,F]=p.useState(""),[_,T]=p.useState(!1),[q,B]=p.useState(0),U=p.useCallback(X=>{if(x)return;const Z={amount:X.amount,isCustom:!1,presetId:X.id};R(Z),F(""),T(!1),B(ee=>ee+1),r?.(Z)},[x,R,r]),K=p.useCallback(X=>{if(x)return;if(F(X!==void 0?String(X):""),r){R(null);return}if(X===void 0||isNaN(X)){R(null);return}R({amount:X,isCustom:!0})},[x,R,r]),Q=p.useCallback(()=>{if(x)return;const X=A!==""?parseFloat(A):void 0;X===void 0||isNaN(X)||r?.({amount:X,isCustom:!0})},[x,A,r]),le=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),W=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[v.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:v.title}),D.length>0&&t.jsx("div",{className:c.cn("grid gap-3",E),"data-testid":"donation-amounts-presets",children:D.map(X=>{const Z=C!==null&&!C.isCustom&&C.presetId===X.id;return t.jsx(V,{color:Z?"primary":j,variant:Z?"solid":b,className:"w-full",onPress:()=>U(X),isDisabled:x,"data-testid":`donation-amounts-preset-${X.id}`,children:X.label||jd(X.amount,l,i)},X.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{R(null),T(!0)}:void 0,variant:g,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:le,value:A!==""?parseFloat(A):void 0,onValueChange:K,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${q}`:C?.isCustom===!1?C.presetId:"custom"),r&&t.jsx(V,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:Q,isDisabled:x||!_,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return S?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:W})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:W})};Dr.displayName="DonationAmounts";const Nd=e=>{const n=Math.max(0,e),a=Math.floor(n/60).toString().padStart(2,"0"),s=(n%60).toString().padStart(2,"0");return`${a}:${s} minutes`},Cd=e=>{switch(e){case"warning":return G.Clock;case"error":return G.AlertCircle;case"success":return G.CheckCircle;default:return G.Clock}},kd=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"}},Er=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:a,onExpire:s,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Nd,className:h,...x},b)=>{const[j,g]=dn(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),a),w=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),p.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{g(M=>M<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,s?.()),0):M-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,g,s]),p.useEffect(()=>{j>0&&(N.current=!1)},[j]);const S=d||Cd(r),v=kd(i),D={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${l} ${m(j)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,D[u],h),...x,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[o&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(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:l})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(j)}`,"data-testid":"expire-cart-timer-value",children:m(j)})})]})})})});Er.displayName="ExpireCartTimer";const kn=({icon:e,children:n,testId:a})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":a,children:[t.jsx(I,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),Sd=({classes:e="",name:n,imageUrl:a,eventDate:s,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[h,x]=p.useState(!1),[b,j]=p.useState(!1),g=p.useRef(null);return p.useEffect(()=>{const w=()=>{if(g.current){const N=g.current.scrollHeight>g.current.clientHeight;j(N)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[l]),t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&a&&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:u,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[s&&t.jsx(kn,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:s}),r&&t.jsx(kn,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kn,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:g,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!h&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!h&&b&&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"})]}),(b||h)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(V,{onPress:()=>x(!h),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:t.jsx(I,{icon:h?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:h?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function Yn(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}function $d(e){const n=e.replace(/[^\d.,-]/g,""),a=n.match(/,\d{1,2}$/);let s;a?s=n.replace(/\./g,"").replace(",","."):s=n.replace(/,/g,"");const r=parseFloat(s);return isNaN(r)?null:r}const Ad={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"},mt=e=>typeof e=="number"&&!isNaN(e),Jt=({offer:e,quantity:n,defaultQuantity:a=0,onQuantityChange:s,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:h=!0,showPeopleCount:x=!0,showPrice:b=!0,priceDisplay:j,classNames:g={},"data-testid":w,selectedColor:N="default",compact:S=!1,isSoldOut:v,isMaxReached:D,isRuleBlocked:M,statusTone:k="default",statusLabel:E,disabledReason:C,disabled:R})=>{const A=p.useMemo(()=>({...Ad,...l}),[l]),[F,_]=p.useState(a),T=n!==void 0?n:F,q=!!(d||R),B=S||!!e.compact,U=p.useMemo(()=>typeof v=="boolean"?v:typeof e.isSoldOut=="boolean"?e.isSoldOut:!mt(e.totalTicketsSold)||!mt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[v,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),K=p.useMemo(()=>typeof D=="boolean"?D:typeof e.isMaxReached=="boolean"?e.isMaxReached:U||!mt(e.ticketsAllowed)?!1:T>=e.ticketsAllowed-(e.totalTicketsSold??0),[D,e.isMaxReached,U,e.ticketsAllowed,e.totalTicketsSold,T]),Q=p.useMemo(()=>typeof M=="boolean"?M:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[M,e.isRuleBlocked]),le=C||e.disabledReason,W=q||U||Q,X=ne=>{if(W||ne>0&&K)return;const ye=Math.max(0,T+ne);n===void 0&&_(ye),s?.(e.id,ye)},Z=p.useMemo(()=>{if(U)return"soldOut";if(Q)return"ruleBlocked";if(q)return"disabled"},[U,Q,q]),ee=p.useMemo(()=>k||(U||Q?"danger":K?"warning":"default"),[k,U,Q,K]),ae=p.useMemo(()=>{if(Z)return Z==="ruleBlocked"?E||le||A.ruleBlocked:Z==="soldOut"?E||le||A.soldOut:Z==="disabled"?E||le||A.disabled:E||A.maxReached},[Z,E,le,A]),te={soldOut:"danger",ruleBlocked:ee,disabled:"default",maxReached:"warning"},ue={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},se=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",B&&"text-sm",g.name),children:e.name}),Le=()=>{if(!b)return null;const ne=j?.price??e.price,ye=j?.originalPrice,Ye=Yn(ne,i,r);if(o?.renderPrice)return o.renderPrice(ne,Ye,e);if(mt(ye)&&mt(ne)&&ye>ne){const Je=Yn(ye,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",B&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",Je,", discounted price ",Ye]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",B&&"text-xs",g.originalPrice),children:Je}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",B&&"text-sm",g.discountedPrice),children:Ye})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",B&&"text-sm mt-0.5",g.price),children:Ye})},Me=()=>!h||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",B&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),Ee=()=>{if(!x||!mt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ne=e.numberOfPeople===1?A.person:A.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,ne,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",B&&"mt-1 text-xs",g.peopleCount),children:[t.jsx(I,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",ne]})},Xe=()=>{const ne=T===0||W,ye=K||W;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:T,onIncrement:()=>X(1),onDecrement:()=>X(-1),isDecrementDisabled:ne,isIncrementDisabled:ye,isDisabled:W}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(V,{"data-testid":"offer-card-decrement-button",onPress:()=>X(-1),isDisabled:ne,variant:u,color:T>0?N:f,radius:"full",isIconOnly:!0,size:B?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(I,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",B&&"text-sm"),children:T}),t.jsx(V,{"data-testid":"offer-card-increment-button",onPress:()=>X(1),isDisabled:ye,variant:u,color:T>0?N:f,radius:"full",isIconOnly:!0,size:B?"md":"sm","aria-label":"Increase quantity",children:t.jsx(I,{icon:"gravity-ui:plus",width:16})})]})},Ie=(ne,ye)=>o?.renderDisabledState?o.renderDisabledState(ne,ye):ne==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(ye):ne==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(ye):t.jsx(c.Chip,{"data-testid":ue[ne],color:te[ne],variant:ne==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ne==="maxReached"?"h-8":"h-10",ne==="soldOut"&&g.soldOut,ne==="maxReached"&&g.maxReachedAlert,B&&"h-8"),startContent:t.jsx(I,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ye})}),ut=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",B?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",W||K?"opacity-50 pointer-events-none select-none":""),children:[se(),Le(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",B?"mb-1":"mb-2"),children:[Ee(),Me()]})]}),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",B&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:Z&&ae?Ie(Z,ae):Xe()})]}),We=K&&!U&&!Q&&!q?t.jsx(De.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:Ie("maxReached",ae||A.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",B&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",B?"pb-0.5":"",g.body),children:ut}),t.jsx(De.AnimatePresence,{children:We&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",B?"pt-1":"",g.footer),children:We})})]}):t.jsxs("div",{className:c.cn("w-full",B&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",B?"pb-0.5":"",g.body),children:ut}),t.jsx(De.AnimatePresence,{children:We&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",B?"pt-1":"",g.footer),children:We})})]})};Jt.displayName="OfferCard";const Fr=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:a=48,showCard:s=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return s?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(I,{"data-testid":"offer-card-empty-icon",icon:n,width:a,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 s?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})};Fr.displayName="OfferCardEmpty";const Dd={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Lr=({error:e,labels:n,showCard:a=!0,color:s="danger",classNames:r={}})=>{const i={...Dd,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:s,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Lr.displayName="OfferCardError";const Ed={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Mr=({quantity:e=2,gap:n=4,classNames:a={}})=>{const s=Ed[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(s,a.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",a.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Mr.displayName="OfferCardSkeleton";const _r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Rr={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"}}},Fd={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Tr=({offers:e=[],mapOffer:n,selection:a,defaultSelection:s={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:h="default",showCard:x=!0,animated:b=!0,gap:j=2,compact:g=!1,classNames:w={}})=>{const[N,S]=p.useState(s),v=a!==void 0?a:N,D=p.useCallback((A,F)=>{const _={...v,[A]:Math.max(0,F)};a===void 0&&S(_),r?.(_),i?.(A,_[A])},[v,a,r,i]),M=[...e].sort((A,F)=>(A.position??0)-(F.position??0)),k=A=>{const F=n?n(A):A,_=(v??{})[F.id]||0;return{offer:F,quantity:_,onQuantityChange:D,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:g}},E=Fd[j],C=c.cn("grid mx-auto pt-2",E,w.base),R=A=>{const F=k(A);return t.jsx(Jt,{offer:F.offer,quantity:F.quantity,onQuantityChange:F.onQuantityChange,currency:F.currency,locale:F.locale,labels:F.labels,slots:F.slots,isDisabled:F.isDisabled,buttonVariant:F.buttonVariant,buttonColor:F.buttonColor,showCard:F.showCard,compact:F.compact,classNames:w.card},F.offer.id)};return b?t.jsx(De.motion.div,{"data-testid":"offer-card-list",className:C,variants:_r,initial:"hidden",animate:"show",children:t.jsx(De.AnimatePresence,{children:M.map(A=>{const F=k(A);return t.jsx(De.motion.div,{"data-testid":`offer-card-list-item-${F.offer.id}`,className:w.cardWrapper,variants:Rr,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Jt,{offer:F.offer,quantity:F.quantity,onQuantityChange:D,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:g||F.offer.compact,classNames:w.card})},F.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:C,children:M.map(R)})};Tr.displayName="OfferCardList";var _t=e=>e.type==="checkbox",ot=e=>e instanceof Date,Fe=e=>e==null;const Pr=e=>typeof e=="object";var be=e=>!Fe(e)&&!Array.isArray(e)&&Pr(e)&&!ot(e),Ir=e=>be(e)&&e.target?_t(e.target)?e.target.checked:e.target.value:e,Ld=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Or=(e,n)=>e.has(Ld(n)),Md=e=>{const n=e.constructor&&e.constructor.prototype;return be(n)&&n.hasOwnProperty("isPrototypeOf")},fa=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function he(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(fa&&(e instanceof Blob||n))return e;const a=Array.isArray(e);if(!a&&!(be(e)&&Md(e)))return e;const s=a?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=he(e[r]));return s}var un=e=>/^\w*$/.test(e),me=e=>e===void 0,xa=e=>Array.isArray(e)?e.filter(Boolean):[],ha=e=>xa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,a)=>{if(!n||!be(e))return a;const s=(un(n)?[n]:ha(n)).reduce((r,i)=>Fe(r)?r:r[i],e);return me(s)||s===e?me(e[n])?a:e[n]:s},Te=e=>typeof e=="boolean",Ae=e=>typeof e=="function",ce=(e,n,a)=>{let s=-1;const r=un(n)?[n]:ha(n),i=r.length,l=i-1;for(;++s<i;){const o=r[s];let d=a;if(s!==l){const u=e[o];d=be(u)||Array.isArray(u)?u:isNaN(+r[s+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const en={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ve={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ge={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zr=p.createContext(null);zr.displayName="HookFormControlContext";const pa=()=>p.useContext(zr);var Br=(e,n,a,s=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==Ve.all&&(n._proxyFormState[l]=!s||Ve.all),a&&(a[l]=!0),e[l]}});return r};const ga=typeof window<"u"?p.useLayoutEffect:p.useEffect;function _d(e){const n=pa(),{control:a=n,disabled:s,name:r,exact:i}=e||{},[l,o]=p.useState(a._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ga(()=>a._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!s&&o({...a._formState,...u})}}),[r,s,i]),p.useEffect(()=>{d.current.isValid&&a._setValid(!0)},[a]),p.useMemo(()=>Br(l,a,d.current,!1),[l,a])}var Pe=e=>typeof e=="string",Gn=(e,n,a,s,r)=>Pe(e)?(s&&n.watch.add(e),H(a,e,r)):Array.isArray(e)?e.map(i=>(s&&n.watch.add(i),H(a,i))):(s&&(n.watchAll=!0),a),Kn=e=>Fe(e)||!Pr(e);function Ue(e,n,a=new WeakSet){if(Kn(e)||Kn(n))return Object.is(e,n);if(ot(e)&&ot(n))return Object.is(e.getTime(),n.getTime());const s=Object.keys(e),r=Object.keys(n);if(s.length!==r.length)return!1;if(a.has(e)||a.has(n))return!0;a.add(e),a.add(n);for(const i of s){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(ot(l)&&ot(o)||be(l)&&be(o)||Array.isArray(l)&&Array.isArray(o)?!Ue(l,o,a):!Object.is(l,o))return!1}}return!0}function Rd(e){const n=pa(),{control:a=n,name:s,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(a),h=p.useRef(s);u.current=o;const[x,b]=p.useState(()=>{const v=a._getWatch(s,d.current);return u.current?u.current(v):v}),j=p.useCallback(v=>{const D=Gn(s,a._names,v||a._formValues,!1,d.current);return u.current?u.current(D):D},[a._formValues,a._names,s]),g=p.useCallback(v=>{if(!i){const D=Gn(s,a._names,v||a._formValues,!1,d.current);if(u.current){const M=u.current(D);Ue(M,f.current)||(b(M),f.current=M)}else b(D)}},[a._formValues,a._names,i,s]);ga(()=>((m.current!==a||!Ue(h.current,s))&&(m.current=a,h.current=s,g()),a._subscribe({name:s,formState:{values:!0},exact:l,callback:v=>{g(v.values)}})),[a,l,s,g]),p.useEffect(()=>a._removeUnmounted());const w=m.current!==a,N=h.current,S=p.useMemo(()=>{if(i)return null;const v=!w&&!Ue(N,s);return w||v?j():null},[i,w,s,N,j]);return S!==null?S:x}function Td(e){const n=pa(),{name:a,disabled:s,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Or(r._names.array,a),u=p.useMemo(()=>H(r._formValues,a,H(r._defaultValues,a,l)),[r,a,l]),f=Rd({control:r,name:a,defaultValue:u,exact:o}),m=_d({control:r,name:a,exact:o}),h=p.useRef(e),x=p.useRef(void 0),b=p.useRef(r.register(a,{...e.rules,value:f,...Te(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const j=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,a)},error:{enumerable:!0,get:()=>H(m.errors,a)}}),[m,a]),g=p.useCallback(v=>b.current.onChange({target:{value:Ir(v),name:a},type:en.CHANGE}),[a]),w=p.useCallback(()=>b.current.onBlur({target:{value:H(r._formValues,a),name:a},type:en.BLUR}),[a,r._formValues]),N=p.useCallback(v=>{const D=H(r._fields,a);D&&D._f&&v&&(D._f.ref={focus:()=>Ae(v.focus)&&v.focus(),select:()=>Ae(v.select)&&v.select(),setCustomValidity:M=>Ae(v.setCustomValidity)&&v.setCustomValidity(M),reportValidity:()=>Ae(v.reportValidity)&&v.reportValidity()})},[r._fields,a]),S=p.useMemo(()=>({name:a,value:f,...Te(s)||m.disabled?{disabled:m.disabled||s}:{},onChange:g,onBlur:w,ref:N}),[a,s,m.disabled,g,w,N,f]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,D=x.current;D&&D!==a&&!d&&r.unregister(D),r.register(a,{...h.current.rules,...Te(h.current.disabled)?{disabled:h.current.disabled}:{}});const M=(k,E)=>{const C=H(r._fields,k);C&&C._f&&(C._f.mount=E)};if(M(a,!0),v){const k=he(H(r._options.defaultValues,a,h.current.defaultValue));ce(r._defaultValues,a,k),me(H(r._formValues,a))&&ce(r._formValues,a,k)}return!d&&r.register(a),x.current=a,()=>{(d?v&&!r._state.action:v)?r.unregister(a):M(a,!1)}},[a,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:s,name:a})},[s,a,r]),p.useMemo(()=>({field:S,formState:m,fieldState:j}),[S,m,j])}const Pd=p.createContext(null);Pd.displayName="HookFormContext";var Id=(e,n,a,s,r)=>n?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[s]:r||!0}}:{},At=e=>Array.isArray(e)?e:[e],os=()=>{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 Vr(e,n){const a={};for(const s in e)if(e.hasOwnProperty(s)){const r=e[s],i=n[s];if(r&&be(r)&&i){const l=Vr(r,i);be(l)&&(a[s]=l)}else e[s]&&(a[s]=i)}return a}var Se=e=>be(e)&&!Object.keys(e).length,ba=e=>e.type==="file",tn=e=>{if(!fa)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Ur=e=>e.type==="select-multiple",ya=e=>e.type==="radio",Od=e=>ya(e)||_t(e),Sn=e=>tn(e)&&e.isConnected;function zd(e,n){const a=n.slice(0,-1).length;let s=0;for(;s<a;)e=me(e)?s++:e[n[s++]];return e}function Bd(e){for(const n in e)if(e.hasOwnProperty(n)&&!me(e[n]))return!1;return!0}function pe(e,n){const a=Array.isArray(n)?n:un(n)?[n]:ha(n),s=a.length===1?e:zd(e,a),r=a.length-1,i=a[r];return s&&delete s[i],r!==0&&(be(s)&&Se(s)||Array.isArray(s)&&Bd(s))&&pe(e,a.slice(0,-1)),e}var Vd=e=>{for(const n in e)if(Ae(e[n]))return!0;return!1};function Hr(e){return Array.isArray(e)||be(e)&&!Vd(e)}function Qn(e,n={}){for(const a in e){const s=e[a];Hr(s)?(n[a]=Array.isArray(s)?[]:{},Qn(s,n[a])):me(s)||(n[a]=!0)}return n}function ht(e,n,a){a||(a=Qn(n));for(const s in e){const r=e[s];if(Hr(r))me(n)||Kn(a[s])?a[s]=Qn(r,Array.isArray(r)?[]:{}):ht(r,Fe(n)?{}:n[s],a[s]);else{const i=n[s];a[s]=!Ue(r,i)}}return a}const cs={value:!1,isValid:!1},ds={value:!0,isValid:!0};var qr=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!me(e[0].attributes.value)?me(e[0].value)||e[0].value===""?ds:{value:e[0].value,isValid:!0}:ds:cs}return cs},Wr=(e,{valueAsNumber:n,valueAsDate:a,setValueAs:s})=>me(e)?e:n?e===""?NaN:e&&+e:a&&Pe(e)?new Date(e):s?s(e):e;const us={isValid:!1,value:null};var Yr=e=>Array.isArray(e)?e.reduce((n,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:n,us):us;function ms(e){const n=e.ref;return ba(n)?n.files:ya(n)?Yr(e.refs).value:Ur(n)?[...n.selectedOptions].map(({value:a})=>a):_t(n)?qr(e.refs).value:Wr(me(n.value)?e.ref.value:n.value,e)}var Ud=(e,n,a,s)=>{const r={};for(const i of e){const l=H(n,i);l&&ce(r,i,l._f)}return{criteriaMode:a,names:[...e],fields:r,shouldUseNativeValidation:s}},nn=e=>e instanceof RegExp,Nt=e=>me(e)?e:nn(e)?e.source:be(e)?nn(e.value)?e.value.source:e.value:e,fs=e=>({isOnSubmit:!e||e===Ve.onSubmit,isOnBlur:e===Ve.onBlur,isOnChange:e===Ve.onChange,isOnAll:e===Ve.all,isOnTouch:e===Ve.onTouched});const xs="AsyncFunction";var Hd=e=>!!e&&!!e.validate&&!!(Ae(e.validate)&&e.validate.constructor.name===xs||be(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===xs)),qd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hs=(e,n,a)=>!a&&(n.watchAll||n.watch.has(e)||[...n.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Dt=(e,n,a,s)=>{for(const r of a||Object.keys(e)){const i=H(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!s)return!0;if(l.ref&&n(l.ref,l.name)&&!s)return!0;if(Dt(o,n))break}else if(be(o)&&Dt(o,n))break}}};function ps(e,n,a){const s=H(e,a);if(s||un(a))return{error:s,name:a};const r=a.split(".");for(;r.length;){const i=r.join("."),l=H(n,i),o=H(e,i);if(l&&!Array.isArray(l)&&a!==i)return{name:a};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:a}}var Wd=(e,n,a,s)=>{a(e);const{name:r,...i}=e;return Se(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!s||Ve.all))},Yd=(e,n,a)=>!e||!n||e===n||At(e).some(s=>s&&(a?s===n:s.startsWith(n)||n.startsWith(s))),Gd=(e,n,a,s,r)=>r.isOnAll?!1:!a&&r.isOnTouch?!(n||e):(a?s.isOnBlur:r.isOnBlur)?!e:(a?s.isOnChange:r.isOnChange)?e:!0,Kd=(e,n)=>!xa(H(e,n)).length&&pe(e,n),Qd=(e,n,a)=>{const s=At(H(e,a));return ce(s,"root",n[a]),ce(e,a,s),e};function gs(e,n,a="validate"){if(Pe(e)||Array.isArray(e)&&e.every(Pe)||Te(e)&&!e)return{type:a,message:Pe(e)?e:"",ref:n}}var ft=e=>be(e)&&!nn(e)?e:{value:e,message:""},bs=async(e,n,a,s,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:h,pattern:x,validate:b,name:j,valueAsNumber:g,mount:w}=e._f,N=H(a,j);if(!w||n.has(j))return{};const S=o?o[0]:l,v=F=>{r&&S.reportValidity&&(S.setCustomValidity(Te(F)?"":F||""),S.reportValidity())},D={},M=ya(l),k=_t(l),E=M||k,C=(g||ba(l))&&me(l.value)&&me(N)||tn(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,R=Id.bind(null,j,s,D),A=(F,_,T,q=Ge.maxLength,B=Ge.minLength)=>{const U=F?_:T;D[j]={type:F?q:B,message:U,ref:l,...R(F?q:B,U)}};if(i?!Array.isArray(N)||!N.length:d&&(!E&&(C||Fe(N))||Te(N)&&!N||k&&!qr(o).isValid||M&&!Yr(o).isValid)){const{value:F,message:_}=Pe(d)?{value:!!d,message:d}:ft(d);if(F&&(D[j]={type:Ge.required,message:_,ref:S,...R(Ge.required,_)},!s))return v(_),D}if(!C&&(!Fe(m)||!Fe(h))){let F,_;const T=ft(h),q=ft(m);if(!Fe(N)&&!isNaN(N)){const B=l.valueAsNumber||N&&+N;Fe(T.value)||(F=B>T.value),Fe(q.value)||(_=B<q.value)}else{const B=l.valueAsDate||new Date(N),U=le=>new Date(new Date().toDateString()+" "+le),K=l.type=="time",Q=l.type=="week";Pe(T.value)&&N&&(F=K?U(N)>U(T.value):Q?N>T.value:B>new Date(T.value)),Pe(q.value)&&N&&(_=K?U(N)<U(q.value):Q?N<q.value:B<new Date(q.value))}if((F||_)&&(A(!!F,T.message,q.message,Ge.max,Ge.min),!s))return v(D[j].message),D}if((u||f)&&!C&&(Pe(N)||i&&Array.isArray(N))){const F=ft(u),_=ft(f),T=!Fe(F.value)&&N.length>+F.value,q=!Fe(_.value)&&N.length<+_.value;if((T||q)&&(A(T,F.message,_.message),!s))return v(D[j].message),D}if(x&&!C&&Pe(N)){const{value:F,message:_}=ft(x);if(nn(F)&&!N.match(F)&&(D[j]={type:Ge.pattern,message:_,ref:l,...R(Ge.pattern,_)},!s))return v(_),D}if(b){if(Ae(b)){const F=await b(N,a),_=gs(F,S);if(_&&(D[j]={..._,...R(Ge.validate,_.message)},!s))return v(_.message),D}else if(be(b)){let F={};for(const _ in b){if(!Se(F)&&!s)break;const T=gs(await b[_](N,a),S,_);T&&(F={...T,...R(_,T.message)},v(T.message),s&&(D[j]=F))}if(!Se(F)&&(D[j]={ref:S,...F},!s))return D}}return v(!0),D};const Zd={mode:Ve.onSubmit,reValidateMode:Ve.onChange,shouldFocusError:!0};function Xd(e={}){let n={...Zd,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ae(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},s={},r=be(n.defaultValues)||be(n.values)?he(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:he(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let h={...m};const x={array:os(),state:os()},b=n.criteriaMode===Ve.all,j=y=>$=>{clearTimeout(u),u=setTimeout(y,$)},g=async y=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||h.isValid||y)){let $;n.resolver?($=Se((await E()).errors),w()):$=await R(s,!0),$!==a.isValid&&x.state.next({isValid:$})}},w=(y,$)=>{!n.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((y||Array.from(o.mount)).forEach(L=>{L&&($?ce(a.validatingFields,L,$):pe(a.validatingFields,L))}),x.state.next({validatingFields:a.validatingFields,isValidating:!Se(a.validatingFields)}))},N=(y,$=[],L,O,z=!0,P=!0)=>{if(O&&L&&!n.disabled){if(l.action=!0,P&&Array.isArray(H(s,y))){const Y=L(H(s,y),O.argA,O.argB);z&&ce(s,y,Y)}if(P&&Array.isArray(H(a.errors,y))){const Y=L(H(a.errors,y),O.argA,O.argB);z&&ce(a.errors,y,Y),Kd(a.errors,y)}if((m.touchedFields||h.touchedFields)&&P&&Array.isArray(H(a.touchedFields,y))){const Y=L(H(a.touchedFields,y),O.argA,O.argB);z&&ce(a.touchedFields,y,Y)}(m.dirtyFields||h.dirtyFields)&&(a.dirtyFields=ht(r,i)),x.state.next({name:y,isDirty:F(y,$),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else ce(i,y,$)},S=(y,$)=>{ce(a.errors,y,$),x.state.next({errors:a.errors})},v=y=>{a.errors=y,x.state.next({errors:a.errors,isValid:!1})},D=(y,$,L,O)=>{const z=H(s,y);if(z){const P=H(i,y,me(L)?H(r,y):L);me(P)||O&&O.defaultChecked||$?ce(i,y,$?P:ms(z._f)):q(y,P),l.mount&&!l.action&&g()}},M=(y,$,L,O,z)=>{let P=!1,Y=!1;const re={name:y};if(!n.disabled){if(!L||O){(m.isDirty||h.isDirty)&&(Y=a.isDirty,a.isDirty=re.isDirty=F(),P=Y!==re.isDirty);const ie=Ue(H(r,y),$);Y=!!H(a.dirtyFields,y),ie?pe(a.dirtyFields,y):ce(a.dirtyFields,y,!0),re.dirtyFields=a.dirtyFields,P=P||(m.dirtyFields||h.dirtyFields)&&Y!==!ie}if(L){const ie=H(a.touchedFields,y);ie||(ce(a.touchedFields,y,L),re.touchedFields=a.touchedFields,P=P||(m.touchedFields||h.touchedFields)&&ie!==L)}P&&z&&x.state.next(re)}return P?re:{}},k=(y,$,L,O)=>{const z=H(a.errors,y),P=(m.isValid||h.isValid)&&Te($)&&a.isValid!==$;if(n.delayError&&L?(d=j(()=>S(y,L)),d(n.delayError)):(clearTimeout(u),d=null,L?ce(a.errors,y,L):pe(a.errors,y)),(L?!Ue(z,L):z)||!Se(O)||P){const Y={...O,...P&&Te($)?{isValid:$}:{},errors:a.errors,name:y};a={...a,...Y},x.state.next(Y)}},E=async y=>(w(y,!0),await n.resolver(i,n.context,Ud(y||o.mount,s,n.criteriaMode,n.shouldUseNativeValidation))),C=async y=>{const{errors:$}=await E(y);if(w(y),y)for(const L of y){const O=H($,L);O?ce(a.errors,L,O):pe(a.errors,L)}else a.errors=$;return $},R=async(y,$,L={valid:!0})=>{for(const O in y){const z=y[O];if(z){const{_f:P,...Y}=z;if(P){const re=o.array.has(P.name),ie=z._f&&Hd(z._f);ie&&m.validatingFields&&w([P.name],!0);const ke=await bs(z,o.disabled,i,b,n.shouldUseNativeValidation&&!$,re);if(ie&&m.validatingFields&&w([P.name]),ke[P.name]&&(L.valid=!1,$||e.shouldUseNativeValidation))break;!$&&(H(ke,P.name)?re?Qd(a.errors,ke,P.name):ce(a.errors,P.name,ke[P.name]):pe(a.errors,P.name))}!Se(Y)&&await R(Y,$,L)}}return L.valid},A=()=>{for(const y of o.unMount){const $=H(s,y);$&&($._f.refs?$._f.refs.every(L=>!Sn(L)):!Sn($._f.ref))&&se(y)}o.unMount=new Set},F=(y,$)=>!n.disabled&&(y&&$&&ce(i,y,$),!Ue(W(),r)),_=(y,$,L)=>Gn(y,o,{...l.mount?i:me($)?r:Pe(y)?{[y]:$}:$},L,$),T=y=>xa(H(l.mount?i:r,y,n.shouldUnregister?H(r,y,[]):[])),q=(y,$,L={})=>{const O=H(s,y);let z=$;if(O){const P=O._f;P&&(!P.disabled&&ce(i,y,Wr($,P)),z=tn(P.ref)&&Fe($)?"":$,Ur(P.ref)?[...P.ref.options].forEach(Y=>Y.selected=z.includes(Y.value)):P.refs?_t(P.ref)?P.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(z)?Y.checked=!!z.find(re=>re===Y.value):Y.checked=z===Y.value||!!z)}):P.refs.forEach(Y=>Y.checked=Y.value===z):ba(P.ref)?P.ref.value="":(P.ref.value=z,P.ref.type||x.state.next({name:y,values:he(i)})))}(L.shouldDirty||L.shouldTouch)&&M(y,z,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&le(y)},B=(y,$,L)=>{for(const O in $){if(!$.hasOwnProperty(O))return;const z=$[O],P=y+"."+O,Y=H(s,P);(o.array.has(y)||be(z)||Y&&!Y._f)&&!ot(z)?B(P,z,L):q(P,z,L)}},U=(y,$,L={})=>{const O=H(s,y),z=o.array.has(y),P=he($);ce(i,y,P),z?(x.array.next({name:y,values:he(i)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&L.shouldDirty&&x.state.next({name:y,dirtyFields:ht(r,i),isDirty:F(y,P)})):O&&!O._f&&!Fe(P)?B(y,P,L):q(y,P,L),hs(y,o)?x.state.next({...a,name:y,values:he(i)}):x.state.next({name:l.mount?y:void 0,values:he(i)})},K=async y=>{l.mount=!0;const $=y.target;let L=$.name,O=!0;const z=H(s,L),P=ie=>{O=Number.isNaN(ie)||ot(ie)&&isNaN(ie.getTime())||Ue(ie,H(i,L,ie))},Y=fs(n.mode),re=fs(n.reValidateMode);if(z){let ie,ke;const rt=$.type?ms(z._f):Ir(y),et=y.type===en.BLUR||y.type===en.FOCUS_OUT,Tl=!qd(z._f)&&!n.resolver&&!H(a.errors,L)&&!z._f.deps||Gd(et,H(a.touchedFields,L),a.isSubmitted,re,Y),xn=hs(L,o,et);ce(i,L,rt),et?(!$||!$.readOnly)&&(z._f.onBlur&&z._f.onBlur(y),d&&d(0)):z._f.onChange&&z._f.onChange(y);const hn=M(L,rt,et),Pl=!Se(hn)||xn;if(!et&&x.state.next({name:L,type:y.type,values:he(i)}),Tl)return(m.isValid||h.isValid)&&(n.mode==="onBlur"?et&&g():et||g()),Pl&&x.state.next({name:L,...xn?{}:hn});if(!et&&xn&&x.state.next({...a}),n.resolver){const{errors:Pa}=await E([L]);if(w([L]),P(rt),O){const Il=ps(a.errors,s,L),Ia=ps(Pa,s,Il.name||L);ie=Ia.error,L=Ia.name,ke=Se(Pa)}}else w([L],!0),ie=(await bs(z,o.disabled,i,b,n.shouldUseNativeValidation))[L],w([L]),P(rt),O&&(ie?ke=!1:(m.isValid||h.isValid)&&(ke=await R(s,!0)));O&&(z._f.deps&&(!Array.isArray(z._f.deps)||z._f.deps.length>0)&&le(z._f.deps),k(L,ke,ie,hn))}},Q=(y,$)=>{if(H(a.errors,$)&&y.focus)return y.focus(),1},le=async(y,$={})=>{let L,O;const z=At(y);if(n.resolver){const P=await C(me(y)?y:z);L=Se(P),O=y?!z.some(Y=>H(P,Y)):L}else y?(O=(await Promise.all(z.map(async P=>{const Y=H(s,P);return await R(Y&&Y._f?{[P]:Y}:Y)}))).every(Boolean),!(!O&&!a.isValid)&&g()):O=L=await R(s);return x.state.next({...!Pe(y)||(m.isValid||h.isValid)&&L!==a.isValid?{}:{name:y},...n.resolver||!y?{isValid:L}:{},errors:a.errors}),$.shouldFocus&&!O&&Dt(s,Q,y?z:o.mount),O},W=(y,$)=>{let L={...l.mount?i:r};return $&&(L=Vr($.dirtyFields?a.dirtyFields:a.touchedFields,L)),me(y)?L:Pe(y)?H(L,y):y.map(O=>H(L,O))},X=(y,$)=>({invalid:!!H(($||a).errors,y),isDirty:!!H(($||a).dirtyFields,y),error:H(($||a).errors,y),isValidating:!!H(a.validatingFields,y),isTouched:!!H(($||a).touchedFields,y)}),Z=y=>{y&&At(y).forEach($=>pe(a.errors,$)),x.state.next({errors:y?a.errors:{}})},ee=(y,$,L)=>{const O=(H(s,y,{_f:{}})._f||{}).ref,z=H(a.errors,y)||{},{ref:P,message:Y,type:re,...ie}=z;ce(a.errors,y,{...ie,...$,ref:O}),x.state.next({name:y,errors:a.errors,isValid:!1}),L&&L.shouldFocus&&O&&O.focus&&O.focus()},ae=(y,$)=>Ae(y)?x.state.subscribe({next:L=>"values"in L&&y(_(void 0,$),L)}):_(y,$,!0),te=y=>x.state.subscribe({next:$=>{Yd(y.name,$.name,y.exact)&&Wd($,y.formState||m,Ye,y.reRenderRoot)&&y.callback({values:{...i},...a,...$,defaultValues:r})}}).unsubscribe,ue=y=>(l.mount=!0,h={...h,...y.formState},te({...y,formState:{...f,...y.formState}})),se=(y,$={})=>{for(const L of y?At(y):o.mount)o.mount.delete(L),o.array.delete(L),$.keepValue||(pe(s,L),pe(i,L)),!$.keepError&&pe(a.errors,L),!$.keepDirty&&pe(a.dirtyFields,L),!$.keepTouched&&pe(a.touchedFields,L),!$.keepIsValidating&&pe(a.validatingFields,L),!n.shouldUnregister&&!$.keepDefaultValue&&pe(r,L);x.state.next({values:he(i)}),x.state.next({...a,...$.keepDirty?{isDirty:F()}:{}}),!$.keepIsValid&&g()},Le=({disabled:y,name:$})=>{if(Te(y)&&l.mount||y||o.disabled.has($)){const z=o.disabled.has($)!==!!y;y?o.disabled.add($):o.disabled.delete($),z&&l.mount&&!l.action&&g()}},Me=(y,$={})=>{let L=H(s,y);const O=Te($.disabled)||Te(n.disabled);return ce(s,y,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:y}},name:y,mount:!0,...$}}),o.mount.add(y),L?Le({disabled:Te($.disabled)?$.disabled:n.disabled,name:y}):D(y,!0,$.value),{...O?{disabled:$.disabled||n.disabled}:{},...n.progressive?{required:!!$.required,min:Nt($.min),max:Nt($.max),minLength:Nt($.minLength),maxLength:Nt($.maxLength),pattern:Nt($.pattern)}:{},name:y,onChange:K,onBlur:K,ref:z=>{if(z){Me(y,$),L=H(s,y);const P=me(z.value)&&z.querySelectorAll&&z.querySelectorAll("input,select,textarea")[0]||z,Y=Od(P),re=L._f.refs||[];if(Y?re.find(ie=>ie===P):P===L._f.ref)return;ce(s,y,{_f:{...L._f,...Y?{refs:[...re.filter(Sn),P,...Array.isArray(H(r,y))?[{}]:[]],ref:{type:P.type,name:y}}:{ref:P}}}),D(y,!1,void 0,P)}else L=H(s,y,{}),L._f&&(L._f.mount=!1),(n.shouldUnregister||$.shouldUnregister)&&!(Or(o.array,y)&&l.action)&&o.unMount.add(y)}}},Ee=()=>n.shouldFocusError&&Dt(s,Q,o.mount),Xe=y=>{Te(y)&&(x.state.next({disabled:y}),Dt(s,($,L)=>{const O=H(s,L);O&&($.disabled=O._f.disabled||y,Array.isArray(O._f.refs)&&O._f.refs.forEach(z=>{z.disabled=O._f.disabled||y}))},0,!1))},Ie=(y,$)=>async L=>{let O;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let z=he(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Y}=await E();w(),a.errors=P,z=he(Y)}else await R(s);if(o.disabled.size)for(const P of o.disabled)pe(z,P);if(pe(a.errors,"root"),Se(a.errors)){x.state.next({errors:{}});try{await y(z,L)}catch(P){O=P}}else $&&await $({...a.errors},L),Ee(),setTimeout(Ee);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Se(a.errors)&&!O,submitCount:a.submitCount+1,errors:a.errors}),O)throw O},ut=(y,$={})=>{H(s,y)&&(me($.defaultValue)?U(y,he(H(r,y))):(U(y,$.defaultValue),ce(r,y,he($.defaultValue))),$.keepTouched||pe(a.touchedFields,y),$.keepDirty||(pe(a.dirtyFields,y),a.isDirty=$.defaultValue?F(y,he(H(r,y))):F()),$.keepError||(pe(a.errors,y),m.isValid&&g()),x.state.next({...a}))},We=(y,$={})=>{const L=y?he(y):r,O=he(L),z=Se(y),P=z?r:O;if($.keepDefaultValues||(r=L),!$.keepValues){if($.keepDirtyValues){const Y=new Set([...o.mount,...Object.keys(ht(r,i))]);for(const re of Array.from(Y)){const ie=H(a.dirtyFields,re),ke=H(i,re),rt=H(P,re);ie&&!me(ke)?ce(P,re,ke):!ie&&!me(rt)&&U(re,rt)}}else{if(fa&&me(y))for(const Y of o.mount){const re=H(s,Y);if(re&&re._f){const ie=Array.isArray(re._f.refs)?re._f.refs[0]:re._f.ref;if(tn(ie)){const ke=ie.closest("form");if(ke){ke.reset();break}}}}if($.keepFieldsRef)for(const Y of o.mount)U(Y,H(P,Y));else s={}}i=n.shouldUnregister?$.keepDefaultValues?he(r):{}:he(P),x.array.next({values:{...P}}),x.state.next({values:{...P}})}o={mount:$.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!$.keepIsValid||!!$.keepDirtyValues||!n.shouldUnregister&&!Se(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!$.keepIsValid,l.action=!1,$.keepErrors||(a.errors={}),x.state.next({submitCount:$.keepSubmitCount?a.submitCount:0,isDirty:z?!1:$.keepDirty?a.isDirty:!!($.keepDefaultValues&&!Ue(y,r)),isSubmitted:$.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:z?{}:$.keepDirtyValues?$.keepDefaultValues&&i?ht(r,i):a.dirtyFields:$.keepDefaultValues&&y?ht(r,y):$.keepDirty?a.dirtyFields:{},touchedFields:$.keepTouched?a.touchedFields:{},errors:$.keepErrors?a.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ne=(y,$)=>We(Ae(y)?y(i):y,{...n.resetOptions,...$}),ye=(y,$={})=>{const L=H(s,y),O=L&&L._f;if(O){const z=O.refs?O.refs[0]:O.ref;z.focus&&setTimeout(()=>{z.focus(),$.shouldSelect&&Ae(z.select)&&z.select()})}},Ye=y=>{a={...a,...y}},Je={control:{register:Me,unregister:se,getFieldState:X,handleSubmit:Ie,setError:ee,_subscribe:te,_runSchema:E,_updateIsValidating:w,_focusError:Ee,_getWatch:_,_getDirty:F,_setValid:g,_setFieldArray:N,_setDisabledField:Le,_setErrors:v,_getFieldArray:T,_reset:We,_resetDefaultValues:()=>Ae(n.defaultValues)&&n.defaultValues().then(y=>{ne(y,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:A,_disableForm:Xe,_subjects:x,_proxyFormState:m,get _fields(){return s},get _formValues(){return i},get _state(){return l},set _state(y){l=y},get _defaultValues(){return r},get _names(){return o},set _names(y){o=y},get _formState(){return a},get _options(){return n},set _options(y){n={...n,...y}}},subscribe:ue,trigger:le,register:Me,handleSubmit:Ie,watch:ae,setValue:U,getValues:W,reset:ne,resetField:ut,clearErrors:Z,unregister:se,setError:ee,setFocus:ye,getFieldState:X};return{...Je,formControl:Je}}function Jd(e={}){const n=p.useRef(void 0),a=p.useRef(void 0),[s,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ae(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:Ae(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:s},e.defaultValues&&!Ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Xd(e);n.current={...o,formState:s}}const i=n.current.control;return i._options=e,ga(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),p.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),p.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),p.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),p.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==s.isDirty&&i._subjects.state.next({isDirty:l})}},[i,s.isDirty]),p.useEffect(()=>{var l;e.values&&!Ue(e.values,a.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),a.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),p.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),n.current.formState=p.useMemo(()=>Br(s,i),[i,s]),n.current}function eu(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function tu(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}function nu(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function au(e){const n=e.replace(/[^\d.,-]/g,""),a=n.match(/,\d{1,2}$/);let s;a?s=n.replace(/\./g,"").replace(",","."):s=n.replace(/,/g,"");const r=parseFloat(s);return isNaN(r)?null:r}function su(e,n,a=.001){const s=e-n,r=Math.abs(s)<=a;return{difference:s,isBalanced:r,isUnderAllocated:!r&&s>0,isOverAllocated:!r&&s<0}}function va(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}va();const ru={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},$n=()=>({id:va(),amount:0,glAccount:null,isTaxDeductible:!1}),Gr=({distribution:e,defaultDistribution:n,glAccounts:a=[],isLoadingGlAccounts:s=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:h=!1,labels:x,classNames:b={},"data-testid":j,control:g,name:w,rules:N})=>{const S={...ru,...x},v=g!==void 0&&w!==void 0,D=Jd({defaultValues:{_internal:n||$n()}}),M=Td({control:v?g:D.control,name:v?w:"_internal",rules:v?N:void 0}),[k,E]=p.useState(n||$n()),C=v?M.field.value??$n():e??k,R=v&&!!M.fieldState?.error,A=v&&(M.fieldState?.isTouched??!1),F=R||A,_=F&&(!C.amount||C.amount<=0),T=F&&!C.glAccount,[q,B]=p.useState(C.glAccount?.name||""),U=p.useCallback(ee=>{const ae={...C,...ee};v&&M.field.onChange(ae),!v&&e===void 0&&E(ae),i?.(ae)},[C,e,i,v,M]),K=p.useCallback(ee=>{const ae=ee||0;U({amount:ae}),l?.(ae)},[U,l]),Q=p.useCallback(ee=>{B(ee),r?.(ee)},[r]),le=p.useCallback(ee=>{if(ee===null){U({glAccount:null}),o?.(null);return}const te=a.find(ue=>String(ue.id)===String(ee))||null;U({glAccount:te}),o?.(te)},[a,U,o]),W=p.useCallback(()=>{B(""),U({glAccount:null}),o?.(null)},[U,o]),X=p.useCallback(ee=>{U({isTaxDeductible:ee}),d?.(ee)},[U,d]),Z=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":j||"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":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(c.Tooltip,{content:S.amountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:C.amount||void 0,onValueChange:K,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:h,isInvalid:_,errorMessage:_?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:S.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.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(c.Tooltip,{content:S.glAccountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:s,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:a,menuTrigger:"input",inputValue:C.glAccount?.name??q,selectedKey:C.glAccount?.id??null,isDisabled:h,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:s?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:Q,onSelectionChange:le,onClear:W,className:b.glAccountInput,children:ee=>t.jsx(c.AutocompleteItem,{textValue:ee.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:ee.name}),ee.code&&t.jsx("span",{className:"text-xs text-default-400",children:ee.code})]})},ee.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":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:C.isTaxDeductible,onValueChange:X,isDisabled:h||!m,className:b.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(V,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:h||!f,onPress:Z,startContent:t.jsx(I,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:S.deleteButton})})]})})};Gr.displayName="RevenueDistributionCard";const Kr=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:a=48,showCard:s=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(I,{icon:n,width:a,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 s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};Kr.displayName="RevenueDistributionEmpty";const iu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Qr=({error:e,labels:n,showCard:a=!0,color:s="danger",classNames:r={}})=>{const i={...iu,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:s,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};Qr.displayName="RevenueDistributionError";const Zr=({rows:e=1,showCard:n=!0,classNames:a={}})=>{const s=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",a.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",a.base),children:s.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",a.base),children:s.map(i=>r(i))})};Zr.displayName="RevenueDistributionSkeleton";function ja({isOpen:e,labels:n,icon:a,isConfirming:s=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[a&&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:a}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(V,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(V,{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:s,onPress:f,children:n.confirm})]})]})})}const lu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function ys(e){return!e.fund&&Number(e.percentage||0)<=0}function ou({mode:e,assignments:n}){const a=n.filter(i=>i.fund),s=a.reduce((i,l)=>i+Number(l.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return a.length>=1&&!r&&Math.round(s*100)/100===100}const cu={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"},Xr={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"},Ct={...Xr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},du={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"},uu={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 mu(){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 fu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,xu=e=>e.fund!==null;function hu({assignments:e,funds:n,labels:a,classNames:s,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:h,onOpenFundPicker:x,onCloseFundPicker:b,onCollapseChange:j,onSave:g}){const[w,N]=p.useState(null),S=f??w??void 0,v={...cu,...a},D=e.filter(te=>!ys(te)),k=D.filter(xu).length>0,E=p.useMemo(()=>e.filter(te=>!ys(te)).reduce((te,ue)=>te+Number(ue.percentage||0),0),[e]),C=Math.round(E*100)/100,R=D.some(te=>!te.fund||Number(te.percentage||0)<=0),A=k&&(C!==100||R),F=`${v.totalError} (${v.total} ${Number(E.toFixed(2))}%)`,_=ou({mode:"split",assignments:e}),T=k&&C>=100,[q,B]=p.useState(!1),[U,K]=p.useState(!1),Q=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(mu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),l?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),le=(te,ue)=>{h(e.map(se=>se.id===te?{...se,...ue}:se))},W=()=>{T||h([...e,lu()])},X=te=>{e.length<=1||h(e.filter(ue=>ue.id!==te))},Z=()=>{if(!r){if(!_){K(!0);return}if(!i){g();return}B(!0)}},ee=()=>{B(!1),g()},ae=te=>{const ue=u??e.find(se=>!se.fund)?.id??e[0]?.id;ue&&(h(e.map(se=>se.id===ue?{...se,fund:te}:se)),b())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",s?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",s?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",s?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:te=>j?.(!(te==="all"||Array.from(te).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:Q,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",s?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!k&&t.jsx(c.Alert,{icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Xr,color:"default",variant:"flat",title:v.emptySplit}),k&&t.jsx(pu,{assignments:e,labels:v,total:E,hasTotalError:U&&!_||A,validationMessage:F,onSelectFund:te=>x(te),onRemoveFund:X,onPercentageChange:(te,ue)=>le(te,{percentage:fu(ue)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(V,{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(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:T,onPress:()=>k?W():x(),children:v.assignSpecificFund}),t.jsx(V,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!_||r,onPress:Z,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(gu,{funds:n,labels:v,selectedFundIds:e.map(te=>te.fund?.id).filter(Boolean),portalContainer:S,onSelect:ae,onClose:b}),t.jsx(ja,{isOpen:q,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:S,shouldBlockScroll:!1,classNames:uu,onClose:()=>B(!1),onConfirm:ee})]})}function pu({assignments:e,labels:n,total:a,hasTotalError:s,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(V,{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(V,{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(G.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:du})}),e.length>1&&t.jsx(V,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":n.removeFund,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(I,{icon:s?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:s?"warning":"success",variant:"flat",classNames:{...Ct,base:c.cn(Ct.base,s?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Ct.iconWrapper,s?"text-warning-700":"text-success-700"),alertIcon:c.cn(Ct.alertIcon,s?"text-warning-700":"text-success-700"),title:c.cn(Ct.title,s?"text-warning-700":"text-success-700")},title:s?r:`${n.total} ${Number(a.toFixed(2))}%`})]})}function gu({funds:e,labels:n,selectedFundIds:a,portalContainer:s,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(a.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:s,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:l,placeholder:n.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(I,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(V,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function bu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const yu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function vu({totalAmount:e,remainingBalance:n,amountReceived:a,currency:s="USD",locale:r="en-US",labels:i,className:l}){const o={...yu,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:s});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(An,{label:o.totalAmount,value:d.format(e)}),t.jsx(An,{label:o.remainingBalance,value:d.format(n)}),t.jsx(An,{label:o.amountReceived,value:d.format(a)})]})})}function An({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const ju={monthly:1,quarterly:3,annual:12},Jr=e=>{const[n,a,s]=e.split("-").map(Number);return{year:n,month:a,day:s}},wu=(e,n)=>new Date(e,n+1,0).getDate(),Nu=e=>{const n=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${n}-${a}-${s}`},Cu=(e,n)=>{const{year:a,month:s,day:r}=Jr(e),i=s-1+n,l=a+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,wu(l,o));return new Date(l,o,d)},ku=(e,n)=>{const{year:a,month:s,day:r}=Jr(e),i=new Date(a,s-1,r);return i.setDate(i.getDate()+n),i};function ei(e,n){const a=Math.max(1,Math.floor(n.numberOfInstallments||1)),s=Math.round(e*100),r=Math.floor(s/a),i=s-r*a,l=ju[n.frequency];return Array.from({length:a},(o,d)=>{const u=n.frequency==="weekly"?ku(n.firstInstallmentDate,d*7):Cu(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:Nu(u),amount:(r+(d===0?i:0))/100}})}function Su(e){return new Set(e.map((n,a)=>{const s=e[a+1]?.dueDate;return n.dueDate&&s&&n.dueDate>s?n.id:null}).filter(n=>!!n))}function $u(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:Su(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function Au(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Du(e,n){const a=e[0];return!a||!n||a.dueDate===n?e:[{...a,dueDate:n},...e.slice(1)]}const Eu=new Set(["paid","partially_refunded","refunded"]);function ct(e){return e!==void 0&&Eu.has(e)}const Fu={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."},Lu=["weekly","monthly","quarterly","annual"],Mu=Array.from({length:31},(e,n)=>n+1),_u=["numberOfInstallments","frequency","firstInstallmentDate"],vs=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),an=e=>Math.round(e*100)/100,Ru=(e,n)=>{const a=new Date(`${e}T00:00:00`);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(a)},mn=e=>{if(!e)return null;try{return $c(e)}catch{return null}},Tu=e=>mn(e)?.day??1,Pu=(e,n)=>new Date(e,n,0).getDate(),Iu=(e,n)=>{const a=mn(e);if(!a)return e;const s=Math.min(n,Pu(a.year,a.month));return a.set({day:s}).toString()},js=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function Ou({mode:e,donationAmount:n,currency:a="USD",locale:s="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=_u,startDate:h,firstInstallmentDateOverride:x,labels:b,classNames:j,isSaving:g=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:S,onAutomaticSettingsChange:v,onInstallmentsChange:D,onSave:M,onCancel:k}){const[E,C]=p.useState(l),R={...Fu,...b},A=e??E,F=p.useMemo(()=>new Intl.NumberFormat(s,{style:"currency",currency:a}),[a,s]),_=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||h||"":h||i.firstInstallmentDate}),[i,m,h]),T=A==="automatic"?Du(ei(n,_),m.includes("firstInstallmentDate")?void 0:x):r,q=p.useMemo(()=>an(T.reduce((se,Le)=>se+Number(Le.amount||0),0)),[T]),B=Math.abs(q-n)>.009,U=an(n-q)<=0,K=p.useMemo(()=>$u(r),[r]),Q=A==="manual"&&Au(K),le=B||Q,W=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(G.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:R.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:R.saved}):null]}):void 0,X=se=>{se!==A&&(e||C(se),S?.(se),se==="manual"&&r.length===0&&D([vs()]))},Z=(se,Le)=>{const Me=r.find(Ee=>Ee.id===se);ct(Me?.status)||D(r.map(Ee=>Ee.id===se?{...Ee,...Le}:Ee))},ee=()=>{D([...r,vs()])},ae=se=>{const Le=r.find(Me=>Me.id===se);ct(Le?.status)||D(r.filter(Me=>Me.id!==se))},te=()=>{g||le||M?.()},ue=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.content),children:[f||u||k?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(zu,{mode:A,labels:R,onModeChange:X,isDisabled:N,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[k?t.jsx(V,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:k,children:R.cancelEdit}):null,u?t.jsx(V,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:g?void 0:t.jsx(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||le,onPress:te,children:R.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.preview),children:[A==="automatic"&&t.jsx(Bu,{settings:_,inputs:m,labels:R,className:j?.controls,onSettingsChange:v}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:A==="automatic"?R.emptyAutomatic:R.emptyManual}),T.length>0&&t.jsx(Vu,{mode:A,installments:T,rowErrors:K,labels:R,formatter:F,locale:s,onUpdateInstallment:Z,onRemoveInstallment:ae}),A==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(V,{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(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:U,onPress:ee,children:R.addInstallment})}),t.jsx(Wu,{total:q,donationAmount:n,hasTotalMismatch:B,mode:A,installments:T,formatter:F,labels:R,className:j?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.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:c.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(c.AccordionItem,{"aria-label":R.title,title:W,children:ue},"installment-schedule")}):ue})}function zu({mode:e,labels:n,className:a,isDisabled:s=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:s,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",a),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Bu({settings:e,inputs:n,labels:a,className:s,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:a.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:Lu.map(o=>t.jsx(c.SelectItem,{textValue:a[o],children:a[o]},o))})},l);if(l==="dayOfMonth"){const o=String(Tu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Iu(e.firstInstallmentDate,u)})},children:Mu.map(d=>t.jsx(c.SelectItem,{textValue:js(d),children:js(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ma,{variant:"bordered",label:a.firstInstallmentDate,labelPlacement:"outside",value:mn(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(I,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",s),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function Vu({mode:e,installments:n,rowErrors:a,labels:s,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Ru(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const f=a.missingDateRows.has(d.id),m=a.invalidDateRows.has(d.id),h=a.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(ma,{variant:"bordered","aria-label":`${s.dueDate} ${u+1}`,isDisabled:ct(d.status),isInvalid:f||m,errorMessage:f?s.dueDateRequiredError:m?s.dateOrderError:void 0,value:mn(d.dueDate),onChange:x=>l(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Hu,{amount:d.amount,ariaLabel:`${s.amount} ${u+1}`,isDisabled:ct(d.status),isInvalid:h,errorMessage:s.amountGreaterThanZeroError,onAmountChange:x=>l(d.id,{amount:x})})}),t.jsx(qu,{isDisabled:n.length<=1,isPaid:ct(d.status),label:s.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const Uu=/^\d*(?:[.,]\d{0,2})?$/;function Hu({amount:e,ariaLabel:n,isDisabled:a,isInvalid:s,errorMessage:r,onAmountChange:i}){const[l,o]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:a,isInvalid:s,errorMessage:s?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Uu.test(u))return;o(u);const f=Number(u.replace(",","."));i(an(Number.isFinite(f)?f:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function qu({isDisabled:e,isPaid:n,label:a,onRemove:s}){const r=t.jsx(V,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:s,"aria-label":a,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Wu({total:e,donationAmount:n,hasTotalMismatch:a,mode:s,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),h=an(n-e),x=Math.max(h,0),b=Math.max(-h,0),j=a?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):s==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),g=s==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:a?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:j})}function Yu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,n)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const ws={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"},ti={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"},Gu={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:ti.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."},Ku={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Qu=[];function Zu({installments:e,currency:n,locale:a="en-US",showTitle:s=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Qu,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:h,onDeleteInstallment:x}){const[b,j]=p.useState(null),g={...Gu,...u},[w,N]=p.useState(""),S=new Intl.NumberFormat(a,{style:"currency",currency:n}),v=e.some(C=>ni(C)!==null),D=e.some(C=>C.status==="partially_refunded"),M=s?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(G.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,k=p.useMemo(()=>{const C=w.trim().toLowerCase();if(!C)return e;const R=new Intl.NumberFormat(a,{style:"currency",currency:n});return e.filter(A=>{const F=A.status??"scheduled";return[Dn(A),A.id,A.amount,A.dueDate,Kt(A.dueDate,a),En(A,g.paidOn,a),Fn(A,g.refundedAmount,R),F,Ln(F,g.partiallyRefunded)].join(" ").toLowerCase().includes(C)})},[a,n,e,w,g.paidOn,g.refundedAmount,g.partiallyRefunded]),E=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:g.searchPlaceholder,onChange:C=>N(C.target.value),startContent:t.jsx(I,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(V,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(I,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",k.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[k.map((C,R)=>{const A=C.status??"scheduled",F=Dn(C),_=En(C,g.paidOn,a),T=Fn(C,g.refundedAmount,S);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",R+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:F||`PMT-${R+1}`})]}),t.jsx(Ns,{status:A,label:Ln(A,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:S.format(C.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:Kt(C.dueDate,a)}),_?t.jsx("p",{className:"text-xs text-default-500",children:_}):null]})]}),t.jsx(Cs,{status:A,installment:C,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})]})},C.id)}),k.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",k.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:v?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:D?"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:[k.map((C,R)=>{const A=C.status??"scheduled",F=Dn(C),_=En(C,g.paidOn,a),T=Fn(C,g.refundedAmount,S);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:R+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:F||`PMT-${R+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[S.format(C.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Kt(C.dueDate,a),_?t.jsx("span",{className:"block text-xs",children:_}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ns,{status:A,label:Ln(A,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Cs,{status:A,installment:C,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})})]},C.id)}),k.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: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(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:M,children:E},"installment-table")}):E})}function Dn(e){return e.name?.trim()||e.id}function En(e,n,a){return!ct(e.status)||!e.fulfilledAt?null:`${n} ${Kt(e.fulfilledAt,a)}`}function ni(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function Fn(e,n,a){const s=ni(e);return s===null?null:`${n} ${a.format(s)}`}function Ln(e,n){return e==="partially_refunded"?n:ti[e]??e}function Ns({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",ws[e]??ws.scheduled),startContent:t.jsx(Ju,{status:e}),children:n})}function Cs({status:e,installment:n,labels:a,portalContainer:s,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e),u=ct(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(V,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(I,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:a.payNow}):null,t.jsx(Xu,{isFulfilled:u,showDelete:r,labels:a,portalContainer:s,onDelete:()=>o(n.id)})]})}function Xu({isFulfilled:e,showDelete:n,labels:a,portalContainer:s,onDelete:r}){const[i,l]=p.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(V,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(I,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:a.sendLink,description:a.sendLinkDescription,startContent:t.jsx(I,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:a.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:a.dangerZone,children:t.jsx(c.DropdownItem,{textValue:a.deleteInstallment,className:"text-danger-600",color:"danger",description:a.deleteInstallmentDescription,startContent:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:a.deleteInstallment},"delete")}):null]})]}),n?t.jsx(ja,{isOpen:i,labels:{title:a.deleteInstallmentConfirmationTitle,description:a.deleteInstallmentConfirmationDescription,cancel:a.deleteInstallmentConfirmationCancel,confirm:a.deleteInstallmentConfirmationConfirm},icon:t.jsx(I,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:s,shouldBlockScroll:!1,classNames:Ku,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Ju({status:e}){return e==="paid"?t.jsx(I,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(I,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(I,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(I,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(I,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(I,{icon:"solar:calendar-outline",className:"size-3"})}const em=/^\d{4}-\d{2}-\d{2}$/;function Kt(e,n){const a=em.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(a)}const tm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},nm=({cards:e,locale:n,currency:a,listHeightClassName:s="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const h=Array.isArray(e)?e:[],[x,b]=p.useState(o),[j,g]=p.useState(l),w={...tm,...r};p.useEffect(()=>{b(o)},[o]);const N=v=>{if(v===x){d&&f?.(v);return}b(v),f?.(v)},S=v=>{g(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(ii,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",s===""?"flex-1":c.cn("shrink-0",s)),"data-testid":"membership-select-cards-list",children:h.map(v=>t.jsx(ai,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:a,isSelected:x===v.id,onSelect:N},v.id))})]})},ai=({itemKey:e,name:n,type:a,price:s,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:h,statusTone:x="default",className:b=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(s),g=!!d&&!f,w=m||h,N=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),a&&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:a})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},ks="w-full bg-gray-100",Ss={variant:"light",color:"default"},si=({id:e,title:n,media:a,imageUrl:s,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:h=!1,isDisabled:x=!1,compact:b=!1,className:j="",bodyClassName:g="",footerClassName:w="",dataTestId:N})=>{const S=!!(d&&d.value),v=!!u?.label,D=h&&!!m&&!v,M=!D,k=v?{variant:u?.variant??Ss.variant,color:u?.color??Ss.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(I,{icon:u.icon,width:16}):void 0}:null,E=a??(s?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,ks,i),children:t.jsx(c.Image,{removeWrapper:!0,src:s,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,ks,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(I,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",j),isPressable:D,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:E}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:n}),o.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:o.map((C,R)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(I,{icon:C.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:C.label})]},`${C.label}-${R}`))}):null,(S||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",w),children:[S?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}),v&&M?t.jsx(V,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:k?.variant,color:k?.color,size:k?.size,startContent:k?.startContent,isDisabled:k?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};si.displayName="CatalogItemCard";const am={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},sm={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},rm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},im={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},lm={card:"mt-1",panel:"mt-[22px]"},om="bg-acct-page border-acct-border text-acct-muted",cm={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},dm={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"},um={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"},mm={empty:"status",error:"alert",success:"status",loading:"status"},fm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function xm(e,n,a,s){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:s.spinner});if(p.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:cm[e];return r?t.jsx(I,{icon:r,width:a,height:a,"aria-hidden":"true",className:s.icon}):null}function bt({variant:e="empty",surface:n="card",title:a,titleAs:s="p",description:r,icon:i,actions:l,role:o=mm[e],ariaLive:d=fm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":h="feedback-state"}){const x=xm(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":h,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",am[n],n==="card"?dm[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn("inline-flex items-center justify-center",sm[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?om:um[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(s,{"data-testid":`${h}-title`,className:c.cn(rm[n],m.title),children:a}),r?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(im[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${h}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",lm[n],m.actions),children:l}):null]})}function wa(e){return t.jsx(bt,{...e,variant:"empty"})}function Na(e){return t.jsx(bt,{...e,variant:"error"})}function Ca(e){return t.jsx(bt,{...e,variant:"loading"})}function ri(e){return t.jsx(bt,{...e,variant:"success"})}bt.displayName="FeedbackState";wa.displayName="EmptyState";Na.displayName="ErrorState";Ca.displayName="LoadingState";ri.displayName="SuccessState";const ii=({title:e,value:n,description:a,onValueChange:s,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||a?"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}),a&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:a})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:s,"data-testid":"toggle-switch"})]})},hm={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"},pm=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),li=e=>Object.values(e).reduce((n,a)=>n+Object.values(a).reduce((s,r)=>s+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),gm=e=>e.reduce((n,a)=>n+a.dates.reduce((s,r)=>s+r.tickets.reduce((i,l)=>i+l.max,0),0),0),ka=e=>e.flatMap(n=>n.dates.flatMap(a=>a.tickets.map(s=>({exhibition:n,dateGroup:a,ticket:s})))),$s=(e,n,a)=>{const s={};let r=a?n??gm(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of ka(e)){s[i.id]??={},s[i.id][l.id]??={};const d=a?Math.min(o.max,r):0;s[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return s},As=(e,n,a)=>`${e}::${n}::${a}`,bm=(e,n,a)=>{const s=li(n);for(const{exhibition:r,dateGroup:i,ticket:l}of ka(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=a===void 0?l.max:Math.min(l.max,a-(s-o));if(d>0&&o<d)return!1}return!0},ym=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:a=10,onChange:s,disabled:r=!1})=>{const i=Math.max(n,Math.min(a,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=a||s?.(i+1)},h=()=>{r||i<=n||s?.(i-1)},x=v=>{if(r)return;o(v.target.value);const D=parseInt(v.target.value,10);isNaN(D)||s?.(Math.max(n,Math.min(a,D)))},b=v=>{const D=parseInt(v.target.value,10);if(u(!1),isNaN(D)){s?.(n);return}const M=Math.max(n,Math.min(a,D));M!==D?s?.(M):o(String(M))},j=i<=n,g=i>=a,w="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",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:h,disabled:r||j,className:c.cn(w,r||j?S:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:a,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||g,className:c.cn(w,r||g?S:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},vm=({label:e,checked:n=!1,onChange:a,disabled:s=!1})=>{const r=()=>{s||a?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:s,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",s&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:s,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},jm=({item:e,quantity:n,onChange:a,getTotalSelectedTickets:s,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!s||r===void 0)return e.max;const m=s();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=pm(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(ym,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:a})]}),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]})},wm=({exhibitionId:e,dateGroup:n,isLast:a=!1,onQuantityChange:s,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!a&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(jm,{item:u,quantity:r(e,n.id,u.id),onChange:m=>s(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Nm=({title:e,exhibition:n,onQuantityChange:a,getTicketQuantity:s,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=n.dates.reduce((x,b)=>x+b.tickets.reduce((j,g)=>j+s(n.id,b.id,g.id),0),0),h=n.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(I,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:h?n.dates.map((x,b)=>t.jsx(wm,{exhibitionId:n.id,dateGroup:x,isLast:b===n.dates.length-1,onQuantityChange:a,getTicketQuantity:s,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},Cm=({initialExpanded:e=!1,userMaxLimit:n,labels:a,settings:s,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...hm,...a},[u,f]=p.useState(()=>$s(o,n,!0)),m=p.useRef(!1),h=p.useMemo(()=>{const N=ka(o).map(({exhibition:S,dateGroup:v,ticket:D})=>[As(S.id,v.id,D.id),D]);return new Map(N)},[o]),x=bm(o,u,n),b=(N,S,v)=>u[N]?.[S]?.[v]?.selectedQuantity??0,j=()=>li(u),g=(N,S,v,D)=>{const M=b(N,S,v),k=j()-M;if(n!==void 0&&k+D>n)return;const E=h.get(As(N,S,v));if(!E)return;const C={...u,[N]:{...u[N],[S]:{...u[N]?.[S],[v]:{id:v,selectedQuantity:D,originalPrice:E.originalPrice,discountedPrice:E.price}}}};f(C),l?.(C)},w=N=>{const S=$s(o,n,N);f(S),l?.(S)};return p.useEffect(()=>{!m.current&&x&&(l?.(u),m.current=!0)},[x,u,l]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(vm,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),o.map(N=>t.jsx(Nm,{title:N.exhibitionName,exhibition:N,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:j,userMaxLimit:n,settings:s,labels:d,initialExpanded:e},N.id))]})},Mn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},_n=e=>{const n={};for(const a of e)a.type==="checkbox"?n[a.id]=[...a.selectedValues]:n[a.id]=a.selectedValue?[a.selectedValue]:[];return n},km=(e,n)=>{const a={};for(const s of n){if(s.type==="checkbox"){a[s.id]=e[s.id]??[...s.selectedValues];continue}const r=e[s.id]??[];a[s.id]=r.length>0?r[0]:null}return a},Sm=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,oi=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:a="solar:tuning-square-outline",triggerVariant:s="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:h,countAriaLabel:x,countDisplay:b="badge",confirmLabel:j=Mn.confirm,clearLabel:g=Mn.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:S,isDisabled:v=!1,closeOnConfirm:D=!0,keepOpenAfterClear:M=!1})=>{const[k,E]=p.useState(N),[C,R]=p.useState(()=>_n(u)),A=w??k,F=h??u.filter(W=>Sm(W)).length,_=W=>{W&&R(_n(u)),w||E(W),S?.(W)},T=(W,X)=>{R(Z=>({...Z,[W.id]:X}))},q=(W,X)=>{R(Z=>({...Z,[W.id]:X?[X]:[]}))},B=async()=>{R(_n(u.map(W=>W.type==="checkbox"?{...W,selectedValues:[]}:{...W,selectedValue:null}))),await m(),M||_(!1)},U=async()=>{const W=km(C,u);await f(W),D&&_(!1)},K=W=>{if(W.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:W.label,value:C[W.id]??[],onValueChange:Z=>T(W,Z),children:W.options.map(Z=>t.jsx(c.Checkbox,{value:Z.value,isDisabled:Z.isDisabled,children:Z.label},Z.value))},W.id);const X=C[W.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:W.label,value:X,onValueChange:Z=>q(W,Z||null),children:W.options.map(Z=>t.jsx(c.Radio,{value:Z.value,isDisabled:Z.isDisabled,children:Z.label},Z.value))},W.id)},Q=p.useMemo(()=>F>0?x?.(F)||`${F} filters applied`:void 0,[x,F]),le=p.useMemo(()=>F===0?e||Mn.noLabel:x?x(F):`${e} (${F})`,[F,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:A,onOpenChange:_,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(V,{isDisabled:v,variant:s,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":A,children:[t.jsx(I,{icon:a,width:16}),t.jsx("span",{children:e}),b==="badge"&&F>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:F}):b==="summary"&&le!==e?t.jsx("span",{className:"text-xs",children:le}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(W=>K(W)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(V,{variant:"light",color:"default",size:"sm",onPress:B,children:g}),t.jsx(V,{color:"primary",size:"sm",onPress:U,children:j})]})]})})]})})};oi.displayName="FilterPopover";const $m="No sessions available for this date",Am=e=>e==="sold-out"||e==="closed"?"danger":"success",Dm=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},Ds=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Em=(e,n)=>n&&e.some(a=>a.date===n)?n:e[0]?.date??null,ci=({heading:e,subheading:n,days:a,selectedDate:s,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=$m,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:h,calendarSlot:x,dayGroupAriaLabel:b,sessionGridAriaLabel:j,className:g,headingClassName:w,subheadingClassName:N})=>{const S=Em(a,s),v=a.find(C=>C.date===S),D=i??a.map(C=>({date:C.date,label:C.label})),M=v?.sessions??[],k=C=>C===S?"solid":"bordered",E=C=>{if(!Ds(C)){if(C.id===l){o(null);return}o(C.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",g),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",w),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[D.map(C=>t.jsx(V,{size:"sm",variant:k(C.date),color:"default",className:c.cn("rounded-full",h),isDisabled:C.isDisabled,onPress:()=>{r(C.date)},children:t.jsx("span",{children:C.label})},C.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[M.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,M.map(C=>{const R=Ds(C),A=C.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!R,onPress:()=>{E(C)},"aria-disabled":R,"aria-pressed":R?void 0:A,className:c.cn("w-full",R?"bg-gray-100 opacity-70":"",A?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(C,{isSelected:A,isUnavailable:R}):R?`${C.startTime} ${C.endTime} sold out`:`${C.startTime} ${C.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:[C.startTime," – ",C.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(C):Am(C.status),variant:"flat",children:u?u(C):Dm(C)})]})})},C.id)})]})]})};ci.displayName="SessionTimeline";const Zn=16,Qe=e=>`${e/Zn}rem`;function Fm(){if(typeof document>"u"||typeof getComputedStyle!="function")return Zn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Zn}const Rt=(e,n)=>e>=n*Fm(),Lm=1120;function yt(){const e=p.useRef(null),[n,a]=p.useState(0),[,s]=p.useState("");return p.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{const o=l[l.length-1];o&&a(o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width)});return a(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),p.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>s(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:n}}const Mm=48,Oe={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"},_m=(e,n)=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,di=({title:e,subtitle:n,eyebrow:a,icon:s,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:h})=>{const x=_m(s,r);return t.jsxs("header",{ref:h,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Oe.base,m?Oe.baseNarrow:Oe.baseWide):"flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:f?Oe.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Oe.text:void 0,children:[a?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:a}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn(f?m?Oe.titleNarrow:Oe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Oe.subtitleNarrow:Oe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Oe.actionsNarrow:Oe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Rm=e=>{const{ref:n,width:a}=yt(),s=a>0&&!Rt(a,Mm);return t.jsx(di,{...e,list:!0,narrow:s,headerRef:n})},ui=e=>e.variant==="list"?t.jsx(Rm,{...e}):t.jsx(di,{...e,list:!1,narrow:!1});ui.displayName="PageHeader";const qe={ok:{fg:je.ok,bg:je["ok-fill"]},warn:{fg:je.warn,bg:je["warn-fill"]},danger:{fg:je.danger,bg:je["danger-fill"]},info:{fg:je.info,bg:je["info-fill"]},violet:{fg:je.violet,bg:je["violet-fill"]},neutral:{fg:je.neutral,bg:je["neutral-fill"]}};function Tt(e){if(e==="positive")return{color:je.ok};if(e==="negative")return{color:je.danger}}const Tm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Xn={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:qe.info,violet:qe.violet},Pm={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Im={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]"},Om={info:Xn.info,violet:Xn.violet},mi=({status:e,label:n,variant:a="flat",size:s="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(a==="plain"){const u=qe[Pm[e]];return t.jsxs("span",{"data-testid":o,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Im[s],"leading-[1.35]",l),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(a==="dot"){const u=Xn[e];return t.jsxs("span",{"data-testid":o,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",l),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}const d=r?void 0:Om[e];return t.jsx(c.Chip,{color:r??Tm[e],variant:a,size:s,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:n})};mi.displayName="StatusChip";const zm={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"},Vt={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"},Sa=({label:e,value:n,size:a="sm",variant:s="default",className:r,"data-testid":i="key-value-chip"})=>s==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(Vt.base,Vt[a],r),children:[t.jsx("span",{className:Vt.label,children:e}),t.jsx("span",{className:Vt.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",zm[a],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Sa.displayName="KeyValueChip";const fi="(prefers-reduced-motion: reduce)",xi="data-pos-reduce-motion",Pt="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Bm="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",Qt=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Bm}`;function Vm(){return typeof document>"u"?!1:document.documentElement.getAttribute(xi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(fi).matches}function Um(){const[e,n]=p.useState(!1);return p.useEffect(()=>{const a=()=>n(Vm()),s=typeof window.matchMedia=="function"?window.matchMedia(fi):null;s?.addEventListener?.("change",a);const r=typeof MutationObserver>"u"?null:new MutationObserver(a);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[xi]}),a(),()=>{s?.removeEventListener?.("change",a),r?.disconnect()}},[]),e}const hi=({columns:e,rows:n=6,label:a="Loading",barHeight:s=12,alignLastRight:r=!1,appearance:i="pulse",className:l,classNames:o={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",l,o.base),children:[t.jsx("span",{className:"sr-only",children:a}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(Qt,o.bar),style:{height:Qe(s),width:m==="fill"?"60%":Qe(m),maxWidth:"100%"}})},h)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:s,width:m==="fill"?"60%":m}})},h)})},f))})]});hi.displayName="TableSkeleton";const pi="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",gi="px-4 text-[13.5px] text-acct-ink2 align-middle",bi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",yi="w-full",vi="border-t border-acct-border px-5 py-3.5",Ut={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 ${Pt}`,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"},ji=({columns:e,children:n,emptyContent:a,footer:s,ariaLabel:r,variant:i="default",className:l,classNames:o={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&Ut.base,l,o.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(yi,o.table),th:c.cn(u?Ut.th:pi,o.th),tr:c.cn(u?Ut.tr:bi,o.tr),td:c.cn(u?Ut.td:gi,o.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:a,children:n})]}),s?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&vi,o.footer),children:s}):null]})};ji.displayName="AdminTable";const Hm={md:"w-[280px]",lg:"w-[360px]"},qm=48,ze={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[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",searchNarrow:"basis-full",inputBaseMd:"w-[15.625rem]",inputBaseLg:"w-[22.5rem]",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.4375rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0",icon:"flex text-default-400 [&_svg]:size-4"},Wm=({searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>{const{ref:f,width:m}=yt(),h=m>0&&!Rt(m,qm);return t.jsxs("div",{ref:f,role:"search","data-testid":u,"data-variant":"framed","data-size":h?"narrow":"wide",className:c.cn(ze.base,h&&ze.narrow,d),children:[i,t.jsx("div",{"data-testid":`${u}-search-slot`,className:h?ze.searchNarrow:ze.searchWide,children:t.jsx(c.Input,{type:"search","aria-label":a,placeholder:s??a,value:e,onValueChange:n,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-search-icon`,className:ze.icon,children:r??t.jsx(I,{icon:"lucide:search"})}),"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:h?ze.inputBaseNarrow:o==="lg"?ze.inputBaseLg:ze.inputBaseMd,inputWrapper:ze.inputWrapper,innerWrapper:ze.innerWrapper,input:ze.input}})}),l]})},wi=({searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,children:i,trailing:l,searchWidth:o="md",variant:d="default",className:u,"data-testid":f="admin-toolbar"})=>d==="framed"?t.jsx(Wm,{searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,trailing:l,searchWidth:o,className:u,"data-testid":f,children:i}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn("flex flex-wrap items-center gap-3 mb-4",u),children:[t.jsx(c.Input,{type:"search","aria-label":a,placeholder:s??a,value:e,onValueChange:n,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${f}-search`,variant:"bordered",radius:"none",classNames:{base:Hm[o],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"}}),i,l?t.jsx("div",{className:"ml-auto",children:l}):null]});wi.displayName="AdminToolbar";const Ym="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",Gm="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",Km="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",Ni=p.forwardRef(function({icon:n,children:a,count:s,appearance:r="pill",className:i,testId:l,...o},d){return r==="outline"?t.jsxs(V,{ref:d,"data-testid":l,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...o,children:[t.jsx(I,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:a}),s!==void 0&&s>0&&t.jsx("span",{className:Gm,children:s})]}):t.jsxs(V,{ref:d,"data-testid":l,variant:"light",size:"sm",className:c.cn(Km,i),...o,children:[t.jsx(I,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:a}),s!==void 0&&s>0&&t.jsx("span",{className:Ym,children:s})]})});Ni.displayName="ToolbarButton";function Ci({items:e,value:n,onChange:a,ariaLabel:s,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":s,variant:"underlined",selectedKey:n,onSelectionChange:l=>a(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Ci.displayName="UnderlineTabs";const $a="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Aa="font-normal normal-case tracking-normal",ki=["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(" "),Si="text-[13.5px] text-acct-ink",$i="bg-acct-page text-acct-muted cursor-default",Ai="mt-[5px] text-xs text-acct-sub",Di="mt-[5px] text-xs text-acct-danger",Ei=({children:e,suffix:n,className:a,"data-testid":s="admin-field-label"})=>t.jsxs("div",{"data-testid":s,className:c.cn($a,a),children:[e,n?t.jsxs("span",{className:Aa,children:[" ",n]}):null]});Ei.displayName="AdminFieldLabel";const Fi=({label:e,labelSuffix:n,value:a,onChange:s,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":h="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Aa,children:[" ",n]})]}):e,value:a,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:s,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:$a,inputWrapper:ki,input:c.cn(Si,(o||l)&&"font-mono",l&&$i),description:Ai,errorMessage:Di}});Fi.displayName="AdminTextField";const Qm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Li=({actions:e,size:n="md",className:a,"data-testid":s="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":s,className:c.cn("inline-flex gap-0.5",a),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(V,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${s}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Qm[n]),children:r.icon},r.key))});Li.displayName="RowActions";const Mi=({children:e,placeholder:n="Select…",onOpen:a,onClear:s,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(V,{variant:"light",radius:"none",disableAnimation:!0,onPress:a,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&s?t.jsx(V,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:s,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Mi.displayName="PickerRow";function _i(e,n,a){if(a<=0||n<=0||e<=0)return{from:0,to:0};const s=(e-1)*n+1;return s>a?{from:0,to:0}:{from:s,to:Math.min(a,e*n)}}const Ri=({page:e,pageSize:n,total:a,unit:s,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=_i(e,n,a),f=c.cn("font-semibold text-default-700",l.emphasis);return t.jsxs("p",{"data-testid":o,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:f,children:a}),s?t.jsxs(t.Fragment,{children:[" ",s]}):null]})};Ri.displayName="PaginationSummary";const fn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Ke={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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"},Zm={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]"},Xm={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:""}},Ti=({isLoading:e=!1,isError:n=!1,isEmpty:a=!1,loadingTitle:s="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:h,emptyIcon:x,emptyActions:b,emptyContent:j,children:g,toolbar:w,variant:N="default",className:S,classNames:v={},"data-testid":D="list-panel"})=>{const M=N==="framed",k={base:c.cn("border-0 bg-transparent py-12",v.state)},E=M?{base:c.cn("px-6 py-[3.625rem]",v.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:k;let C;return e?C=r??t.jsx(Ca,{title:s,classNames:k,"data-testid":`${D}-loading`}):n?C=f??t.jsx(Na,{title:i,description:l,classNames:k,"data-testid":`${D}-error`,actions:u??(d?t.jsx(V,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):a?C=j??t.jsx(wa,{surface:M?"panel":void 0,title:m,description:h,icon:x,actions:b,classNames:E,"data-testid":`${D}-empty`}):C=g,t.jsxs("section",{"data-testid":D,"data-variant":M?"framed":void 0,className:c.cn(M?`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`:"rounded-xl bg-white p-2 shadow-sm",S,v.base),children:[w,C]})};Ti.displayName="ListPanel";const Pi=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),sn=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},Ii=(e,n)=>{const[a,s]=p.useState(()=>n(e)),r=(sn(a)??0)===(e??0)?a:n(e),i=p.useCallback(()=>{s(l=>{const o=sn(l);return o===null?"":String(o)})},[]);return{draft:r,setDraft:s,normalize:i}},Jm=350,ef={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}"},Rn=(e,n)=>Object.entries(n).reduce((a,[s,r])=>a.replace(`{${s}}`,r),e),tf=({dueAmount:e,received:n,defaultReceived:a=null,onChange:s,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...ef,...i},h=Mt(e.currency,r),x=n!==void 0,[b,j]=p.useState(a??null),g=x?n:b,{draft:w,setDraft:N,normalize:S}=Ii(g,q=>q==null?"":String(q)),v=p.useMemo(()=>{const q=typeof g=="number"&&Number.isFinite(g)?g:0,B=qn(q,e.value,e.currency,r);return{received:q,change:B>0?B:0,isValid:q>=e.value&&q>0}},[g,e.value,e.currency,r]),D=p.useCallback(q=>{const B=q.currentTarget;requestAnimationFrame(()=>{B.isConnected&&B.select()})},[]),M=p.useCallback(q=>{if(l)return;const B=q.replace(/[^\d.,]/g,"");if(!Pi(B,h))return;const U=sn(B);if(U!==null&&o!==void 0&&U>o)return;N(B),x||j(U);const K=typeof U=="number"&&Number.isFinite(U)?U:0,Q=qn(K,e.value,e.currency,r);s?.({received:K,change:Q>0?Q:0,isValid:K>=e.value&&K>0})},[x,l,e.value,e.currency,r,s,o,N,h]),k=v.isValid&&v.change>0,E=!v.isValid&&v.received>0,C=ge(v.change,r,e.currency),R=ge(e.value,r,e.currency),[A,F]=p.useState(""),_=p.useRef(null);p.useEffect(()=>{_.current&&clearTimeout(_.current);const q=k?Rn(m.changeMessageTemplate,{change:C}):"",B=k?Jm:0;return _.current=setTimeout(()=>F(q),B),()=>{_.current&&clearTimeout(_.current)}},[k,C,m.changeMessageTemplate]);const T=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:T,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:h===0?"numeric":"decimal",pattern:h===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:q=>M(q.target.value),onFocus:D,onBlur:S,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:E,errorMessage:E?Rn(m.insufficientMessageTemplate,{due:R}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),k&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:Rn(m.changeMessageTemplate,{change:C}),icon:t.jsx(I,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:A})]})},nf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Es=()=>{const e=new Date,n=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Oi=({dueAmount:e,value:n,defaultValue:a,onChange:s,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":h="check-tender-form"})=>{const x={...nf,...r},b=n!==void 0,[j,g]=p.useState({checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??Es()}),[w,N]=p.useState(!!a?.checkNumber),S=p.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Es()}:j,[b,n,j]),v=p.useCallback(A=>{b||g(A);const F=A.checkNumber.trim(),_={amount:e.value,checkNumber:F,bankName:A.bankName.trim()||void 0,date:i?void 0:A.date,isValid:F.length>0&&e.value>0};s?.(_)},[b,e.value,i,s]),D=p.useCallback(A=>F=>{o||(A==="checkNumber"&&F.length>0&&N(!0),v({...S,[A]:F}))},[S,v,o]),M=p.useCallback(()=>{o||N(!0)},[o]),k=w&&S.checkNumber.trim()==="",E=`${h}-check-number`,C=`${h}-bank-name`,R=`${h}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":h,children:[t.jsx(c.Input,{id:E,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:A=>D("checkNumber")(A.target.value),onBlur:M,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:k,errorMessage:k?x.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${h}-check-number-input`}),!l&&t.jsx(c.Input,{id:C,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:A=>D("bankName")(A.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-bank-name-input`}),!i&&t.jsx(c.Input,{id:R,label:x.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:A=>D("date")(A.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-date-input`,className:"sm:col-span-2"})]})};Oi.displayName="CheckTenderForm";const af={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},sf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],zi=({dueAmount:e,methodOptions:n=sf,value:a,defaultValue:s,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...af,...i},m=a!==void 0,[h,x]=p.useState({method:s?.method??"",reference:s?.reference??""}),b=p.useMemo(()=>m?{method:a?.method??"",reference:a?.reference??""}:h,[m,a,h]),j=p.useCallback(D=>n.find(M=>M.value===D)?.label??"",[n]),g=p.useCallback(D=>{m||x(D);const M=j(D.method),k={amount:e.value,method:D.method,description:M,reference:D.reference.trim()||void 0,isValid:D.method!==""};r?.(k)},[m,e.value,r,j]),w=p.useCallback(D=>{if(o)return;const M=typeof D=="string"?D:Array.from(D)[0]?.toString()??"";g({...b,method:M})},[b,g,o]),N=p.useCallback(D=>{o||g({...b,reference:D})},[b,g,o]),S=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(He,{id:S,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:w,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(D=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${D.value}`,children:D.label},D.value))}),l&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:D=>N(D.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};zi.displayName="OtherTenderForm";const rf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},lf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},of={pending:"warning",recorded:"success",failed:"danger"},cf=e=>e==="pending"||e==="recorded",df=e=>`#${e+1}`,Bi=({total:e,tenders:n,onRemove:a,locale:s="en-US",labels:r,hideCollectedList:i=!1,variant:l="banner",className:o,"data-testid":d="split-payment-summary"})=>{const u={...rf,...r},{collected:f,remaining:m,isComplete:h}=p.useMemo(()=>{const b=n.reduce((g,w)=>cf(w.status)?g+w.amount:g,0),j=Math.max(e.value-b,0);return{collected:b,remaining:j,isComplete:b>=e.value&&e.value>0}},[n,e.value]),x=b=>b==="pending"?u.statusPending:b==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",o),"data-testid":d,children:[l==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:h?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?f:m,s,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:h?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:ge(h?f:m,s,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),n.map((b,j)=>t.jsx(uf,{index:j,tender:b,locale:s,currency:e.currency,removable:!!a&&b.status!=="recorded",onRemove:a?()=>a(b.id):void 0,statusLabel:x(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},b.id))]})]})};Bi.displayName="SplitPaymentSummary";const uf=({index:e,tender:n,locale:a,currency:s,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(V,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(I,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:df(e)}),t.jsx(I,{icon:lf[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:ge(n.amount,a,s)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:of[n.status],startContent:n.status==="recorded"?t.jsx(I,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(I,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},mf=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(K.ZoomIn,{size:16})})})]})}function od({editor:e,isDisabled:n=!1}){const[a,s]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=x=>{if(x){const{from:b,to:j}=e.state.selection,g=e.isActive("link");let w="";if(g){const S=e.schema.marks.link,v=e.state.doc.resolve(b),D=Oa.getMarkRange(v,S);D&&(w=e.state.doc.textBetween(D.from,D.to,""))}else w=e.state.doc.textBetween(b,j,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(g)}s(x)},h=()=>{if(l.trim()){const{from:x,to:b}=e.state.selection,j=e.schema.marks.link,g=e.state.doc.resolve(x),w=Oa.getMarkRange(g,j),N=w?.from??x,S=w?.to??b,v=e.state.doc.textBetween(N,S,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:S}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}s(!1)};return t.jsxs(c.Popover,{isOpen:a,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(K.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:x=>i(x.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:x=>o(x.target.value),onKeyDown:x=>x.key==="Enter"&&h(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(B,{size:"sm",color:"primary",onPress:h,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function cd({children:e,id:n,label:a,className:s,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":a,className:s,children:e}):t.jsx("div",{id:n,role:"group","aria-label":a,className:`flex items-center gap-2 ${s||""}`,children:e})}function kr(e,n){const a=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>Lt(o)))).forEach(o=>{const d=Xe[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[s,r]=p.useState(a);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>Lt(d)))).forEach(d=>{const u=Xe[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,a]),s}function Sr(e,n){const a=p.useCallback((l,o)=>{if(!e)return;const d=Xe[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),s=p.useCallback(l=>{a(l)},[a]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=p.useCallback((l,o)=>{if(!e)return!1;const d=Xe[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:a,toggleModifier:s,canExecute:r,isActive:i}}function dd(e=Ce.default){const[n,a]=p.useState(e),s=p.useCallback((o=Ce.step)=>{a(d=>Math.min(Ce.max,d+o))},[]),r=p.useCallback((o=Ce.step)=>{a(d=>Math.max(Ce.min,d-o))},[]),i=p.useCallback(()=>{a(Ce.default)},[]),l=p.useCallback(o=>{const d=Math.max(Ce.min,Math.min(Ce.max,o));a(d)},[]);return{zoom:n,setZoom:l,zoomIn:s,zoomOut:r,resetZoom:i,isMinZoom:n<=Ce.min,isMaxZoom:n>=Ce.max,isDefaultZoom:n===Ce.default}}const ud=["bold","italic","strike","underline","code"];function md({editor:e,modifiers:n,onToolbarAction:a}){const s=kr(e,n),{toggleModifier:r}=Sr(e,a);if(!e)return null;const i=n.map(l=>Lt(l)).filter(l=>ud.includes(l));return i.length===0?null:t.jsx(cd,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=s[l],d=xt(l);return t.jsx(lt,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function fd({editor:e,modifiers:n,zoom:a=100,onZoomChange:s,sticky:r=!0,className:i,onToolbarAction:l}){const o=kr(e,n),{toggleModifier:d,executeCommand:u}=Sr(e,l);if(!e)return null;const f=n.map(C=>Lt(C)),m=f.some(C=>["bold","italic","strike","underline","code"].includes(C)),h=f.some(C=>["textColor","highlight"].includes(C)),x=f.includes("heading"),b=f.includes("textAlign"),j=f.some(C=>["bulletList","orderedList","taskList"].includes(C)),g=f.includes("blockquote"),w=f.includes("codeBlock"),N=f.includes("link"),S=f.includes("horizontalRule"),v=f.some(C=>["undo","redo"].includes(C)),D=a!==void 0&&s!==void 0,M=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${M} ${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(md,{editor:e,modifiers:n,onToolbarAction:l}),(h||x||b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(is,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(is,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(x||b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsx(Jc,{editor:e}),(b||j||g||w||N||S||v||D)&&t.jsx(it,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(C=>{const E=rd[C],k=e.isActive({textAlign:C});return t.jsx(lt,{icon:E,label:`Align ${C}`,isActive:k,onClick:()=>u("textAlign",{type:"textAlign",alignment:C})},C)})}),(j||g||w||N||S||v||D)&&t.jsx(it,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(ed,{editor:e,types:f.filter(C=>["bulletList","orderedList","taskList"].includes(C))}),(g||w||N||S||v||D)&&t.jsx(it,{})]}),(g||w||N||S)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(lt,{icon:xt("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(lt,{icon:xt("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(od,{editor:e,isDisabled:o.link?.isDisabled}),S&&t.jsx(lt,{icon:xt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||D)&&t.jsx(it,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(lt,{icon:xt("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(lt,{icon:xt("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),D&&t.jsx(it,{})]}),D&&t.jsx(ld,{zoom:a,onZoomChange:C=>{s?.(C),l?.({type:"zoom",modifier:`${C}%`})}})]})})}const wt={bold:{category:"mark",extension:Ol.Bold,priority:100},italic:{category:"mark",extension:zl.Italic,priority:100},strike:{category:"mark",extension:Bl.Strike,priority:100},underline:{category:"mark",extension:Vl.Underline,priority:100},code:{category:"mark",extension:Ul.Code,priority:100},textColor:{category:"mark",extension:Hl.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:ql.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Wl.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Gl.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ql.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Zl.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Xl.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:to.CodeBlock,priority:100},blockquote:{category:"node",extension:no.Blockquote,priority:100},horizontalRule:{category:"node",extension:ao.HorizontalRule,priority:100},hardBreak:{category:"node",extension:so.HardBreak,priority:100},undo:{category:"extension",extension:za.History,priority:50},redo:{category:"extension",extension:za.History,priority:50},textAlign:{category:"extension",extension:ro.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}},xd=[io.Document,lo.Text,Kl.Paragraph,Yl.TextStyle.configure({HTMLAttributes:{}}),eo.ListItem.configure({HTMLAttributes:{}}),Jl.TaskItem.configure({nested:!0}),oo.Dropcursor,co.Gapcursor];function hd(e){const n=[],a=new Set,s=new Set;xd.forEach(o=>{o&&(n.push(o),s.add(o.name))});const r=e.map(o=>Lt(o)),i=new Set;return r.forEach(o=>{const d=wt[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(a.has(o))return;const d=wt[o];if(!d||d.extension===null)return;const u=d.extension.name;if(s.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),a.add(o),s.add(u)}),r.forEach(o=>{if(a.has(o))return;const d=wt[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){a.add(o);return}const u=d.extension.name;if(s.has(u)){a.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),a.add(o),s.add(u)}),n.sort((o,d)=>{const u=Object.values(wt).find(x=>x?.extension?.name===o.name),f=Object.values(wt).find(x=>x?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const $r={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"]},pd={h1:`font-size: ${fe.fontSize["4xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h2:`font-size: ${fe.fontSize["2xl"]}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h3:`font-size: ${fe.fontSize.xl}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h4:`font-size: ${fe.fontSize.lg}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h5:`font-size: ${fe.fontSize.base}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,h6:`font-size: ${fe.fontSize.sm}; font-weight: ${fe.fontWeight.semibold}; line-height: ${fe.lineHeight.tight}; margin: ${de.md} 0 ${de.sm} 0;`,p:`min-height: ${fe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${de.xl}; margin: ${de.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${de.xl}; margin: ${de.md} 0;`,li:`display: list-item; margin: ${de.xs} 0;`,strong:`font-weight: ${fe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${we.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${fe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${fe.fontFamily.mono};`,pre:`background: ${we.neutral.gray[800]}; border-radius: ${de.sm}; color: ${we.neutral.gray[100]}; font-family: ${fe.fontFamily.mono}; margin: ${de.lg} 0; padding: 0.75rem ${de.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${we.neutral.gray[300]}; margin: ${de.lg} 0; padding-left: ${de.md}; color: ${we.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${we.neutral.gray[200]}; margin: ${de.xl} 0;`,a:`color: ${we.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${we.palettes.warning[200]}; border-radius: ${de.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${de.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},gd={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 bd(e){if(!e)return e;let n=e;for(const[a,s]of Object.entries(gd)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${a}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${s}"`):`${l} style="${s}">`)}for(const[a,s]of Object.entries(pd)){const r=new RegExp(`<${a}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${s}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${s}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${s}"${i.slice(l)}`}})}return n}const yd=({modifiers:e,zoom:n,onZoomChange:a,onToolbarAction:s})=>{const{editor:r}=na.useCurrentEditor();return t.jsx(fd,{editor:r,modifiers:e,zoom:n,onZoomChange:a,onToolbarAction:s})},vd=({showCharacterCount:e,showWordCount:n})=>{const{editor:a}=na.useCurrentEditor();if(!a||!e&&!n)return null;const s=a.getText(),r=s.length,i=s.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},Wn=p.forwardRef((e,n)=>{const{minRows:a=10,maxRows:s=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=$r.full,variant:u="bordered",initialContent:f,content:m,onContentChange:h,onUpdate:x,onToolbarAction:b,isReadOnly:j=!1,isDisabled:g=!1,includeInlineStyles:w=!0,...N}=e,{zoom:S,setZoom:v}=dd(),D=rs.lineHeight,M=a*D,C=r?void 0:s*D,E=p.useMemo(()=>hd(d),[d]),{Component:k,label:_,shouldLabelBeOutside:A,getBaseProps:F,getLabelProps:R,getInputWrapperProps:P}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),q=_?t.jsx("label",{...R(),children:_}):null,z=p.useCallback(({editor:V})=>{const X=V.getHTML(),W=w?bd(X):X,ae=V.getJSON(),Y=V.getText(),Q=Y.length,Z=Y.split(/\s+/).filter(ce=>ce.length>0).length,te={html:W,json:ae,text:Y,characters:Q,words:Z};if(h?.(te),x?.(te),"onChange"in N&&typeof N.onChange=="function"){const ce={target:{value:W},currentTarget:{value:W}};N.onChange(ce)}},[h,x,N,w]);return t.jsxs(k,{...F(),children:[A?q:null,t.jsx("div",{...P(),className:c.cn(P().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:C?`${C+rs.toolbarHeight}px`:void 0,overflow:C?"auto":void 0},children:t.jsx(na.EditorProvider,{editable:!j&&!g,slotBefore:o?t.jsx(yd,{modifiers:d,zoom:S,onZoomChange:v,onToolbarAction:b}):void 0,slotAfter:t.jsx(vd,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${M}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:E,content:m||f||e.defaultValue||"",onUpdate:z})})]})});Wn.displayName="TipTapEditor";const Ar=p.forwardRef((e,n)=>{const{adapter:a="tiptap",variant:s="bordered",...r}=e;return a==="tiptap"?t.jsx(Wn,{...r,variant:s,ref:n}):(console.warn(`Adapter "${a}" is not supported. Using TipTap.`),t.jsx(Wn,{...r,variant:s,ref:n}))});Ar.displayName="RichTextArea";function jd(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}const ls=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],wd={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Dr=({presetAmounts:e=ls,selectedDonation:n,defaultSelectedDonation:a=null,onChange:s,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:h=3,isDisabled:x=!1,buttonVariant:b="bordered",buttonColor:j="default",inputVariant:g="bordered",size:w="md",className:N="",showCard:S=!0})=>{const v={...wd,...f},D=Array.isArray(e)?e:ls,M={2:"grid-cols-2",3:"grid-cols-3"},C={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},E=`${M[m]} ${C[h]}`,[k,_]=dn(n,a,s),[A,F]=p.useState(""),[R,P]=p.useState(!1),[q,z]=p.useState(0),V=p.useCallback(Q=>{if(x)return;const Z={amount:Q.amount,isCustom:!1,presetId:Q.id};_(Z),F(""),P(!1),z(te=>te+1),r?.(Z)},[x,_,r]),X=p.useCallback(Q=>{if(x)return;if(F(Q!==void 0?String(Q):""),r){_(null);return}if(Q===void 0||isNaN(Q)){_(null);return}_({amount:Q,isCustom:!0})},[x,_,r]),W=p.useCallback(()=>{if(x)return;const Q=A!==""?parseFloat(A):void 0;Q===void 0||isNaN(Q)||r?.({amount:Q,isCustom:!0})},[x,A,r]),ae=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),Y=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[v.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:v.title}),D.length>0&&t.jsx("div",{className:c.cn("grid gap-3",E),"data-testid":"donation-amounts-presets",children:D.map(Q=>{const Z=k!==null&&!k.isCustom&&k.presetId===Q.id;return t.jsx(B,{color:Z?"primary":j,variant:Z?"solid":b,className:"w-full",onPress:()=>V(Q),isDisabled:x,"data-testid":`donation-amounts-preset-${Q.id}`,children:Q.label||jd(Q.amount,l,i)},Q.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{_(null),P(!0)}:void 0,variant:g,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:ae,value:A!==""?parseFloat(A):void 0,onValueChange:X,isDisabled:x,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${q}`:k?.isCustom===!1?k.presetId:"custom"),r&&t.jsx(B,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:W,isDisabled:x||!R,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return S?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Y})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:Y})};Dr.displayName="DonationAmounts";const Nd=e=>{const n=Math.max(0,e),a=Math.floor(n/60).toString().padStart(2,"0"),s=(n%60).toString().padStart(2,"0");return`${a}:${s} minutes`},Cd=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},kd=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"}},Er=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:a,onExpire:s,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Nd,className:h,...x},b)=>{const[j,g]=dn(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),a),w=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),p.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{g(M=>M<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,s?.()),0):M-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,g,s]),p.useEffect(()=>{j>0&&(N.current=!1)},[j]);const S=d||Cd(r),v=kd(i),D={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${l} ${m(j)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,D[u],h),...x,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[o&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(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:l})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(j)}`,"data-testid":"expire-cart-timer-value",children:m(j)})})]})})})});Er.displayName="ExpireCartTimer";const kn=({icon:e,children:n,testId:a})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":a,children:[t.jsx(I,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),Sd=({classes:e="",name:n,imageUrl:a,eventDate:s,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[h,x]=p.useState(!1),[b,j]=p.useState(!1),g=p.useRef(null);return p.useEffect(()=>{const w=()=>{if(g.current){const N=g.current.scrollHeight>g.current.clientHeight;j(N)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[l]),t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&a&&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:u,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:a,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[s&&t.jsx(kn,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:s}),r&&t.jsx(kn,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kn,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:g,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!h&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!h&&b&&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"})]}),(b||h)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(B,{onPress:()=>x(!h),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:t.jsx(I,{icon:h?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:h?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function Yn(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}function $d(e){const n=e.replace(/[^\d.,-]/g,""),a=n.match(/,\d{1,2}$/);let s;a?s=n.replace(/\./g,"").replace(",","."):s=n.replace(/,/g,"");const r=parseFloat(s);return isNaN(r)?null:r}const Ad={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"},mt=e=>typeof e=="number"&&!isNaN(e),Jt=({offer:e,quantity:n,defaultQuantity:a=0,onQuantityChange:s,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:h=!0,showPeopleCount:x=!0,showPrice:b=!0,priceDisplay:j,classNames:g={},"data-testid":w,selectedColor:N="default",compact:S=!1,isSoldOut:v,isMaxReached:D,isRuleBlocked:M,statusTone:C="default",statusLabel:E,disabledReason:k,disabled:_})=>{const A=p.useMemo(()=>({...Ad,...l}),[l]),[F,R]=p.useState(a),P=n!==void 0?n:F,q=!!(d||_),z=S||!!e.compact,V=p.useMemo(()=>typeof v=="boolean"?v:typeof e.isSoldOut=="boolean"?e.isSoldOut:!mt(e.totalTicketsSold)||!mt(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[v,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),X=p.useMemo(()=>typeof D=="boolean"?D:typeof e.isMaxReached=="boolean"?e.isMaxReached:V||!mt(e.ticketsAllowed)?!1:P>=e.ticketsAllowed-(e.totalTicketsSold??0),[D,e.isMaxReached,V,e.ticketsAllowed,e.totalTicketsSold,P]),W=p.useMemo(()=>typeof M=="boolean"?M:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[M,e.isRuleBlocked]),ae=k||e.disabledReason,Y=q||V||W,Q=se=>{if(Y||se>0&&X)return;const he=Math.max(0,P+se);n===void 0&&R(he),s?.(e.id,he)},Z=p.useMemo(()=>{if(V)return"soldOut";if(W)return"ruleBlocked";if(q)return"disabled"},[V,W,q]),te=p.useMemo(()=>C||(V||W?"danger":X?"warning":"default"),[C,V,W,X]),ce=p.useMemo(()=>{if(Z)return Z==="ruleBlocked"?E||ae||A.ruleBlocked:Z==="soldOut"?E||ae||A.soldOut:Z==="disabled"?E||ae||A.disabled:E||A.maxReached},[Z,E,ae,A]),J={soldOut:"danger",ruleBlocked:te,disabled:"default",maxReached:"warning"},me={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},ne=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",g.name),children:e.name}),Pe=()=>{if(!b)return null;const se=j?.price??e.price,he=j?.originalPrice,Ge=Yn(se,i,r);if(o?.renderPrice)return o.renderPrice(se,Ge,e);if(mt(he)&&mt(se)&&he>se){const Je=Yn(he,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",Je,", discounted price ",Ge]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",g.originalPrice),children:Je}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",g.discountedPrice),children:Ge})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",g.price),children:Ge})},Ee=()=>!h||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",z&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),Le=()=>{if(!x||!mt(e.numberOfPeople)||e.numberOfPeople<=0)return null;const se=e.numberOfPeople===1?A.person:A.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,se,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",z&&"mt-1 text-xs",g.peopleCount),children:[t.jsx(I,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",se]})},ut=()=>{const se=P===0||Y,he=X||Y;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:P,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:se,isIncrementDisabled:he,isDisabled:Y}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(B,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:se,variant:u,color:P>0?N:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(I,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:P}),t.jsx(B,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:he,variant:u,color:P>0?N:f,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(I,{icon:"gravity-ui:plus",width:16})})]})},We=(se,he)=>o?.renderDisabledState?o.renderDisabledState(se,he):se==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(he):se==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(he):t.jsx(c.Chip,{"data-testid":me[se],color:J[se],variant:se==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",se==="maxReached"?"h-8":"h-10",se==="soldOut"&&g.soldOut,se==="maxReached"&&g.maxReachedAlert,z&&"h-8"),startContent:t.jsx(I,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:he})}),Ie=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",Y||X?"opacity-50 pointer-events-none select-none":""),children:[ne(),Pe(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[Le(),Ee()]})]}),t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",z&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:Z&&ce?We(Z,ce):ut()})]}),Ye=X&&!V&&!W&&!q?t.jsx(De.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:We("maxReached",ce||A.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",z&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:Ie}),t.jsx(De.AnimatePresence,{children:Ye&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Ye})})]}):t.jsxs("div",{className:c.cn("w-full",z&&g.compact,g.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:Ie}),t.jsx(De.AnimatePresence,{children:Ye&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Ye})})]})};Jt.displayName="OfferCard";const Fr=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:a=48,showCard:s=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return s?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(I,{"data-testid":"offer-card-empty-icon",icon:n,width:a,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 s?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})};Fr.displayName="OfferCardEmpty";const Dd={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Lr=({error:e,labels:n,showCard:a=!0,color:s="danger",classNames:r={}})=>{const i={...Dd,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:s,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Lr.displayName="OfferCardError";const Ed={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Mr=({quantity:e=2,gap:n=4,classNames:a={}})=>{const s=Ed[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(s,a.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",a.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Mr.displayName="OfferCardSkeleton";const _r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Rr={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"}}},Fd={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Tr=({offers:e=[],mapOffer:n,selection:a,defaultSelection:s={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:h="default",showCard:x=!0,animated:b=!0,gap:j=2,compact:g=!1,classNames:w={}})=>{const[N,S]=p.useState(s),v=a!==void 0?a:N,D=p.useCallback((A,F)=>{const R={...v,[A]:Math.max(0,F)};a===void 0&&S(R),r?.(R),i?.(A,R[A])},[v,a,r,i]),M=[...e].sort((A,F)=>(A.position??0)-(F.position??0)),C=A=>{const F=n?n(A):A,R=(v??{})[F.id]||0;return{offer:F,quantity:R,onQuantityChange:D,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:g}},E=Fd[j],k=c.cn("grid mx-auto pt-2",E,w.base),_=A=>{const F=C(A);return t.jsx(Jt,{offer:F.offer,quantity:F.quantity,onQuantityChange:F.onQuantityChange,currency:F.currency,locale:F.locale,labels:F.labels,slots:F.slots,isDisabled:F.isDisabled,buttonVariant:F.buttonVariant,buttonColor:F.buttonColor,showCard:F.showCard,compact:F.compact,classNames:w.card},F.offer.id)};return b?t.jsx(De.motion.div,{"data-testid":"offer-card-list",className:k,variants:_r,initial:"hidden",animate:"show",children:t.jsx(De.AnimatePresence,{children:M.map(A=>{const F=C(A);return t.jsx(De.motion.div,{"data-testid":`offer-card-list-item-${F.offer.id}`,className:w.cardWrapper,variants:Rr,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Jt,{offer:F.offer,quantity:F.quantity,onQuantityChange:D,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:h,showCard:x,compact:g||F.offer.compact,classNames:w.card})},F.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:k,children:M.map(_)})};Tr.displayName="OfferCardList";var _t=e=>e.type==="checkbox",ot=e=>e instanceof Date,Fe=e=>e==null;const Pr=e=>typeof e=="object";var ye=e=>!Fe(e)&&!Array.isArray(e)&&Pr(e)&&!ot(e),Ir=e=>ye(e)&&e.target?_t(e.target)?e.target.checked:e.target.value:e,Ld=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Or=(e,n)=>e.has(Ld(n)),Md=e=>{const n=e.constructor&&e.constructor.prototype;return ye(n)&&n.hasOwnProperty("isPrototypeOf")},fa=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function pe(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(fa&&(e instanceof Blob||n))return e;const a=Array.isArray(e);if(!a&&!(ye(e)&&Md(e)))return e;const s=a?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(s[r]=pe(e[r]));return s}var un=e=>/^\w*$/.test(e),ue=e=>e===void 0,xa=e=>Array.isArray(e)?e.filter(Boolean):[],ha=e=>xa(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,n,a)=>{if(!n||!ye(e))return a;const s=(un(n)?[n]:ha(n)).reduce((r,i)=>Fe(r)?r:r[i],e);return ue(s)||s===e?ue(e[n])?a:e[n]:s},Re=e=>typeof e=="boolean",Ae=e=>typeof e=="function",oe=(e,n,a)=>{let s=-1;const r=un(n)?[n]:ha(n),i=r.length,l=i-1;for(;++s<i;){const o=r[s];let d=a;if(s!==l){const u=e[o];d=ye(u)||Array.isArray(u)?u:isNaN(+r[s+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const en={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ve={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ke={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zr=p.createContext(null);zr.displayName="HookFormControlContext";const pa=()=>p.useContext(zr);var Br=(e,n,a,s=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==Ve.all&&(n._proxyFormState[l]=!s||Ve.all),a&&(a[l]=!0),e[l]}});return r};const ga=typeof window<"u"?p.useLayoutEffect:p.useEffect;function _d(e){const n=pa(),{control:a=n,disabled:s,name:r,exact:i}=e||{},[l,o]=p.useState(a._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ga(()=>a._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!s&&o({...a._formState,...u})}}),[r,s,i]),p.useEffect(()=>{d.current.isValid&&a._setValid(!0)},[a]),p.useMemo(()=>Br(l,a,d.current,!1),[l,a])}var Te=e=>typeof e=="string",Gn=(e,n,a,s,r)=>Te(e)?(s&&n.watch.add(e),H(a,e,r)):Array.isArray(e)?e.map(i=>(s&&n.watch.add(i),H(a,i))):(s&&(n.watchAll=!0),a),Kn=e=>Fe(e)||!Pr(e);function Ue(e,n,a=new WeakSet){if(Kn(e)||Kn(n))return Object.is(e,n);if(ot(e)&&ot(n))return Object.is(e.getTime(),n.getTime());const s=Object.keys(e),r=Object.keys(n);if(s.length!==r.length)return!1;if(a.has(e)||a.has(n))return!0;a.add(e),a.add(n);for(const i of s){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(ot(l)&&ot(o)||ye(l)&&ye(o)||Array.isArray(l)&&Array.isArray(o)?!Ue(l,o,a):!Object.is(l,o))return!1}}return!0}function Rd(e){const n=pa(),{control:a=n,name:s,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(a),h=p.useRef(s);u.current=o;const[x,b]=p.useState(()=>{const v=a._getWatch(s,d.current);return u.current?u.current(v):v}),j=p.useCallback(v=>{const D=Gn(s,a._names,v||a._formValues,!1,d.current);return u.current?u.current(D):D},[a._formValues,a._names,s]),g=p.useCallback(v=>{if(!i){const D=Gn(s,a._names,v||a._formValues,!1,d.current);if(u.current){const M=u.current(D);Ue(M,f.current)||(b(M),f.current=M)}else b(D)}},[a._formValues,a._names,i,s]);ga(()=>((m.current!==a||!Ue(h.current,s))&&(m.current=a,h.current=s,g()),a._subscribe({name:s,formState:{values:!0},exact:l,callback:v=>{g(v.values)}})),[a,l,s,g]),p.useEffect(()=>a._removeUnmounted());const w=m.current!==a,N=h.current,S=p.useMemo(()=>{if(i)return null;const v=!w&&!Ue(N,s);return w||v?j():null},[i,w,s,N,j]);return S!==null?S:x}function Td(e){const n=pa(),{name:a,disabled:s,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Or(r._names.array,a),u=p.useMemo(()=>H(r._formValues,a,H(r._defaultValues,a,l)),[r,a,l]),f=Rd({control:r,name:a,defaultValue:u,exact:o}),m=_d({control:r,name:a,exact:o}),h=p.useRef(e),x=p.useRef(void 0),b=p.useRef(r.register(a,{...e.rules,value:f,...Re(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const j=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,a)},error:{enumerable:!0,get:()=>H(m.errors,a)}}),[m,a]),g=p.useCallback(v=>b.current.onChange({target:{value:Ir(v),name:a},type:en.CHANGE}),[a]),w=p.useCallback(()=>b.current.onBlur({target:{value:H(r._formValues,a),name:a},type:en.BLUR}),[a,r._formValues]),N=p.useCallback(v=>{const D=H(r._fields,a);D&&D._f&&v&&(D._f.ref={focus:()=>Ae(v.focus)&&v.focus(),select:()=>Ae(v.select)&&v.select(),setCustomValidity:M=>Ae(v.setCustomValidity)&&v.setCustomValidity(M),reportValidity:()=>Ae(v.reportValidity)&&v.reportValidity()})},[r._fields,a]),S=p.useMemo(()=>({name:a,value:f,...Re(s)||m.disabled?{disabled:m.disabled||s}:{},onChange:g,onBlur:w,ref:N}),[a,s,m.disabled,g,w,N,f]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,D=x.current;D&&D!==a&&!d&&r.unregister(D),r.register(a,{...h.current.rules,...Re(h.current.disabled)?{disabled:h.current.disabled}:{}});const M=(C,E)=>{const k=H(r._fields,C);k&&k._f&&(k._f.mount=E)};if(M(a,!0),v){const C=pe(H(r._options.defaultValues,a,h.current.defaultValue));oe(r._defaultValues,a,C),ue(H(r._formValues,a))&&oe(r._formValues,a,C)}return!d&&r.register(a),x.current=a,()=>{(d?v&&!r._state.action:v)?r.unregister(a):M(a,!1)}},[a,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:s,name:a})},[s,a,r]),p.useMemo(()=>({field:S,formState:m,fieldState:j}),[S,m,j])}const Pd=p.createContext(null);Pd.displayName="HookFormContext";var Id=(e,n,a,s,r)=>n?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[s]:r||!0}}:{},At=e=>Array.isArray(e)?e:[e],os=()=>{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 Vr(e,n){const a={};for(const s in e)if(e.hasOwnProperty(s)){const r=e[s],i=n[s];if(r&&ye(r)&&i){const l=Vr(r,i);ye(l)&&(a[s]=l)}else e[s]&&(a[s]=i)}return a}var Se=e=>ye(e)&&!Object.keys(e).length,ba=e=>e.type==="file",tn=e=>{if(!fa)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Ur=e=>e.type==="select-multiple",ya=e=>e.type==="radio",Od=e=>ya(e)||_t(e),Sn=e=>tn(e)&&e.isConnected;function zd(e,n){const a=n.slice(0,-1).length;let s=0;for(;s<a;)e=ue(e)?s++:e[n[s++]];return e}function Bd(e){for(const n in e)if(e.hasOwnProperty(n)&&!ue(e[n]))return!1;return!0}function ge(e,n){const a=Array.isArray(n)?n:un(n)?[n]:ha(n),s=a.length===1?e:zd(e,a),r=a.length-1,i=a[r];return s&&delete s[i],r!==0&&(ye(s)&&Se(s)||Array.isArray(s)&&Bd(s))&&ge(e,a.slice(0,-1)),e}var Vd=e=>{for(const n in e)if(Ae(e[n]))return!0;return!1};function Hr(e){return Array.isArray(e)||ye(e)&&!Vd(e)}function Qn(e,n={}){for(const a in e){const s=e[a];Hr(s)?(n[a]=Array.isArray(s)?[]:{},Qn(s,n[a])):ue(s)||(n[a]=!0)}return n}function ht(e,n,a){a||(a=Qn(n));for(const s in e){const r=e[s];if(Hr(r))ue(n)||Kn(a[s])?a[s]=Qn(r,Array.isArray(r)?[]:{}):ht(r,Fe(n)?{}:n[s],a[s]);else{const i=n[s];a[s]=!Ue(r,i)}}return a}const cs={value:!1,isValid:!1},ds={value:!0,isValid:!0};var qr=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ue(e[0].attributes.value)?ue(e[0].value)||e[0].value===""?ds:{value:e[0].value,isValid:!0}:ds:cs}return cs},Wr=(e,{valueAsNumber:n,valueAsDate:a,setValueAs:s})=>ue(e)?e:n?e===""?NaN:e&&+e:a&&Te(e)?new Date(e):s?s(e):e;const us={isValid:!1,value:null};var Yr=e=>Array.isArray(e)?e.reduce((n,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:n,us):us;function ms(e){const n=e.ref;return ba(n)?n.files:ya(n)?Yr(e.refs).value:Ur(n)?[...n.selectedOptions].map(({value:a})=>a):_t(n)?qr(e.refs).value:Wr(ue(n.value)?e.ref.value:n.value,e)}var Ud=(e,n,a,s)=>{const r={};for(const i of e){const l=H(n,i);l&&oe(r,i,l._f)}return{criteriaMode:a,names:[...e],fields:r,shouldUseNativeValidation:s}},nn=e=>e instanceof RegExp,Nt=e=>ue(e)?e:nn(e)?e.source:ye(e)?nn(e.value)?e.value.source:e.value:e,fs=e=>({isOnSubmit:!e||e===Ve.onSubmit,isOnBlur:e===Ve.onBlur,isOnChange:e===Ve.onChange,isOnAll:e===Ve.all,isOnTouch:e===Ve.onTouched});const xs="AsyncFunction";var Hd=e=>!!e&&!!e.validate&&!!(Ae(e.validate)&&e.validate.constructor.name===xs||ye(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===xs)),qd=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hs=(e,n,a)=>!a&&(n.watchAll||n.watch.has(e)||[...n.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Dt=(e,n,a,s)=>{for(const r of a||Object.keys(e)){const i=H(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!s)return!0;if(l.ref&&n(l.ref,l.name)&&!s)return!0;if(Dt(o,n))break}else if(ye(o)&&Dt(o,n))break}}};function ps(e,n,a){const s=H(e,a);if(s||un(a))return{error:s,name:a};const r=a.split(".");for(;r.length;){const i=r.join("."),l=H(n,i),o=H(e,i);if(l&&!Array.isArray(l)&&a!==i)return{name:a};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:a}}var Wd=(e,n,a,s)=>{a(e);const{name:r,...i}=e;return Se(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!s||Ve.all))},Yd=(e,n,a)=>!e||!n||e===n||At(e).some(s=>s&&(a?s===n:s.startsWith(n)||n.startsWith(s))),Gd=(e,n,a,s,r)=>r.isOnAll?!1:!a&&r.isOnTouch?!(n||e):(a?s.isOnBlur:r.isOnBlur)?!e:(a?s.isOnChange:r.isOnChange)?e:!0,Kd=(e,n)=>!xa(H(e,n)).length&&ge(e,n),Qd=(e,n,a)=>{const s=At(H(e,a));return oe(s,"root",n[a]),oe(e,a,s),e};function gs(e,n,a="validate"){if(Te(e)||Array.isArray(e)&&e.every(Te)||Re(e)&&!e)return{type:a,message:Te(e)?e:"",ref:n}}var ft=e=>ye(e)&&!nn(e)?e:{value:e,message:""},bs=async(e,n,a,s,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:h,pattern:x,validate:b,name:j,valueAsNumber:g,mount:w}=e._f,N=H(a,j);if(!w||n.has(j))return{};const S=o?o[0]:l,v=F=>{r&&S.reportValidity&&(S.setCustomValidity(Re(F)?"":F||""),S.reportValidity())},D={},M=ya(l),C=_t(l),E=M||C,k=(g||ba(l))&&ue(l.value)&&ue(N)||tn(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,_=Id.bind(null,j,s,D),A=(F,R,P,q=Ke.maxLength,z=Ke.minLength)=>{const V=F?R:P;D[j]={type:F?q:z,message:V,ref:l,..._(F?q:z,V)}};if(i?!Array.isArray(N)||!N.length:d&&(!E&&(k||Fe(N))||Re(N)&&!N||C&&!qr(o).isValid||M&&!Yr(o).isValid)){const{value:F,message:R}=Te(d)?{value:!!d,message:d}:ft(d);if(F&&(D[j]={type:Ke.required,message:R,ref:S,..._(Ke.required,R)},!s))return v(R),D}if(!k&&(!Fe(m)||!Fe(h))){let F,R;const P=ft(h),q=ft(m);if(!Fe(N)&&!isNaN(N)){const z=l.valueAsNumber||N&&+N;Fe(P.value)||(F=z>P.value),Fe(q.value)||(R=z<q.value)}else{const z=l.valueAsDate||new Date(N),V=ae=>new Date(new Date().toDateString()+" "+ae),X=l.type=="time",W=l.type=="week";Te(P.value)&&N&&(F=X?V(N)>V(P.value):W?N>P.value:z>new Date(P.value)),Te(q.value)&&N&&(R=X?V(N)<V(q.value):W?N<q.value:z<new Date(q.value))}if((F||R)&&(A(!!F,P.message,q.message,Ke.max,Ke.min),!s))return v(D[j].message),D}if((u||f)&&!k&&(Te(N)||i&&Array.isArray(N))){const F=ft(u),R=ft(f),P=!Fe(F.value)&&N.length>+F.value,q=!Fe(R.value)&&N.length<+R.value;if((P||q)&&(A(P,F.message,R.message),!s))return v(D[j].message),D}if(x&&!k&&Te(N)){const{value:F,message:R}=ft(x);if(nn(F)&&!N.match(F)&&(D[j]={type:Ke.pattern,message:R,ref:l,..._(Ke.pattern,R)},!s))return v(R),D}if(b){if(Ae(b)){const F=await b(N,a),R=gs(F,S);if(R&&(D[j]={...R,..._(Ke.validate,R.message)},!s))return v(R.message),D}else if(ye(b)){let F={};for(const R in b){if(!Se(F)&&!s)break;const P=gs(await b[R](N,a),S,R);P&&(F={...P,..._(R,P.message)},v(P.message),s&&(D[j]=F))}if(!Se(F)&&(D[j]={ref:S,...F},!s))return D}}return v(!0),D};const Zd={mode:Ve.onSubmit,reValidateMode:Ve.onChange,shouldFocusError:!0};function Xd(e={}){let n={...Zd,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ae(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},s={},r=ye(n.defaultValues)||ye(n.values)?pe(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:pe(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let h={...m};const x={array:os(),state:os()},b=n.criteriaMode===Ve.all,j=y=>$=>{clearTimeout(u),u=setTimeout(y,$)},g=async y=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||h.isValid||y)){let $;n.resolver?($=Se((await E()).errors),w()):$=await _(s,!0),$!==a.isValid&&x.state.next({isValid:$})}},w=(y,$)=>{!n.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((y||Array.from(o.mount)).forEach(L=>{L&&($?oe(a.validatingFields,L,$):ge(a.validatingFields,L))}),x.state.next({validatingFields:a.validatingFields,isValidating:!Se(a.validatingFields)}))},N=(y,$=[],L,U,O=!0,T=!0)=>{if(U&&L&&!n.disabled){if(l.action=!0,T&&Array.isArray(H(s,y))){const G=L(H(s,y),U.argA,U.argB);O&&oe(s,y,G)}if(T&&Array.isArray(H(a.errors,y))){const G=L(H(a.errors,y),U.argA,U.argB);O&&oe(a.errors,y,G),Kd(a.errors,y)}if((m.touchedFields||h.touchedFields)&&T&&Array.isArray(H(a.touchedFields,y))){const G=L(H(a.touchedFields,y),U.argA,U.argB);O&&oe(a.touchedFields,y,G)}(m.dirtyFields||h.dirtyFields)&&(a.dirtyFields=ht(r,i)),x.state.next({name:y,isDirty:F(y,$),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else oe(i,y,$)},S=(y,$)=>{oe(a.errors,y,$),x.state.next({errors:a.errors})},v=y=>{a.errors=y,x.state.next({errors:a.errors,isValid:!1})},D=(y,$,L,U)=>{const O=H(s,y);if(O){const T=H(i,y,ue(L)?H(r,y):L);ue(T)||U&&U.defaultChecked||$?oe(i,y,$?T:ms(O._f)):q(y,T),l.mount&&!l.action&&g()}},M=(y,$,L,U,O)=>{let T=!1,G=!1;const re={name:y};if(!n.disabled){if(!L||U){(m.isDirty||h.isDirty)&&(G=a.isDirty,a.isDirty=re.isDirty=F(),T=G!==re.isDirty);const ie=Ue(H(r,y),$);G=!!H(a.dirtyFields,y),ie?ge(a.dirtyFields,y):oe(a.dirtyFields,y,!0),re.dirtyFields=a.dirtyFields,T=T||(m.dirtyFields||h.dirtyFields)&&G!==!ie}if(L){const ie=H(a.touchedFields,y);ie||(oe(a.touchedFields,y,L),re.touchedFields=a.touchedFields,T=T||(m.touchedFields||h.touchedFields)&&ie!==L)}T&&O&&x.state.next(re)}return T?re:{}},C=(y,$,L,U)=>{const O=H(a.errors,y),T=(m.isValid||h.isValid)&&Re($)&&a.isValid!==$;if(n.delayError&&L?(d=j(()=>S(y,L)),d(n.delayError)):(clearTimeout(u),d=null,L?oe(a.errors,y,L):ge(a.errors,y)),(L?!Ue(O,L):O)||!Se(U)||T){const G={...U,...T&&Re($)?{isValid:$}:{},errors:a.errors,name:y};a={...a,...G},x.state.next(G)}},E=async y=>(w(y,!0),await n.resolver(i,n.context,Ud(y||o.mount,s,n.criteriaMode,n.shouldUseNativeValidation))),k=async y=>{const{errors:$}=await E(y);if(w(y),y)for(const L of y){const U=H($,L);U?oe(a.errors,L,U):ge(a.errors,L)}else a.errors=$;return $},_=async(y,$,L={valid:!0})=>{for(const U in y){const O=y[U];if(O){const{_f:T,...G}=O;if(T){const re=o.array.has(T.name),ie=O._f&&Hd(O._f);ie&&m.validatingFields&&w([T.name],!0);const ke=await bs(O,o.disabled,i,b,n.shouldUseNativeValidation&&!$,re);if(ie&&m.validatingFields&&w([T.name]),ke[T.name]&&(L.valid=!1,$||e.shouldUseNativeValidation))break;!$&&(H(ke,T.name)?re?Qd(a.errors,ke,T.name):oe(a.errors,T.name,ke[T.name]):ge(a.errors,T.name))}!Se(G)&&await _(G,$,L)}}return L.valid},A=()=>{for(const y of o.unMount){const $=H(s,y);$&&($._f.refs?$._f.refs.every(L=>!Sn(L)):!Sn($._f.ref))&&ne(y)}o.unMount=new Set},F=(y,$)=>!n.disabled&&(y&&$&&oe(i,y,$),!Ue(Y(),r)),R=(y,$,L)=>Gn(y,o,{...l.mount?i:ue($)?r:Te(y)?{[y]:$}:$},L,$),P=y=>xa(H(l.mount?i:r,y,n.shouldUnregister?H(r,y,[]):[])),q=(y,$,L={})=>{const U=H(s,y);let O=$;if(U){const T=U._f;T&&(!T.disabled&&oe(i,y,Wr($,T)),O=tn(T.ref)&&Fe($)?"":$,Ur(T.ref)?[...T.ref.options].forEach(G=>G.selected=O.includes(G.value)):T.refs?_t(T.ref)?T.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(O)?G.checked=!!O.find(re=>re===G.value):G.checked=O===G.value||!!O)}):T.refs.forEach(G=>G.checked=G.value===O):ba(T.ref)?T.ref.value="":(T.ref.value=O,T.ref.type||x.state.next({name:y,values:pe(i)})))}(L.shouldDirty||L.shouldTouch)&&M(y,O,L.shouldTouch,L.shouldDirty,!0),L.shouldValidate&&ae(y)},z=(y,$,L)=>{for(const U in $){if(!$.hasOwnProperty(U))return;const O=$[U],T=y+"."+U,G=H(s,T);(o.array.has(y)||ye(O)||G&&!G._f)&&!ot(O)?z(T,O,L):q(T,O,L)}},V=(y,$,L={})=>{const U=H(s,y),O=o.array.has(y),T=pe($);oe(i,y,T),O?(x.array.next({name:y,values:pe(i)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&L.shouldDirty&&x.state.next({name:y,dirtyFields:ht(r,i),isDirty:F(y,T)})):U&&!U._f&&!Fe(T)?z(y,T,L):q(y,T,L),hs(y,o)?x.state.next({...a,name:y,values:pe(i)}):x.state.next({name:l.mount?y:void 0,values:pe(i)})},X=async y=>{l.mount=!0;const $=y.target;let L=$.name,U=!0;const O=H(s,L),T=ie=>{U=Number.isNaN(ie)||ot(ie)&&isNaN(ie.getTime())||Ue(ie,H(i,L,ie))},G=fs(n.mode),re=fs(n.reValidateMode);if(O){let ie,ke;const rt=$.type?ms(O._f):Ir(y),et=y.type===en.BLUR||y.type===en.FOCUS_OUT,Tl=!qd(O._f)&&!n.resolver&&!H(a.errors,L)&&!O._f.deps||Gd(et,H(a.touchedFields,L),a.isSubmitted,re,G),xn=hs(L,o,et);oe(i,L,rt),et?(!$||!$.readOnly)&&(O._f.onBlur&&O._f.onBlur(y),d&&d(0)):O._f.onChange&&O._f.onChange(y);const hn=M(L,rt,et),Pl=!Se(hn)||xn;if(!et&&x.state.next({name:L,type:y.type,values:pe(i)}),Tl)return(m.isValid||h.isValid)&&(n.mode==="onBlur"?et&&g():et||g()),Pl&&x.state.next({name:L,...xn?{}:hn});if(!et&&xn&&x.state.next({...a}),n.resolver){const{errors:Pa}=await E([L]);if(w([L]),T(rt),U){const Il=ps(a.errors,s,L),Ia=ps(Pa,s,Il.name||L);ie=Ia.error,L=Ia.name,ke=Se(Pa)}}else w([L],!0),ie=(await bs(O,o.disabled,i,b,n.shouldUseNativeValidation))[L],w([L]),T(rt),U&&(ie?ke=!1:(m.isValid||h.isValid)&&(ke=await _(s,!0)));U&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&ae(O._f.deps),C(L,ke,ie,hn))}},W=(y,$)=>{if(H(a.errors,$)&&y.focus)return y.focus(),1},ae=async(y,$={})=>{let L,U;const O=At(y);if(n.resolver){const T=await k(ue(y)?y:O);L=Se(T),U=y?!O.some(G=>H(T,G)):L}else y?(U=(await Promise.all(O.map(async T=>{const G=H(s,T);return await _(G&&G._f?{[T]:G}:G)}))).every(Boolean),!(!U&&!a.isValid)&&g()):U=L=await _(s);return x.state.next({...!Te(y)||(m.isValid||h.isValid)&&L!==a.isValid?{}:{name:y},...n.resolver||!y?{isValid:L}:{},errors:a.errors}),$.shouldFocus&&!U&&Dt(s,W,y?O:o.mount),U},Y=(y,$)=>{let L={...l.mount?i:r};return $&&(L=Vr($.dirtyFields?a.dirtyFields:a.touchedFields,L)),ue(y)?L:Te(y)?H(L,y):y.map(U=>H(L,U))},Q=(y,$)=>({invalid:!!H(($||a).errors,y),isDirty:!!H(($||a).dirtyFields,y),error:H(($||a).errors,y),isValidating:!!H(a.validatingFields,y),isTouched:!!H(($||a).touchedFields,y)}),Z=y=>{y&&At(y).forEach($=>ge(a.errors,$)),x.state.next({errors:y?a.errors:{}})},te=(y,$,L)=>{const U=(H(s,y,{_f:{}})._f||{}).ref,O=H(a.errors,y)||{},{ref:T,message:G,type:re,...ie}=O;oe(a.errors,y,{...ie,...$,ref:U}),x.state.next({name:y,errors:a.errors,isValid:!1}),L&&L.shouldFocus&&U&&U.focus&&U.focus()},ce=(y,$)=>Ae(y)?x.state.subscribe({next:L=>"values"in L&&y(R(void 0,$),L)}):R(y,$,!0),J=y=>x.state.subscribe({next:$=>{Yd(y.name,$.name,y.exact)&&Wd($,y.formState||m,Ge,y.reRenderRoot)&&y.callback({values:{...i},...a,...$,defaultValues:r})}}).unsubscribe,me=y=>(l.mount=!0,h={...h,...y.formState},J({...y,formState:{...f,...y.formState}})),ne=(y,$={})=>{for(const L of y?At(y):o.mount)o.mount.delete(L),o.array.delete(L),$.keepValue||(ge(s,L),ge(i,L)),!$.keepError&&ge(a.errors,L),!$.keepDirty&&ge(a.dirtyFields,L),!$.keepTouched&&ge(a.touchedFields,L),!$.keepIsValidating&&ge(a.validatingFields,L),!n.shouldUnregister&&!$.keepDefaultValue&&ge(r,L);x.state.next({values:pe(i)}),x.state.next({...a,...$.keepDirty?{isDirty:F()}:{}}),!$.keepIsValid&&g()},Pe=({disabled:y,name:$})=>{if(Re(y)&&l.mount||y||o.disabled.has($)){const O=o.disabled.has($)!==!!y;y?o.disabled.add($):o.disabled.delete($),O&&l.mount&&!l.action&&g()}},Ee=(y,$={})=>{let L=H(s,y);const U=Re($.disabled)||Re(n.disabled);return oe(s,y,{...L||{},_f:{...L&&L._f?L._f:{ref:{name:y}},name:y,mount:!0,...$}}),o.mount.add(y),L?Pe({disabled:Re($.disabled)?$.disabled:n.disabled,name:y}):D(y,!0,$.value),{...U?{disabled:$.disabled||n.disabled}:{},...n.progressive?{required:!!$.required,min:Nt($.min),max:Nt($.max),minLength:Nt($.minLength),maxLength:Nt($.maxLength),pattern:Nt($.pattern)}:{},name:y,onChange:X,onBlur:X,ref:O=>{if(O){Ee(y,$),L=H(s,y);const T=ue(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,G=Od(T),re=L._f.refs||[];if(G?re.find(ie=>ie===T):T===L._f.ref)return;oe(s,y,{_f:{...L._f,...G?{refs:[...re.filter(Sn),T,...Array.isArray(H(r,y))?[{}]:[]],ref:{type:T.type,name:y}}:{ref:T}}}),D(y,!1,void 0,T)}else L=H(s,y,{}),L._f&&(L._f.mount=!1),(n.shouldUnregister||$.shouldUnregister)&&!(Or(o.array,y)&&l.action)&&o.unMount.add(y)}}},Le=()=>n.shouldFocusError&&Dt(s,W,o.mount),ut=y=>{Re(y)&&(x.state.next({disabled:y}),Dt(s,($,L)=>{const U=H(s,L);U&&($.disabled=U._f.disabled||y,Array.isArray(U._f.refs)&&U._f.refs.forEach(O=>{O.disabled=U._f.disabled||y}))},0,!1))},We=(y,$)=>async L=>{let U;L&&(L.preventDefault&&L.preventDefault(),L.persist&&L.persist());let O=pe(i);if(x.state.next({isSubmitting:!0}),n.resolver){const{errors:T,values:G}=await E();w(),a.errors=T,O=pe(G)}else await _(s);if(o.disabled.size)for(const T of o.disabled)ge(O,T);if(ge(a.errors,"root"),Se(a.errors)){x.state.next({errors:{}});try{await y(O,L)}catch(T){U=T}}else $&&await $({...a.errors},L),Le(),setTimeout(Le);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Se(a.errors)&&!U,submitCount:a.submitCount+1,errors:a.errors}),U)throw U},Ie=(y,$={})=>{H(s,y)&&(ue($.defaultValue)?V(y,pe(H(r,y))):(V(y,$.defaultValue),oe(r,y,pe($.defaultValue))),$.keepTouched||ge(a.touchedFields,y),$.keepDirty||(ge(a.dirtyFields,y),a.isDirty=$.defaultValue?F(y,pe(H(r,y))):F()),$.keepError||(ge(a.errors,y),m.isValid&&g()),x.state.next({...a}))},Ye=(y,$={})=>{const L=y?pe(y):r,U=pe(L),O=Se(y),T=O?r:U;if($.keepDefaultValues||(r=L),!$.keepValues){if($.keepDirtyValues){const G=new Set([...o.mount,...Object.keys(ht(r,i))]);for(const re of Array.from(G)){const ie=H(a.dirtyFields,re),ke=H(i,re),rt=H(T,re);ie&&!ue(ke)?oe(T,re,ke):!ie&&!ue(rt)&&V(re,rt)}}else{if(fa&&ue(y))for(const G of o.mount){const re=H(s,G);if(re&&re._f){const ie=Array.isArray(re._f.refs)?re._f.refs[0]:re._f.ref;if(tn(ie)){const ke=ie.closest("form");if(ke){ke.reset();break}}}}if($.keepFieldsRef)for(const G of o.mount)V(G,H(T,G));else s={}}i=n.shouldUnregister?$.keepDefaultValues?pe(r):{}:pe(T),x.array.next({values:{...T}}),x.state.next({values:{...T}})}o={mount:$.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!$.keepIsValid||!!$.keepDirtyValues||!n.shouldUnregister&&!Se(T),l.watch=!!n.shouldUnregister,l.keepIsValid=!!$.keepIsValid,l.action=!1,$.keepErrors||(a.errors={}),x.state.next({submitCount:$.keepSubmitCount?a.submitCount:0,isDirty:O?!1:$.keepDirty?a.isDirty:!!($.keepDefaultValues&&!Ue(y,r)),isSubmitted:$.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:O?{}:$.keepDirtyValues?$.keepDefaultValues&&i?ht(r,i):a.dirtyFields:$.keepDefaultValues&&y?ht(r,y):$.keepDirty?a.dirtyFields:{},touchedFields:$.keepTouched?a.touchedFields:{},errors:$.keepErrors?a.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},se=(y,$)=>Ye(Ae(y)?y(i):y,{...n.resetOptions,...$}),he=(y,$={})=>{const L=H(s,y),U=L&&L._f;if(U){const O=U.refs?U.refs[0]:U.ref;O.focus&&setTimeout(()=>{O.focus(),$.shouldSelect&&Ae(O.select)&&O.select()})}},Ge=y=>{a={...a,...y}},Je={control:{register:Ee,unregister:ne,getFieldState:Q,handleSubmit:We,setError:te,_subscribe:J,_runSchema:E,_updateIsValidating:w,_focusError:Le,_getWatch:R,_getDirty:F,_setValid:g,_setFieldArray:N,_setDisabledField:Pe,_setErrors:v,_getFieldArray:P,_reset:Ye,_resetDefaultValues:()=>Ae(n.defaultValues)&&n.defaultValues().then(y=>{se(y,n.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:A,_disableForm:ut,_subjects:x,_proxyFormState:m,get _fields(){return s},get _formValues(){return i},get _state(){return l},set _state(y){l=y},get _defaultValues(){return r},get _names(){return o},set _names(y){o=y},get _formState(){return a},get _options(){return n},set _options(y){n={...n,...y}}},subscribe:me,trigger:ae,register:Ee,handleSubmit:We,watch:ce,setValue:V,getValues:Y,reset:se,resetField:Ie,clearErrors:Z,unregister:ne,setError:te,setFocus:he,getFieldState:Q};return{...Je,formControl:Je}}function Jd(e={}){const n=p.useRef(void 0),a=p.useRef(void 0),[s,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ae(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:Ae(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:s},e.defaultValues&&!Ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Xd(e);n.current={...o,formState:s}}const i=n.current.control;return i._options=e,ga(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),p.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),p.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),p.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),p.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==s.isDirty&&i._subjects.state.next({isDirty:l})}},[i,s.isDirty]),p.useEffect(()=>{var l;e.values&&!Ue(e.values,a.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),a.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),p.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),n.current.formState=p.useMemo(()=>Br(s,i),[i,s]),n.current}function eu(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function tu(e,n="en-US",a="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(s){return console.warn(`Invalid currency formatting: ${s}`),`${a} ${e.toFixed(2)}`}}function nu(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function au(e){const n=e.replace(/[^\d.,-]/g,""),a=n.match(/,\d{1,2}$/);let s;a?s=n.replace(/\./g,"").replace(",","."):s=n.replace(/,/g,"");const r=parseFloat(s);return isNaN(r)?null:r}function su(e,n,a=.001){const s=e-n,r=Math.abs(s)<=a;return{difference:s,isBalanced:r,isUnderAllocated:!r&&s>0,isOverAllocated:!r&&s<0}}function va(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}va();const ru={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},$n=()=>({id:va(),amount:0,glAccount:null,isTaxDeductible:!1}),Gr=({distribution:e,defaultDistribution:n,glAccounts:a=[],isLoadingGlAccounts:s=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:h=!1,labels:x,classNames:b={},"data-testid":j,control:g,name:w,rules:N})=>{const S={...ru,...x},v=g!==void 0&&w!==void 0,D=Jd({defaultValues:{_internal:n||$n()}}),M=Td({control:v?g:D.control,name:v?w:"_internal",rules:v?N:void 0}),[C,E]=p.useState(n||$n()),k=v?M.field.value??$n():e??C,_=v&&!!M.fieldState?.error,A=v&&(M.fieldState?.isTouched??!1),F=_||A,R=F&&(!k.amount||k.amount<=0),P=F&&!k.glAccount,[q,z]=p.useState(k.glAccount?.name||""),V=p.useCallback(te=>{const ce={...k,...te};v&&M.field.onChange(ce),!v&&e===void 0&&E(ce),i?.(ce)},[k,e,i,v,M]),X=p.useCallback(te=>{const ce=te||0;V({amount:ce}),l?.(ce)},[V,l]),W=p.useCallback(te=>{z(te),r?.(te)},[r]),ae=p.useCallback(te=>{if(te===null){V({glAccount:null}),o?.(null);return}const J=a.find(me=>String(me.id)===String(te))||null;V({glAccount:J}),o?.(J)},[a,V,o]),Y=p.useCallback(()=>{z(""),V({glAccount:null}),o?.(null)},[V,o]),Q=p.useCallback(te=>{V({isTaxDeductible:te}),d?.(te)},[V,d]),Z=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":j||"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":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(c.Tooltip,{content:S.amountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:k.amount||void 0,onValueChange:X,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:h,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:S.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.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(c.Tooltip,{content:S.glAccountTooltip,children:t.jsx(I,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:s,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:a,menuTrigger:"input",inputValue:k.glAccount?.name??q,selectedKey:k.glAccount?.id??null,isDisabled:h,isInvalid:P,errorMessage:P?"GL Account is required":void 0,listboxProps:{emptyContent:s?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:W,onSelectionChange:ae,onClear:Y,className:b.glAccountInput,children:te=>t.jsx(c.AutocompleteItem,{textValue:te.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:te.name}),te.code&&t.jsx("span",{className:"text-xs text-default-400",children:te.code})]})},te.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":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:k.isTaxDeductible,onValueChange:Q,isDisabled:h||!m,className:b.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(B,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:h||!f,onPress:Z,startContent:t.jsx(I,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:S.deleteButton})})]})})};Gr.displayName="RevenueDistributionCard";const Kr=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:a=48,showCard:s=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(I,{icon:n,width:a,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 s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};Kr.displayName="RevenueDistributionEmpty";const iu={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Qr=({error:e,labels:n,showCard:a=!0,color:s="danger",classNames:r={}})=>{const i={...iu,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:s,title:i.title,description:e||i.description,className:r.alert});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};Qr.displayName="RevenueDistributionError";const Zr=({rows:e=1,showCard:n=!0,classNames:a={}})=>{const s=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",a.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",a.base),children:s.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",a.base),children:s.map(i=>r(i))})};Zr.displayName="RevenueDistributionSkeleton";function ja({isOpen:e,labels:n,icon:a,isConfirming:s=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[a&&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:a}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(B,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(B,{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:s,onPress:f,children:n.confirm})]})]})})}const lu=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function ys(e){return!e.fund&&Number(e.percentage||0)<=0}function ou({mode:e,assignments:n}){const a=n.filter(i=>i.fund),s=a.reduce((i,l)=>i+Number(l.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return a.length>=1&&!r&&Math.round(s*100)/100===100}const cu={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"},Xr={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"},Ct={...Xr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},du={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"},uu={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 mu(){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 fu=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,xu=e=>e.fund!==null;function hu({assignments:e,funds:n,labels:a,classNames:s,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:h,onOpenFundPicker:x,onCloseFundPicker:b,onCollapseChange:j,onSave:g}){const[w,N]=p.useState(null),S=f??w??void 0,v={...cu,...a},D=e.filter(J=>!ys(J)),C=D.filter(xu).length>0,E=p.useMemo(()=>e.filter(J=>!ys(J)).reduce((J,me)=>J+Number(me.percentage||0),0),[e]),k=Math.round(E*100)/100,_=D.some(J=>!J.fund||Number(J.percentage||0)<=0),A=C&&(k!==100||_),F=`${v.totalError} (${v.total} ${Number(E.toFixed(2))}%)`,R=ou({mode:"split",assignments:e}),P=C&&k>=100,[q,z]=p.useState(!1),[V,X]=p.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(mu,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),l?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),ae=(J,me)=>{h(e.map(ne=>ne.id===J?{...ne,...me}:ne))},Y=()=>{P||h([...e,lu()])},Q=J=>{e.length<=1||h(e.filter(me=>me.id!==J))},Z=()=>{if(!r){if(!R){X(!0);return}if(!i){g();return}z(!0)}},te=()=>{z(!1),g()},ce=J=>{const me=u??e.find(ne=>!ne.fund)?.id??e[0]?.id;me&&(h(e.map(ne=>ne.id===me?{...ne,fund:J}:ne)),b())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!f&&"min-h-[560px]",s?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",s?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",s?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:J=>j?.(!(J==="all"||Array.from(J).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:W,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",s?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!C&&t.jsx(c.Alert,{icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Xr,color:"default",variant:"flat",title:v.emptySplit}),C&&t.jsx(pu,{assignments:e,labels:v,total:E,hasTotalError:V&&!R||A,validationMessage:F,onSelectFund:J=>x(J),onRemoveFund:Q,onPercentageChange:(J,me)=>ae(J,{percentage:fu(me)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:P,onPress:()=>C?Y():x(),children:v.assignSpecificFund}),t.jsx(B,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!R||r,onPress:Z,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(gu,{funds:n,labels:v,selectedFundIds:e.map(J=>J.fund?.id).filter(Boolean),portalContainer:S,onSelect:ce,onClose:b}),t.jsx(ja,{isOpen:q,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(I,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:S,shouldBlockScroll:!1,classNames:uu,onClose:()=>z(!1),onConfirm:te})]})}function pu({assignments:e,labels:n,total:a,hasTotalError:s,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(B,{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(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:du})}),e.length>1&&t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":n.removeFund,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(I,{icon:s?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:s?"warning":"success",variant:"flat",classNames:{...Ct,base:c.cn(Ct.base,s?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Ct.iconWrapper,s?"text-warning-700":"text-success-700"),alertIcon:c.cn(Ct.alertIcon,s?"text-warning-700":"text-success-700"),title:c.cn(Ct.title,s?"text-warning-700":"text-success-700")},title:s?r:`${n.total} ${Number(a.toFixed(2))}%`})]})}function gu({funds:e,labels:n,selectedFundIds:a,portalContainer:s,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(a.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:s,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:l,placeholder:n.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(I,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(B,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function bu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const yu={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function vu({totalAmount:e,remainingBalance:n,amountReceived:a,currency:s="USD",locale:r="en-US",labels:i,className:l}){const o={...yu,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:s});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(An,{label:o.totalAmount,value:d.format(e)}),t.jsx(An,{label:o.remainingBalance,value:d.format(n)}),t.jsx(An,{label:o.amountReceived,value:d.format(a)})]})})}function An({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const ju={monthly:1,quarterly:3,annual:12},Jr=e=>{const[n,a,s]=e.split("-").map(Number);return{year:n,month:a,day:s}},wu=(e,n)=>new Date(e,n+1,0).getDate(),Nu=e=>{const n=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${n}-${a}-${s}`},Cu=(e,n)=>{const{year:a,month:s,day:r}=Jr(e),i=s-1+n,l=a+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,wu(l,o));return new Date(l,o,d)},ku=(e,n)=>{const{year:a,month:s,day:r}=Jr(e),i=new Date(a,s-1,r);return i.setDate(i.getDate()+n),i};function ei(e,n){const a=Math.max(1,Math.floor(n.numberOfInstallments||1)),s=Math.round(e*100),r=Math.floor(s/a),i=s-r*a,l=ju[n.frequency];return Array.from({length:a},(o,d)=>{const u=n.frequency==="weekly"?ku(n.firstInstallmentDate,d*7):Cu(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:Nu(u),amount:(r+(d===0?i:0))/100}})}function Su(e){return new Set(e.map((n,a)=>{const s=e[a+1]?.dueDate;return n.dueDate&&s&&n.dueDate>s?n.id:null}).filter(n=>!!n))}function $u(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:Su(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function Au(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Du(e,n){const a=e[0];return!a||!n||a.dueDate===n?e:[{...a,dueDate:n},...e.slice(1)]}const Eu=new Set(["paid","partially_refunded","refunded"]);function ct(e){return e!==void 0&&Eu.has(e)}const Fu={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."},Lu=["weekly","monthly","quarterly","annual"],Mu=Array.from({length:31},(e,n)=>n+1),_u=["numberOfInstallments","frequency","firstInstallmentDate"],vs=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),an=e=>Math.round(e*100)/100,Ru=(e,n)=>{const a=new Date(`${e}T00:00:00`);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(a)},mn=e=>{if(!e)return null;try{return $c(e)}catch{return null}},Tu=e=>mn(e)?.day??1,Pu=(e,n)=>new Date(e,n,0).getDate(),Iu=(e,n)=>{const a=mn(e);if(!a)return e;const s=Math.min(n,Pu(a.year,a.month));return a.set({day:s}).toString()},js=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function Ou({mode:e,donationAmount:n,currency:a="USD",locale:s="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=_u,startDate:h,firstInstallmentDateOverride:x,labels:b,classNames:j,isSaving:g=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:S,onAutomaticSettingsChange:v,onInstallmentsChange:D,onSave:M,onCancel:C}){const[E,k]=p.useState(l),_={...Fu,...b},A=e??E,F=p.useMemo(()=>new Intl.NumberFormat(s,{style:"currency",currency:a}),[a,s]),R=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||h||"":h||i.firstInstallmentDate}),[i,m,h]),P=A==="automatic"?Du(ei(n,R),m.includes("firstInstallmentDate")?void 0:x):r,q=p.useMemo(()=>an(P.reduce((ne,Pe)=>ne+Number(Pe.amount||0),0)),[P]),z=Math.abs(q-n)>.009,V=an(n-q)<=0,X=p.useMemo(()=>$u(r),[r]),W=A==="manual"&&Au(X),ae=z||W,Y=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,Q=ne=>{ne!==A&&(e||k(ne),S?.(ne),ne==="manual"&&r.length===0&&D([vs()]))},Z=(ne,Pe)=>{const Ee=r.find(Le=>Le.id===ne);ct(Ee?.status)||D(r.map(Le=>Le.id===ne?{...Le,...Pe}:Le))},te=()=>{D([...r,vs()])},ce=ne=>{const Pe=r.find(Ee=>Ee.id===ne);ct(Pe?.status)||D(r.filter(Ee=>Ee.id!==ne))},J=()=>{g||ae||M?.()},me=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.content),children:[f||u||C?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(zu,{mode:A,labels:_,onModeChange:Q,isDisabled:N,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[C?t.jsx(B,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:C,children:_.cancelEdit}):null,u?t.jsx(B,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:g?void 0:t.jsx(I,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||ae,onPress:J,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.preview),children:[A==="automatic"&&t.jsx(Bu,{settings:R,inputs:m,labels:_,className:j?.controls,onSettingsChange:v}),P.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:A==="automatic"?_.emptyAutomatic:_.emptyManual}),P.length>0&&t.jsx(Vu,{mode:A,installments:P,rowErrors:X,labels:_,formatter:F,locale:s,onUpdateInstallment:Z,onRemoveInstallment:ce}),A==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(B,{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(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:V,onPress:te,children:_.addInstallment})}),t.jsx(Wu,{total:q,donationAmount:n,hasTotalMismatch:z,mode:A,installments:P,formatter:F,labels:_,className:j?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.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:c.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(c.AccordionItem,{"aria-label":_.title,title:Y,children:me},"installment-schedule")}):me})}function zu({mode:e,labels:n,className:a,isDisabled:s=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:s,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",a),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Bu({settings:e,inputs:n,labels:a,className:s,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:a.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:Lu.map(o=>t.jsx(c.SelectItem,{textValue:a[o],children:a[o]},o))})},l);if(l==="dayOfMonth"){const o=String(Tu(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(He,{variant:"bordered",label:a.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Iu(e.firstInstallmentDate,u)})},children:Mu.map(d=>t.jsx(c.SelectItem,{textValue:js(d),children:js(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(ma,{variant:"bordered",label:a.firstInstallmentDate,labelPlacement:"outside",value:mn(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(I,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",s),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function Vu({mode:e,installments:n,rowErrors:a,labels:s,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Ru(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const f=a.missingDateRows.has(d.id),m=a.invalidDateRows.has(d.id),h=a.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(ma,{variant:"bordered","aria-label":`${s.dueDate} ${u+1}`,isDisabled:ct(d.status),isInvalid:f||m,errorMessage:f?s.dueDateRequiredError:m?s.dateOrderError:void 0,value:mn(d.dueDate),onChange:x=>l(d.id,{dueDate:x?x.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Hu,{amount:d.amount,ariaLabel:`${s.amount} ${u+1}`,isDisabled:ct(d.status),isInvalid:h,errorMessage:s.amountGreaterThanZeroError,onAmountChange:x=>l(d.id,{amount:x})})}),t.jsx(qu,{isDisabled:n.length<=1,isPaid:ct(d.status),label:s.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const Uu=/^\d*(?:[.,]\d{0,2})?$/;function Hu({amount:e,ariaLabel:n,isDisabled:a,isInvalid:s,errorMessage:r,onAmountChange:i}){const[l,o]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:a,isInvalid:s,errorMessage:s?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Uu.test(u))return;o(u);const f=Number(u.replace(",","."));i(an(Number.isFinite(f)?f:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function qu({isDisabled:e,isPaid:n,label:a,onRemove:s}){const r=t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:s,"aria-label":a,children:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Wu({total:e,donationAmount:n,hasTotalMismatch:a,mode:s,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),h=an(n-e),x=Math.max(h,0),b=Math.max(-h,0),j=a?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):s==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),g=s==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:a?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:j})}function Yu(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,n)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const ws={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"},ti={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"},Gu={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:ti.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."},Ku={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Qu=[];function Zu({installments:e,currency:n,locale:a="en-US",showTitle:s=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Qu,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:h,onDeleteInstallment:x}){const[b,j]=p.useState(null),g={...Gu,...u},[w,N]=p.useState(""),S=new Intl.NumberFormat(a,{style:"currency",currency:n}),v=e.some(k=>ni(k)!==null),D=e.some(k=>k.status==="partially_refunded"),M=s?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:g.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:g.saved}):null]}):void 0,C=p.useMemo(()=>{const k=w.trim().toLowerCase();if(!k)return e;const _=new Intl.NumberFormat(a,{style:"currency",currency:n});return e.filter(A=>{const F=A.status??"scheduled";return[Dn(A),A.id,A.amount,A.dueDate,Kt(A.dueDate,a),En(A,g.paidOn,a),Fn(A,g.refundedAmount,_),F,Ln(F,g.partiallyRefunded)].join(" ").toLowerCase().includes(k)})},[a,n,e,w,g.paidOn,g.refundedAmount,g.partiallyRefunded]),E=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:g.searchPlaceholder,onChange:k=>N(k.target.value),startContent:t.jsx(I,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(B,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(I,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",C.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[C.map((k,_)=>{const A=k.status??"scheduled",F=Dn(k),R=En(k,g.paidOn,a),P=Fn(k,g.refundedAmount,S);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:F||`PMT-${_+1}`})]}),t.jsx(Ns,{status:A,label:Ln(A,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:S.format(k.amount)}),P?t.jsx("p",{className:"text-xs text-default-500",children:P}):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:Kt(k.dueDate,a)}),R?t.jsx("p",{className:"text-xs text-default-500",children:R}):null]})]}),t.jsx(Cs,{status:A,installment:k,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})]})},k.id)}),C.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",C.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:v?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:D?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:g.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:g.actions})]})}),t.jsxs("tbody",{children:[C.map((k,_)=>{const A=k.status??"scheduled",F=Dn(k),R=En(k,g.paidOn,a),P=Fn(k,g.refundedAmount,S);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:F||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[S.format(k.amount),P?t.jsx("span",{className:"block text-xs",children:P}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Kt(k.dueDate,a),R?t.jsx("span",{className:"block text-xs",children:R}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ns,{status:A,label:Ln(A,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Cs,{status:A,installment:k,labels:g,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:h,onDeleteInstallment:x})})]},k.id)}),C.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref: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(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:M,children:E},"installment-table")}):E})}function Dn(e){return e.name?.trim()||e.id}function En(e,n,a){return!ct(e.status)||!e.fulfilledAt?null:`${n} ${Kt(e.fulfilledAt,a)}`}function ni(e){const{refundedAmount:n}=e;return e.status!=="partially_refunded"||typeof n!="number"||!Number.isFinite(n)||n<=0?null:n}function Fn(e,n,a){const s=ni(e);return s===null?null:`${n} ${a.format(s)}`}function Ln(e,n){return e==="partially_refunded"?n:ti[e]??e}function Ns({status:e,label:n}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",ws[e]??ws.scheduled),startContent:t.jsx(Ju,{status:e}),children:n})}function Cs({status:e,installment:n,labels:a,portalContainer:s,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e),u=ct(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(B,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(I,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:a.payNow}):null,t.jsx(Xu,{isFulfilled:u,showDelete:r,labels:a,portalContainer:s,onDelete:()=>o(n.id)})]})}function Xu({isFulfilled:e,showDelete:n,labels:a,portalContainer:s,onDelete:r}){const[i,l]=p.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(B,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(I,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:a.sendLink,description:a.sendLinkDescription,startContent:t.jsx(I,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:a.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:a.dangerZone,children:t.jsx(c.DropdownItem,{textValue:a.deleteInstallment,className:"text-danger-600",color:"danger",description:a.deleteInstallmentDescription,startContent:t.jsx(I,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:a.deleteInstallment},"delete")}):null]})]}),n?t.jsx(ja,{isOpen:i,labels:{title:a.deleteInstallmentConfirmationTitle,description:a.deleteInstallmentConfirmationDescription,cancel:a.deleteInstallmentConfirmationCancel,confirm:a.deleteInstallmentConfirmationConfirm},icon:t.jsx(I,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:s,shouldBlockScroll:!1,classNames:Ku,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Ju({status:e}){return e==="paid"?t.jsx(I,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(I,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(I,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(I,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(I,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(I,{icon:"solar:calendar-outline",className:"size-3"})}const em=/^\d{4}-\d{2}-\d{2}$/;function Kt(e,n){const a=em.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(a.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(a)}const tm={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},nm=({cards:e,locale:n,currency:a,listHeightClassName:s="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const h=Array.isArray(e)?e:[],[x,b]=p.useState(o),[j,g]=p.useState(l),w={...tm,...r};p.useEffect(()=>{b(o)},[o]);const N=v=>{if(v===x){d&&f?.(v);return}b(v),f?.(v)},S=v=>{g(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:x??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(ii,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",s===""?"flex-1":c.cn("shrink-0",s)),"data-testid":"membership-select-cards-list",children:h.map(v=>t.jsx(ai,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:a,isSelected:x===v.id,onSelect:N},v.id))})]})},ai=({itemKey:e,name:n,type:a,price:s,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:h,statusTone:x="default",className:b=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(s),g=!!d&&!f,w=m||h,N=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),a&&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:a})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:x,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},ks="w-full bg-gray-100",Ss={variant:"light",color:"default"},si=({id:e,title:n,media:a,imageUrl:s,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:h=!1,isDisabled:x=!1,compact:b=!1,className:j="",bodyClassName:g="",footerClassName:w="",dataTestId:N})=>{const S=!!(d&&d.value),v=!!u?.label,D=h&&!!m&&!v,M=!D,C=v?{variant:u?.variant??Ss.variant,color:u?.color??Ss.color,size:u?.size??"sm",isDisabled:x||u?.isDisabled,startContent:u?.icon?t.jsx(I,{icon:u.icon,width:16}):void 0}:null,E=a??(s?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,ks,i),children:t.jsx(c.Image,{removeWrapper:!0,src:s,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,ks,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(I,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",j),isPressable:D,onPress:m,isDisabled:x,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:E}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:n}),o.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:o.map((k,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(I,{icon:k.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:k.label})]},`${k.label}-${_}`))}):null,(S||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",w),children:[S?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}),v&&M?t.jsx(B,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:C?.variant,color:C?.color,size:C?.size,startContent:C?.startContent,isDisabled:C?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};si.displayName="CatalogItemCard";const am={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},sm={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},rm={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},im={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},lm={card:"mt-1",panel:"mt-[22px]"},om="bg-acct-page border-acct-border text-acct-muted",cm={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},dm={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"},um={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"},mm={empty:"status",error:"alert",success:"status",loading:"status"},fm={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function xm(e,n,a,s){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:s.spinner});if(p.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:cm[e];return r?t.jsx(I,{icon:r,width:a,height:a,"aria-hidden":"true",className:s.icon}):null}function bt({variant:e="empty",surface:n="card",title:a,titleAs:s="p",description:r,icon:i,actions:l,role:o=mm[e],ariaLive:d=fm[e],iconSize:u=24,className:f,classNames:m={},"data-testid":h="feedback-state"}){const x=xm(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":h,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",am[n],n==="card"?dm[e]:"bg-transparent",f,m.base),children:[x?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn("inline-flex items-center justify-center",sm[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?om:um[e],m.iconWrapper),children:x}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(s,{"data-testid":`${h}-title`,className:c.cn(rm[n],m.title),children:a}),r?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(im[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${h}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",lm[n],m.actions),children:l}):null]})}function wa(e){return t.jsx(bt,{...e,variant:"empty"})}function Na(e){return t.jsx(bt,{...e,variant:"error"})}function Ca(e){return t.jsx(bt,{...e,variant:"loading"})}function ri(e){return t.jsx(bt,{...e,variant:"success"})}bt.displayName="FeedbackState";wa.displayName="EmptyState";Na.displayName="ErrorState";Ca.displayName="LoadingState";ri.displayName="SuccessState";const ii=({title:e,value:n,description:a,onValueChange:s,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||a?"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}),a&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:a})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:s,"data-testid":"toggle-switch"})]})},hm={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"},pm=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),li=e=>Object.values(e).reduce((n,a)=>n+Object.values(a).reduce((s,r)=>s+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),gm=e=>e.reduce((n,a)=>n+a.dates.reduce((s,r)=>s+r.tickets.reduce((i,l)=>i+l.max,0),0),0),ka=e=>e.flatMap(n=>n.dates.flatMap(a=>a.tickets.map(s=>({exhibition:n,dateGroup:a,ticket:s})))),$s=(e,n,a)=>{const s={};let r=a?n??gm(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of ka(e)){s[i.id]??={},s[i.id][l.id]??={};const d=a?Math.min(o.max,r):0;s[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return s},As=(e,n,a)=>`${e}::${n}::${a}`,bm=(e,n,a)=>{const s=li(n);for(const{exhibition:r,dateGroup:i,ticket:l}of ka(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=a===void 0?l.max:Math.min(l.max,a-(s-o));if(d>0&&o<d)return!1}return!0},ym=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:a=10,onChange:s,disabled:r=!1})=>{const i=Math.max(n,Math.min(a,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=a||s?.(i+1)},h=()=>{r||i<=n||s?.(i-1)},x=v=>{if(r)return;o(v.target.value);const D=parseInt(v.target.value,10);isNaN(D)||s?.(Math.max(n,Math.min(a,D)))},b=v=>{const D=parseInt(v.target.value,10);if(u(!1),isNaN(D)){s?.(n);return}const M=Math.max(n,Math.min(a,D));M!==D?s?.(M):o(String(M))},j=i<=n,g=i>=a,w="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",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:h,disabled:r||j,className:c.cn(w,r||j?S:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:x,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:a,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||g,className:c.cn(w,r||g?S:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},vm=({label:e,checked:n=!1,onChange:a,disabled:s=!1})=>{const r=()=>{s||a?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:s,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",s&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:s,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},jm=({item:e,quantity:n,onChange:a,getTotalSelectedTickets:s,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!s||r===void 0)return e.max;const m=s();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=pm(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(ym,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:a})]}),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]})},wm=({exhibitionId:e,dateGroup:n,isLast:a=!1,onQuantityChange:s,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!a&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(jm,{item:u,quantity:r(e,n.id,u.id),onChange:m=>s(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Nm=({title:e,exhibition:n,onQuantityChange:a,getTicketQuantity:s,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=n.dates.reduce((x,b)=>x+b.tickets.reduce((j,g)=>j+s(n.id,b.id,g.id),0),0),h=n.dates.some(x=>x.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(I,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:h?n.dates.map((x,b)=>t.jsx(wm,{exhibitionId:n.id,dateGroup:x,isLast:b===n.dates.length-1,onQuantityChange:a,getTicketQuantity:s,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},x.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},Cm=({initialExpanded:e=!1,userMaxLimit:n,labels:a,settings:s,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...hm,...a},[u,f]=p.useState(()=>$s(o,n,!0)),m=p.useRef(!1),h=p.useMemo(()=>{const N=ka(o).map(({exhibition:S,dateGroup:v,ticket:D})=>[As(S.id,v.id,D.id),D]);return new Map(N)},[o]),x=bm(o,u,n),b=(N,S,v)=>u[N]?.[S]?.[v]?.selectedQuantity??0,j=()=>li(u),g=(N,S,v,D)=>{const M=b(N,S,v),C=j()-M;if(n!==void 0&&C+D>n)return;const E=h.get(As(N,S,v));if(!E)return;const k={...u,[N]:{...u[N],[S]:{...u[N]?.[S],[v]:{id:v,selectedQuantity:D,originalPrice:E.originalPrice,discountedPrice:E.price}}}};f(k),l?.(k)},w=N=>{const S=$s(o,n,N);f(S),l?.(S)};return p.useEffect(()=>{!m.current&&x&&(l?.(u),m.current=!0)},[x,u,l]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(vm,{label:d.selectAllButtonLabel,checked:x,onChange:w})]}),o.map(N=>t.jsx(Nm,{title:N.exhibitionName,exhibition:N,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:j,userMaxLimit:n,settings:s,labels:d,initialExpanded:e},N.id))]})},Mn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},_n=e=>{const n={};for(const a of e)a.type==="checkbox"?n[a.id]=[...a.selectedValues]:n[a.id]=a.selectedValue?[a.selectedValue]:[];return n},km=(e,n)=>{const a={};for(const s of n){if(s.type==="checkbox"){a[s.id]=e[s.id]??[...s.selectedValues];continue}const r=e[s.id]??[];a[s.id]=r.length>0?r[0]:null}return a},Sm=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,oi=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:a="solar:tuning-square-outline",triggerVariant:s="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:h,countAriaLabel:x,countDisplay:b="badge",confirmLabel:j=Mn.confirm,clearLabel:g=Mn.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:S,isDisabled:v=!1,closeOnConfirm:D=!0,keepOpenAfterClear:M=!1})=>{const[C,E]=p.useState(N),[k,_]=p.useState(()=>_n(u)),A=w??C,F=h??u.filter(Y=>Sm(Y)).length,R=Y=>{Y&&_(_n(u)),w||E(Y),S?.(Y)},P=(Y,Q)=>{_(Z=>({...Z,[Y.id]:Q}))},q=(Y,Q)=>{_(Z=>({...Z,[Y.id]:Q?[Q]:[]}))},z=async()=>{_(_n(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),M||R(!1)},V=async()=>{const Y=km(k,u);await f(Y),D&&R(!1)},X=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:k[Y.id]??[],onValueChange:Z=>P(Y,Z),children:Y.options.map(Z=>t.jsx(c.Checkbox,{value:Z.value,isDisabled:Z.isDisabled,children:Z.label},Z.value))},Y.id);const Q=k[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:Q,onValueChange:Z=>q(Y,Z||null),children:Y.options.map(Z=>t.jsx(c.Radio,{value:Z.value,isDisabled:Z.isDisabled,children:Z.label},Z.value))},Y.id)},W=p.useMemo(()=>F>0?x?.(F)||`${F} filters applied`:void 0,[x,F]),ae=p.useMemo(()=>F===0?e||Mn.noLabel:x?x(F):`${e} (${F})`,[F,e,x]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:A,onOpenChange:R,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(B,{isDisabled:v,variant:s,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":A,children:[t.jsx(I,{icon:a,width:16}),t.jsx("span",{children:e}),b==="badge"&&F>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:F}):b==="summary"&&ae!==e?t.jsx("span",{className:"text-xs",children:ae}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>X(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(B,{variant:"light",color:"default",size:"sm",onPress:z,children:g}),t.jsx(B,{color:"primary",size:"sm",onPress:V,children:j})]})]})})]})})};oi.displayName="FilterPopover";const $m="No sessions available for this date",Am=e=>e==="sold-out"||e==="closed"?"danger":"success",Dm=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},Ds=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Em=(e,n)=>n&&e.some(a=>a.date===n)?n:e[0]?.date??null,ci=({heading:e,subheading:n,days:a,selectedDate:s,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=$m,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:h,calendarSlot:x,dayGroupAriaLabel:b,sessionGridAriaLabel:j,className:g,headingClassName:w,subheadingClassName:N})=>{const S=Em(a,s),v=a.find(k=>k.date===S),D=i??a.map(k=>({date:k.date,label:k.label})),M=v?.sessions??[],C=k=>k===S?"solid":"bordered",E=k=>{if(!Ds(k)){if(k.id===l){o(null);return}o(k.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",g),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",w),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[D.map(k=>t.jsx(B,{size:"sm",variant:C(k.date),color:"default",className:c.cn("rounded-full",h),isDisabled:k.isDisabled,onPress:()=>{r(k.date)},children:t.jsx("span",{children:k.label})},k.date)),x?t.jsx("div",{children:x}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"Sessions",children:[M.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,M.map(k=>{const _=Ds(k),A=k.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{E(k)},"aria-disabled":_,"aria-pressed":_?void 0:A,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",A?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(k,{isSelected:A,isUnavailable:_}):_?`${k.startTime} ${k.endTime} sold out`:`${k.startTime} ${k.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[k.startTime," – ",k.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(k):Am(k.status),variant:"flat",children:u?u(k):Dm(k)})]})})},k.id)})]})]})};ci.displayName="SessionTimeline";const Zn=16,Ze=e=>`${e/Zn}rem`;function Fm(){if(typeof document>"u"||typeof getComputedStyle!="function")return Zn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Zn}const Rt=(e,n)=>e>=n*Fm(),Lm=1120;function yt(){const e=p.useRef(null),[n,a]=p.useState(0),[,s]=p.useState("");return p.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(l=>{const o=l[l.length-1];o&&a(o.borderBoxSize?.[0]?.inlineSize??o.contentRect.width)});return a(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),p.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>s(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:n}}const Mm=48,Oe={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"},_m=(e,n)=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,di=({title:e,subtitle:n,eyebrow:a,icon:s,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header",list:f,narrow:m,headerRef:h})=>{const x=_m(s,r);return t.jsxs("header",{ref:h,"data-testid":u,"data-variant":f?"list":void 0,"data-size":f?m?"narrow":"wide":void 0,className:c.cn(f?c.cn(Oe.base,m?Oe.baseNarrow:Oe.baseWide):"flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:f?Oe.identity:"flex items-center gap-4",children:[x?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:x}):null,t.jsxs("div",{className:f?Oe.text:void 0,children:[a?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:a}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn(f?m?Oe.titleNarrow:Oe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(f?m?Oe.subtitleNarrow:Oe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(f?m?Oe.actionsNarrow:Oe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Rm=e=>{const{ref:n,width:a}=yt(),s=a>0&&!Rt(a,Mm);return t.jsx(di,{...e,list:!0,narrow:s,headerRef:n})},ui=e=>e.variant==="list"?t.jsx(Rm,{...e}):t.jsx(di,{...e,list:!1,narrow:!1});ui.displayName="PageHeader";const qe={ok:{fg:je.ok,bg:je["ok-fill"]},warn:{fg:je.warn,bg:je["warn-fill"]},danger:{fg:je.danger,bg:je["danger-fill"]},info:{fg:je.info,bg:je["info-fill"]},violet:{fg:je.violet,bg:je["violet-fill"]},neutral:{fg:je.neutral,bg:je["neutral-fill"]}};function Tt(e){if(e==="positive")return{color:je.ok};if(e==="negative")return{color:je.danger}}const Tm={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},Xn={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:qe.info,violet:qe.violet},Pm={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Im={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]"},Om={info:Xn.info,violet:Xn.violet},mi=({status:e,label:n,variant:a="flat",size:s="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(a==="plain"){const u=qe[Pm[e]];return t.jsxs("span",{"data-testid":o,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Im[s],"leading-[1.35]",l),style:{color:u.fg,backgroundColor:u.bg},children:[i,n]})}if(a==="dot"){const u=Xn[e];return t.jsxs("span",{"data-testid":o,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",l),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}const d=r?void 0:Om[e];return t.jsx(c.Chip,{color:r??Tm[e],variant:a,size:s,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:n})};mi.displayName="StatusChip";const zm={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"},Vt={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"},Sa=({label:e,value:n,size:a="sm",variant:s="default",className:r,"data-testid":i="key-value-chip"})=>s==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(Vt.base,Vt[a],r),children:[t.jsx("span",{className:Vt.label,children:e}),t.jsx("span",{className:Vt.value,children:n})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",zm[a],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Sa.displayName="KeyValueChip";const fi="(prefers-reduced-motion: reduce)",xi="data-pos-reduce-motion",Pt="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Bm="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",Qt=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Bm}`;function Vm(){return typeof document>"u"?!1:document.documentElement.getAttribute(xi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(fi).matches}function Um(){const[e,n]=p.useState(!1);return p.useEffect(()=>{const a=()=>n(Vm()),s=typeof window.matchMedia=="function"?window.matchMedia(fi):null;s?.addEventListener?.("change",a);const r=typeof MutationObserver>"u"?null:new MutationObserver(a);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[xi]}),a(),()=>{s?.removeEventListener?.("change",a),r?.disconnect()}},[]),e}const hi=({columns:e,rows:n=6,label:a="Loading",barHeight:s=12,alignLastRight:r=!1,appearance:i="pulse",className:l,classNames:o={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",l,o.base),children:[t.jsx("span",{className:"sr-only",children:a}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((u,f)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&x&&"flex justify-end"),children:t.jsx("div",{className:c.cn(Qt,o.bar),style:{height:Ze(s),width:m==="fill"?"60%":Ze(m),maxWidth:"100%"}})},h)})},f):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,h)=>{const x=h===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:s,width:m==="fill"?"60%":m}})},h)})},f))})]});hi.displayName="TableSkeleton";const pi="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",gi="px-4 text-[13.5px] text-acct-ink2 align-middle",bi="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",yi="w-full",vi="border-t border-acct-border px-5 py-3.5",Ut={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 ${Pt}`,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"},ji=({columns:e,children:n,emptyContent:a,footer:s,ariaLabel:r,variant:i="default",className:l,classNames:o={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&Ut.base,l,o.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(yi,o.table),th:c.cn(u?Ut.th:pi,o.th),tr:c.cn(u?Ut.tr:bi,o.tr),td:c.cn(u?Ut.td:gi,o.td)},children:[t.jsx(c.TableHeader,{columns:e,children:f=>t.jsx(c.TableColumn,{align:f.align==="right"?"end":"start",width:f.width,children:f.label},f.key)}),t.jsx(c.TableBody,{emptyContent:a,children:n})]}),s?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&vi,o.footer),children:s}):null]})};ji.displayName="AdminTable";const Hm={md:"w-[280px]",lg:"w-[360px]"},qm=48,ze={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[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",searchNarrow:"basis-full",inputBaseMd:"w-[15.625rem]",inputBaseLg:"w-[22.5rem]",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.4375rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0",icon:"flex text-default-400 [&_svg]:size-4"},Wm=({searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>{const{ref:f,width:m}=yt(),h=m>0&&!Rt(m,qm);return t.jsxs("div",{ref:f,role:"search","data-testid":u,"data-variant":"framed","data-size":h?"narrow":"wide",className:c.cn(ze.base,h&&ze.narrow,d),children:[i,t.jsx("div",{"data-testid":`${u}-search-slot`,className:h?ze.searchNarrow:ze.searchWide,children:t.jsx(c.Input,{type:"search","aria-label":a,placeholder:s??a,value:e,onValueChange:n,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-search-icon`,className:ze.icon,children:r??t.jsx(I,{icon:"lucide:search"})}),"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:h?ze.inputBaseNarrow:o==="lg"?ze.inputBaseLg:ze.inputBaseMd,inputWrapper:ze.inputWrapper,innerWrapper:ze.innerWrapper,input:ze.input}})}),l]})},wi=({searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,children:i,trailing:l,searchWidth:o="md",variant:d="default",className:u,"data-testid":f="admin-toolbar"})=>d==="framed"?t.jsx(Wm,{searchValue:e,onSearchChange:n,searchLabel:a,searchPlaceholder:s,searchIcon:r,trailing:l,searchWidth:o,className:u,"data-testid":f,children:i}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn("flex flex-wrap items-center gap-3 mb-4",u),children:[t.jsx(c.Input,{type:"search","aria-label":a,placeholder:s??a,value:e,onValueChange:n,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${f}-search`,variant:"bordered",radius:"none",classNames:{base:Hm[o],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"}}),i,l?t.jsx("div",{className:"ml-auto",children:l}):null]});wi.displayName="AdminToolbar";const Ym="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",Gm="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",Km="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",Ni=p.forwardRef(function({icon:n,children:a,count:s,appearance:r="pill",className:i,testId:l,...o},d){return r==="outline"?t.jsxs(B,{ref:d,"data-testid":l,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...o,children:[t.jsx(I,{icon:n,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:a}),s!==void 0&&s>0&&t.jsx("span",{className:Gm,children:s})]}):t.jsxs(B,{ref:d,"data-testid":l,variant:"light",size:"sm",className:c.cn(Km,i),...o,children:[t.jsx(I,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:a}),s!==void 0&&s>0&&t.jsx("span",{className:Ym,children:s})]})});Ni.displayName="ToolbarButton";function Ci({items:e,value:n,onChange:a,ariaLabel:s,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":s,variant:"underlined",selectedKey:n,onSelectionChange:l=>a(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Ci.displayName="UnderlineTabs";const $a="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Aa="font-normal normal-case tracking-normal",ki=["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(" "),Si="text-[13.5px] text-acct-ink",$i="bg-acct-page text-acct-muted cursor-default",Ai="mt-[5px] text-xs text-acct-sub",Di="mt-[5px] text-xs text-acct-danger",Ei=({children:e,suffix:n,className:a,"data-testid":s="admin-field-label"})=>t.jsxs("div",{"data-testid":s,className:c.cn($a,a),children:[e,n?t.jsxs("span",{className:Aa,children:[" ",n]}):null]});Ei.displayName="AdminFieldLabel";const Fi=({label:e,labelSuffix:n,value:a,onChange:s,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":h="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:Aa,children:[" ",n]})]}):e,value:a,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:s,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:$a,inputWrapper:ki,input:c.cn(Si,(o||l)&&"font-mono",l&&$i),description:Ai,errorMessage:Di}});Fi.displayName="AdminTextField";const Qm={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Li=({actions:e,size:n="md",className:a,"data-testid":s="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":s,className:c.cn("inline-flex gap-0.5",a),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(B,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${s}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Qm[n]),children:r.icon},r.key))});Li.displayName="RowActions";const Mi=({children:e,placeholder:n="Select…",onOpen:a,onClear:s,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(B,{variant:"light",radius:"none",disableAnimation:!0,onPress:a,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&s?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:s,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Mi.displayName="PickerRow";function _i(e,n,a){if(a<=0||n<=0||e<=0)return{from:0,to:0};const s=(e-1)*n+1;return s>a?{from:0,to:0}:{from:s,to:Math.min(a,e*n)}}const Ri=({page:e,pageSize:n,total:a,unit:s,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=_i(e,n,a),f=c.cn("font-semibold text-default-700",l.emphasis);return t.jsxs("p",{"data-testid":o,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:f,children:a}),s?t.jsxs(t.Fragment,{children:[" ",s]}):null]})};Ri.displayName="PaginationSummary";const fn="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",Qe={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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"},Zm={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]"},Xm={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:""}},Ti=({isLoading:e=!1,isError:n=!1,isEmpty:a=!1,loadingTitle:s="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:h,emptyIcon:x,emptyActions:b,emptyContent:j,children:g,toolbar:w,variant:N="default",className:S,classNames:v={},"data-testid":D="list-panel"})=>{const M=N==="framed",C={base:c.cn("border-0 bg-transparent py-12",v.state)},E=M?{base:c.cn("px-6 py-[3.625rem]",v.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:C;let k;return e?k=r??t.jsx(Ca,{title:s,classNames:C,"data-testid":`${D}-loading`}):n?k=f??t.jsx(Na,{title:i,description:l,classNames:C,"data-testid":`${D}-error`,actions:u??(d?t.jsx(B,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):a?k=j??t.jsx(wa,{surface:M?"panel":void 0,title:m,description:h,icon:x,actions:b,classNames:E,"data-testid":`${D}-empty`}):k=g,t.jsxs("section",{"data-testid":D,"data-variant":M?"framed":void 0,className:c.cn(M?`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`:"rounded-xl bg-white p-2 shadow-sm",S,v.base),children:[w,k]})};Ti.displayName="ListPanel";const Pi=(e,n)=>n<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${n}})?$`).test(e),sn=e=>{const n=Number.parseFloat(e.replace(",","."));return Number.isFinite(n)?n:null},Ii=(e,n)=>{const[a,s]=p.useState(()=>n(e)),r=(sn(a)??0)===(e??0)?a:n(e),i=p.useCallback(()=>{s(l=>{const o=sn(l);return o===null?"":String(o)})},[]);return{draft:r,setDraft:s,normalize:i}},Jm=350,ef={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}"},Rn=(e,n)=>Object.entries(n).reduce((a,[s,r])=>a.replace(`{${s}}`,r),e),tf=({dueAmount:e,received:n,defaultReceived:a=null,onChange:s,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...ef,...i},h=Mt(e.currency,r),x=n!==void 0,[b,j]=p.useState(a??null),g=x?n:b,{draft:w,setDraft:N,normalize:S}=Ii(g,q=>q==null?"":String(q)),v=p.useMemo(()=>{const q=typeof g=="number"&&Number.isFinite(g)?g:0,z=qn(q,e.value,e.currency,r);return{received:q,change:z>0?z:0,isValid:q>=e.value&&q>0}},[g,e.value,e.currency,r]),D=p.useCallback(q=>{const z=q.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),M=p.useCallback(q=>{if(l)return;const z=q.replace(/[^\d.,]/g,"");if(!Pi(z,h))return;const V=sn(z);if(V!==null&&o!==void 0&&V>o)return;N(z),x||j(V);const X=typeof V=="number"&&Number.isFinite(V)?V:0,W=qn(X,e.value,e.currency,r);s?.({received:X,change:W>0?W:0,isValid:X>=e.value&&X>0})},[x,l,e.value,e.currency,r,s,o,N,h]),C=v.isValid&&v.change>0,E=!v.isValid&&v.received>0,k=be(v.change,r,e.currency),_=be(e.value,r,e.currency),[A,F]=p.useState(""),R=p.useRef(null);p.useEffect(()=>{R.current&&clearTimeout(R.current);const q=C?Rn(m.changeMessageTemplate,{change:k}):"",z=C?Jm:0;return R.current=setTimeout(()=>F(q),z),()=>{R.current&&clearTimeout(R.current)}},[C,k,m.changeMessageTemplate]);const P=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:P,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:h===0?"numeric":"decimal",pattern:h===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:q=>M(q.target.value),onFocus:D,onBlur:S,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:E,errorMessage:E?Rn(m.insufficientMessageTemplate,{due:_}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),C&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:Rn(m.changeMessageTemplate,{change:k}),icon:t.jsx(I,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:A})]})},nf={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Es=()=>{const e=new Date,n=a=>String(a).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Oi=({dueAmount:e,value:n,defaultValue:a,onChange:s,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":h="check-tender-form"})=>{const x={...nf,...r},b=n!==void 0,[j,g]=p.useState({checkNumber:a?.checkNumber??"",bankName:a?.bankName??"",date:a?.date??Es()}),[w,N]=p.useState(!!a?.checkNumber),S=p.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Es()}:j,[b,n,j]),v=p.useCallback(A=>{b||g(A);const F=A.checkNumber.trim(),R={amount:e.value,checkNumber:F,bankName:A.bankName.trim()||void 0,date:i?void 0:A.date,isValid:F.length>0&&e.value>0};s?.(R)},[b,e.value,i,s]),D=p.useCallback(A=>F=>{o||(A==="checkNumber"&&F.length>0&&N(!0),v({...S,[A]:F}))},[S,v,o]),M=p.useCallback(()=>{o||N(!0)},[o]),C=w&&S.checkNumber.trim()==="",E=`${h}-check-number`,k=`${h}-bank-name`,_=`${h}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":h,children:[t.jsx(c.Input,{id:E,label:x.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:A=>D("checkNumber")(A.target.value),onBlur:M,placeholder:x.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:C,errorMessage:C?x.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${h}-check-number-input`}),!l&&t.jsx(c.Input,{id:k,label:x.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:A=>D("bankName")(A.target.value),placeholder:x.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:x.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:A=>D("date")(A.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${h}-date-input`,className:"sm:col-span-2"})]})};Oi.displayName="CheckTenderForm";const af={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},sf=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],zi=({dueAmount:e,methodOptions:n=sf,value:a,defaultValue:s,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...af,...i},m=a!==void 0,[h,x]=p.useState({method:s?.method??"",reference:s?.reference??""}),b=p.useMemo(()=>m?{method:a?.method??"",reference:a?.reference??""}:h,[m,a,h]),j=p.useCallback(D=>n.find(M=>M.value===D)?.label??"",[n]),g=p.useCallback(D=>{m||x(D);const M=j(D.method),C={amount:e.value,method:D.method,description:M,reference:D.reference.trim()||void 0,isValid:D.method!==""};r?.(C)},[m,e.value,r,j]),w=p.useCallback(D=>{if(o)return;const M=typeof D=="string"?D:Array.from(D)[0]?.toString()??"";g({...b,method:M})},[b,g,o]),N=p.useCallback(D=>{o||g({...b,reference:D})},[b,g,o]),S=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(He,{id:S,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:w,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(D=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${D.value}`,children:D.label},D.value))}),l&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:D=>N(D.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};zi.displayName="OtherTenderForm";const rf={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},lf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},of={pending:"warning",recorded:"success",failed:"danger"},cf=e=>e==="pending"||e==="recorded",df=e=>`#${e+1}`,Bi=({total:e,tenders:n,onRemove:a,locale:s="en-US",labels:r,hideCollectedList:i=!1,variant:l="banner",className:o,"data-testid":d="split-payment-summary"})=>{const u={...rf,...r},{collected:f,remaining:m,isComplete:h}=p.useMemo(()=>{const b=n.reduce((g,w)=>cf(w.status)?g+w.amount:g,0),j=Math.max(e.value-b,0);return{collected:b,remaining:j,isComplete:b>=e.value&&e.value>0}},[n,e.value]),x=b=>b==="pending"?u.statusPending:b==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",o),"data-testid":d,children:[l==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:h?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:be(h?f:m,s,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:h?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:be(h?f:m,s,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),n.map((b,j)=>t.jsx(uf,{index:j,tender:b,locale:s,currency:e.currency,removable:!!a&&b.status!=="recorded",onRemove:a?()=>a(b.id):void 0,statusLabel:x(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${j}`},b.id))]})]})};Bi.displayName="SplitPaymentSummary";const uf=({index:e,tender:n,locale:a,currency:s,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(I,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:df(e)}),t.jsx(I,{icon:lf[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:be(n.amount,a,s)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:of[n.status],startContent:n.status==="recorded"?t.jsx(I,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(I,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},mf=`
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 @@ ${a}${s}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,Vi=p.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:a,style:s,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:mf}),t.jsx("div",{ref:i,"data-testid":r,style:s,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",a),children:e})]}));Vi.displayName="ModalShell";const Ui=({title:e,subtitle:n,leading:a,titleClassName:s,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",s),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(V,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(I,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Ui.displayName="ModalShellHeader";const Hi=({children:e,columns:n=2,className:a,"data-testid":s="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",a),"data-testid":s,children:e});Hi.displayName="ModalShellFooter";const ff={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},xf={1:"grid-cols-1",2:"grid-cols-2"},Tn=e=>typeof e=="string"?t.jsx(I,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Ht="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",hf="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Fs="flex-none",pf=typeof window<"u"?p.useLayoutEffect:p.useEffect,Ls=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",qi=({options:e,selectedKey:n,onSelect:a,heading:s,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const h=e.find(x=>x.key===n);return i==="compact"?t.jsx(gf,{options:e,selectedKey:n,onSelect:a,ariaLabel:r,moreLabel:o,dataTestId:m,...s!==void 0?{heading:s}:{},...l!==void 0?{maxVisible:l}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[s&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:s}),t.jsx("div",{className:"md:hidden",children:t.jsx(He,{"aria-label":s?void 0:r,"aria-labelledby":s?`${m}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:x=>{const j=Array.from(x)[0];typeof j=="string"&&a(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:h?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Tn(h.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Tn(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":s?`${m}-heading`:void 0,"aria-label":s?void 0:r,className:c.cn("hidden md:grid gap-3",xf[u],ff[d]),children:e.map(x=>{const b=n===x.key;return t.jsxs(V,{variant:"bordered",radius:"lg","aria-pressed":b,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>a(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",b?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Tn(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};qi.displayName="TileSelect";function gf({options:e,selectedKey:n,onSelect:a,heading:s,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=p.useRef(null),f=p.useRef(null),m=p.useMemo(()=>e.map((E,C)=>({option:E,index:C})).filter(({option:E})=>E.alwaysInMenu!==!0).map(({index:E})=>E),[e]),h=m.length<e.length,x=p.useCallback(E=>{const C=m.map(A=>({index:A,priority:e[A]?.priority??0})).sort((A,F)=>A.priority-F.priority||F.index-A.index),R=new Set(C.slice(0,m.length-E).map(A=>A.index));return m.filter(A=>!R.has(A))},[e,m]),[b,j]=p.useState(e.length);pf(()=>{const E=u.current,C=f.current;if(!E||!C)return;const R=()=>{const F=Array.from(C.children),_=F.slice(0,e.length).map(Q=>Q.getBoundingClientRect().width),T=F[e.length]?.getBoundingClientRect().width??0,q=window.getComputedStyle(E),B=Number.parseFloat(q.columnGap)||0,U=E.clientWidth-(Number.parseFloat(q.paddingLeft)||0)-(Number.parseFloat(q.paddingRight)||0);if(U<=0||_.some(Q=>Q===0)){j(m.length);return}const K=Q=>{const le=h||Q<m.length,W=Q+(le?1:0);return x(Q).reduce((Z,ee)=>Z+(_[ee]??0),0)+(le?T:0)+B*(W-1)<=U};for(let Q=m.length;Q>=1;Q-=1)if(K(Q)){j(Q);return}j(1)};R();const A=new ResizeObserver(R);return A.observe(E),()=>A.disconnect()},[e,l,x,m,h]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),N=!h&&g===m.length-1&&b===m.length?m.length:g,S=h||N<m.length,v=new Set(x(N)),D=e.filter((E,C)=>v.has(C)),M=S?e.filter((E,C)=>!v.has(C)):[],k=M.find(E=>E.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"data-testid":d,children:[s&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:s}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":s?`${d}-heading`:void 0,"aria-label":s?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[D.map(E=>t.jsx(V,{variant:"light",radius:"full","aria-pressed":n===E.key,isDisabled:E.isDisabled,onPress:()=>a(E.key),"data-testid":E["data-testid"]??`${d}-${E.key}`,className:c.cn(Ht,Ls(n===E.key)),children:E.label},E.key)),M.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(V,{variant:"light",radius:"full","aria-pressed":k!==void 0,"data-testid":`${d}-more`,className:c.cn(Ht,"gap-1",k!==void 0?"min-w-0":"min-w-fit",Ls(k!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:k?.label??l}),t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:k?[k.key]:[],disabledKeys:M.filter(E=>E.isDisabled).map(E=>E.key),onAction:E=>a(String(E)),children:M.map(E=>t.jsx(c.DropdownItem,{textValue:E.label,...E.description!==void 0?{description:E.description}:{},"data-testid":E["data-testid"]??`${d}-${E.key}`,children:E.label},E.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:hf,children:[e.map(E=>t.jsx(V,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Ht,Fs),children:E.label},E.key)),t.jsxs(V,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Ht,Fs,"gap-1"),children:[l,t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const bf={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Wi=({total:e,label:n,locale:a="en-US",variant:s="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=bf[s];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:ge(e.value,a,e.currency)})]})};Wi.displayName="PaymentTotalBanner";const yf={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Yi=({title:e,subtitle:n,backdrop:a="white",exiting:s=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":s?"off":"polite","aria-hidden":s||void 0,"data-testid":i,"data-state":s?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",yf[a],s?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Yi.displayName="LoadingOverlay";const Da=({cashChange:e,label:n="Cash to return",secondaryLine:a,locale:s="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(I,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:ge(e.value,s,e.currency)}),a&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:a})]}),r&&t.jsx(V,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(I,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Da.displayName="PaymentCashChangeBanner";const Gi=({title:e,subtitle:n,emailLine:a,confirmationEmail:s,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(I,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),a&&s&&t.jsxs("p",{className:"text-default-700",children:[a,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:s})]})]}),m&&r&&t.jsx(Da,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(V,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Gi.displayName="PaymentSuccessView";const Ea=({heading:e,amountLabel:n,value:a,defaultValue:s,onChange:r,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:h=!1,className:x,"data-testid":b="payment-sub-amount-input"})=>{const j=`${b}-input`,g=p.useCallback(N=>{if(m!==void 0){const S=Number.parseFloat(N.replace(",","."));if(Number.isFinite(S)&&S>m)return}r?.(N)},[m,r]),w=p.useCallback(N=>{const S=N.currentTarget;requestAnimationFrame(()=>{S.isConnected&&S.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{id:j,label:n,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:a,defaultValue:s,onChange:N=>g(N.target.value),onFocus:w,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${b}-field`})]})};Ea.displayName="PaymentSubAmountInput";const vf={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"}},jf=e=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e,Ki=({isOpen:e,title:n,confirmLabel:a,onConfirm:s,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:h=!1,icon:x,"data-testid":b="confirm-dialog"})=>{const j=i??l??null,g=vf[d],w=h?null:jf(x??g.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:w}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),j!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-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(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(V,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(V,{color:g.confirmColor,variant:"solid",radius:"full",onPress:s,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:a})]})]})})};Ki.displayName="ConfirmDialog";const wf=60,Nf=(e,n,a=wf)=>n?e>a:e<-a,Qi=(e,n)=>Math.max(0,Math.min(e,n)),Cf=160,kf=(e,n,a=Cf)=>Math.min(e,Math.max(0,n-a)),Sf=(e,n,a)=>Qi(e-n,a),$f=(e,n,a)=>e!==null?Qi(e,a):n?a:0,Af=e=>e?"":"transition-[height] duration-300 ease-out",Df=e=>({onDrag:(n,a)=>{const s=e.open?e.fullHeight:0;e.setDragHeight(Sf(s,a?.offset?.y??0,e.fullHeight))},onDragEnd:(n,a)=>{Nf(a?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),dt=(e,n)=>ge(e.value,n,e.currency);function oe(e){return e!=null&&e!==!1&&e!==""}const Fa=({item:e,locale:n,onRemove:a,removeAriaLabel:s,showRemoveButton:r=!0,compact:i=!1})=>{const l=!!e.children&&e.children.length>0,o=!!a&&r,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:qe[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:"mr-2 whitespace-nowrap text-[13px] text-default-600 line-through",children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",children:dt(e.amount,n)}),o&&t.jsx(V,{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":s,"data-testid":`summary-remove-${e.id}`,onPress:()=>a(e.id),children:t.jsx(I,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),oe(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(I,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(I,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(I,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),l&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Fa,{item:u,locale:n,onRemove:a,removeAriaLabel:s,showRemoveButton:r,compact:i},u.id))})]})};Fa.displayName="SummaryItemRow";const Zi=({fee:e,locale:n,className:a})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",a),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:dt(e.amount,n)})]});Zi.displayName="SummaryServiceFeeRow";const La=({row:e,locale:n,emphasized:a,onRemove:s,removeAriaLabel:r,showRemoveButton:i=!0,compact:l=!1})=>{const o=!!s&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:l?"whitespace-nowrap":"whitespace-nowrap text-base",children:dt(e.amount,n)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:l?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:l?void 0:c.cn(a?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?t.jsxs("div",{className:"flex shrink-0 items-center",children:[d,t.jsx(V,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",l&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>s(e.id),children:t.jsx(I,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d]})};La.displayName="SummaryTotalsLineRow";const Xi=({pricesInLabel:e,currency:n,items:a,serviceFee:s,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:h=!1,classNames:x})=>{const b=(a?.length??0)>0;return t.jsxs(t.Fragment,{children:[!h&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),b?t.jsx("div",{className:c.cn(h?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:a.map(j=>t.jsx(Fa,{item:j,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:f,compact:h},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(Zi,{fee:s,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(h?"flex flex-col gap-1 border-t border-default-100 pt-3":"flex flex-col gap-4",x.totalsRows),children:r.map((j,g)=>t.jsx(La,{row:j,locale:i,emphasized:!h&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:h},j.key))})]})};Xi.displayName="SummaryBody";const Ji=({total:e,locale:n,compact:a=!1,className:s})=>{const r=a?"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`,s),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:dt(e.amount,n)})]})};Ji.displayName="SummaryGrandTotalRow";const el=({secondaryTotal:e,locale:n,className:a})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",a),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:dt(e.amount,n)})]});el.displayName="SummarySecondaryTotalRow";const rn=({action:e,disabledByLoading:n,className:a,testId:s="summary-cta"})=>t.jsx(V,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",a),"data-testid":s,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});rn.displayName="SummaryPrimaryCta";const tl=({title:e,total:n,secondaryTotal:a,locale:s,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(I,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:dt(n.amount,s)})]}),a&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:a.label}),t.jsx("span",{className:"whitespace-nowrap",children:dt(a.amount,s)})]})]})]})});tl.displayName="SummaryCollapseHeader";const nl=({cart:e,ariaLabel:n,onPress:a,className:s})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:a,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",s),children:[t.jsx(I,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});nl.displayName="SummaryCartButton";const al=({open:e,progress:n,dragging:a,primaryAction:s,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,onToggleOpen:d,classNames:u})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",u.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:[i&&t.jsx(nl,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),s&&t.jsx(rn,{action:s,disabledByLoading:r,className:c.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),s&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:t.jsx(rn,{action:s,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&t.jsx("div",{children:o})]});al.displayName="SummaryActionBar";const Ef="(max-width: 767px)",Ff=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Lf=(e=Ef)=>{const[n,a]=p.useState(()=>Ff(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e),r=()=>a(s.matches);return r(),s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),n},sl=({title:e="Summary",pricesInLabel:n="Prices are in",currency:a,locale:s="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:h,isOpen:x,onToggleOpen:b,defaultOpen:j=!1,primaryAction:g,isLoading:w=!1,onRemoveItem:N,showRemoveButton:S,ctaCaption:v,variant:D,cart:M,emptyState:k,labels:E,classNames:C={},density:R="default","data-testid":A="summary",className:F})=>{const _=E?.removeAriaLabel??"Remove item",T=E?.removeTotalRowAriaLabel??"Remove discount",q=E?.removePostTotalRowAriaLabel??"Remove applied code",B=E?.toggleAriaLabel??"Toggle summary",U=E?.cartAriaLabel??"View cart",K=R==="compact",Q=Lf(),W=h??(D??(Q?"mobile":"main"))==="mobile",[X,Z]=p.useState(j),ee=x!==void 0,ae=!W||(ee?x:X),te=p.useCallback(()=>{ee||Z(O=>!O),b?.()},[ee,b]),[ue,se]=p.useState(0),[Le,Me]=p.useState(null),Ee=p.useRef(null),Xe=p.useRef(null),Ie=p.useCallback(()=>{const O=Ee.current;O&&se(kf(O.scrollHeight,window.innerHeight))},[]),ut=p.useCallback(O=>{Xe.current?.disconnect(),Xe.current=null,Ee.current=O,O&&(Ie(),typeof ResizeObserver<"u"&&(Xe.current=new ResizeObserver(Ie),Xe.current.observe(O)))},[Ie]);p.useEffect(()=>(window.addEventListener("resize",Ie),()=>window.removeEventListener("resize",Ie)),[Ie]);const We=Df({open:ae,fullHeight:ue,setDragHeight:Me,onToggleOpen:te}),ne=Le!==null,ye=$f(Le,ae,ue),Ye=ue>0?Math.min(1,Math.max(0,ye/ue)):ae?1:0,It=t.jsx(Ji,{total:o,locale:s,compact:K,className:C.total}),Je=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(O=>t.jsx(La,{row:O,locale:s,emphasized:!1,onRemove:f,removeAriaLabel:q,showRemoveButton:S,compact:K},O.key))}),y=m&&t.jsx(el,{secondaryTotal:m,locale:s,className:C.secondaryTotal}),$=v!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",C.ctaCaption),children:v}),L=t.jsx(Xi,{pricesInLabel:n,currency:a,items:r,serviceFee:i,rows:l,locale:s,onRemoveItem:N,removeAriaLabel:_,onRemoveTotalRow:u,removeTotalRowAriaLabel:T,showRemoveButton:S,emptyState:k,compact:K,classNames:C});return W?t.jsxs(De.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:We.onDrag,onDragEnd:We.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)]",F,C.base),children:[t.jsx(tl,{title:e,total:o,secondaryTotal:m,locale:s,open:ae,progress:Ye,dragging:ne,toggleAriaLabel:B,onToggleOpen:te,classNames:C}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!ae,style:{height:ye},className:c.cn("min-h-0",ae&&!ne?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!ae&&"pointer-events-none",Af(ne)),children:t.jsxs("div",{ref:ut,className:K?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[L,!K&&t.jsx(c.Divider,{className:"bg-default-200"}),It,Je,y]})}),t.jsx(al,{open:ae,progress:Ye,dragging:ne,primaryAction:g,isLoading:w,cart:M,cartAriaLabel:U,ctaCaption:$,onToggleOpen:te,classNames:C})]}):t.jsxs("section",{"data-testid":A,className:c.cn(K?"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",F,C.base),children:[!K&&t.jsx("div",{className:c.cn("flex items-center justify-between",C.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",C.title),children:e})}),L,!K&&t.jsx(c.Divider,{className:"bg-default-200"}),It,Je,y,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(rn,{action:g,disabledByLoading:w,className:c.cn("w-full",C.cta)}),$]})};sl.displayName="Summary";const Mf={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},_f={backgroundColor:je.destructive,color:"#fff"},Ms="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Pn="absolute top-0 h-5 w-5 opacity-0",rl=({onClose:e,steps:n,activeStepId:a,subtitle:s,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":h="wizard-shell",children:x})=>{const b={...Mf,...f},j=n.filter(v=>v.state!=="skipped"),g=n.find(v=>v.id===a),w=Math.max(0,j.findIndex(v=>v.id===a)),N=r??e,S=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":h,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":`${h}-header`,children:[N&&t.jsx(V,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${h}-header-back`,startContent:t.jsx(I,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:S}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${h}-header-title`,children:g?.label??""}),s&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${h}-header-subtitle`,children:s})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${h}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(Pn,"left-0"),"data-testid":`${h}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(Pn,"left-6"),"data-testid":`${h}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(Pn,"left-12"),"data-testid":`${h}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${h}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:ge(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Ms,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${h}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Ms,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${h}-total-owes`,children:b.owesBadge})]}),t.jsx(V,{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"?_f:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${h}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${h}-stepper`,children:j.map((v,D)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",D<w&&"bg-pos-ok",D===w&&"bg-primary",D>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${h}-body`,children:x}),u]})};rl.displayName="WizardShell";const Rf=(e,n,a)=>Math.min(Math.max(e,n),a);function Jn(e,n,a){const s=Math.max(1,Math.trunc(n)),r=Rf(Math.trunc(a),0,s);if(r===s)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Mt(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/s),d=l-o*s;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Tf(e,n){return Jn(e,n,1)}const Pf=e=>Number.isFinite(e)?e.toFixed(2):"",ea=({value:e,expected:n,max:a,onChange:s,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),h=Math.abs(e-n)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",h?"border-primary bg-primary-50":"border-pos-line bg-white",l),"data-testid":o,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??Pf(e),onChange:x=>{const b=x.target.value,j=Number.parseFloat(b.replace(",","."));a!==void 0&&Number.isFinite(j)&&j>a+.004||(f(b),Number.isFinite(j)&&j>=0?s(j):b.trim()===""&&s(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};ea.displayName="AmountCell";const If={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"},Of="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",_s="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",In="absolute h-5 w-5 opacity-0",zf=e=>{const n=ge(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const a=Tf(e.paidAmount,e.quantity);return`${e.quantity} × ${ge(a.value,void 0,a.currency)} · ${n}`},il=({items:e,selections:n,onSelectionChange:a,onRestockToggle:s,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...If,...l},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":d,children:[e.map(m=>{const h=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),g=h?.quantity,w=h?.selected?Math.min(g??j,j):g??0,N=Jn(m.paidAmount,j,w).value,S=h?.amount??(h?.selected?N:0),v=w===0&&S>.004,D=k=>a(m.id,{selected:k.quantity>0||k.amount>.004,mode:"full",...k}),M=k=>{const E=Math.min(Math.max(k,0),j);D({quantity:E,amount:Jn(m.paidAmount,j,E).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":b,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${b}-icon`,children:t.jsx(I,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${b}-detail`,children:m.detail??zf(m)}),v&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${b}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:ge(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(ea,{value:S,expected:N,max:m.paidAmount.value,onChange:k=>D({quantity:w,amount:k}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),x?t.jsx("span",{className:Of,"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:_s,"aria-label":u.decrease.replace("{name}",m.name),disabled:w===0,onClick:()=>M(w-1),"data-testid":`${b}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${b}-qty-value`,children:w}),t.jsx("button",{type:"button",className:_s,"aria-label":u.increase.replace("{name}",m.name),disabled:w===j,onClick:()=>M(w+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),w>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(j))}),h?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(I,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),w>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(He,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:k=>{if(k==="all")return;const E=[...k][0];E&&(r?.(m.id,E),s(m.id,E==="stock"))},"data-testid":`${b}-restock`,children:f.map(k=>t.jsx(c.SelectItem,{children:k.label},k.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(In,"right-0 top-0 m-0 p-0"),isSelected:!!h?.selected,onValueChange:k=>a(m.id,{selected:k,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(In,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>D({quantity:w,amount:N}),className:c.cn(In,"left-5 top-0"),"data-testid":`${b}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(I,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",ge(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(ea,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(I,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};il.displayName="LineItemList";const ll=({children:e,className:n,"data-testid":a="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":a,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ll.displayName="MetaCard";const ol=({label:e,htmlFor:n,children:a,className:s,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",s),"data-testid":r,children:[t.jsx("label",{htmlFor:n,className:"text-[13px] font-medium text-default-600",children:e}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});ol.displayName="MetaCard.Row";const cl=({label:e,children:n,className:a,"data-testid":s="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",a),"data-testid":s,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});cl.displayName="MetaCard.Section";const Bf=Object.assign(ll,{Row:ol,Section:cl}),dl=({heading:e,icon:n="lucide:rotate-ccw",action:a,children:s,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(I,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),a&&t.jsxs("button",{type:"button",disabled:a.disabled,onClick:a.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(I,{icon:a.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),a.label]})]}),s]});dl.displayName="SectionPanel";const ul=({name:e,detail:n,icon:a="lucide:users",labels:s,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:a,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:s?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});ul.displayName="CustomerCard";const Vf={label:"Reason for the return",placeholder:"Select a reason…"},ml=({options:e,value:n,onChange:a,error:s,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...Vf,...r};return t.jsx(He,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:n?[n]:[],isInvalid:!!s,errorMessage:s,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&a(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};ml.displayName="ReasonSelect";const Uf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},fl=({value:e,onChange:n,maxLength:a,alwaysExpanded:s=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...Uf,...i},[u,f]=p.useState(e!=="");return s?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:a,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:a,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(V,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};fl.displayName="NotesField";const Hf={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},qf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Rs="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Ma=({tone:e,title:n,body:a,onRetry:s,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=Hf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(I,{icon:qf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:a}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[s&&t.jsx(V,{color:"primary",className:Rs,onPress:s,"data-testid":u,children:r}),t.jsx(V,{variant:"bordered",className:c.cn(Rs,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Ma.displayName="TenderBanner";const Wf={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"},Yf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},xl=({tenders:e,selectedTenderId:n,onSelect:a,onSplit:s,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...Wf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,children:[r&&t.jsx(Ma,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>a(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(I,{icon:Yf[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:ge(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:s,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};xl.displayName="TenderMethods";const Gf=e=>e.refunded!==null,Kf={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"},Qf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Zf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",hl=({parts:e,refundedSoFar:n,remaining:a,current:s,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":h="split-tender-panel"})=>{const x={...Kf,...f},b=e.filter(Gf),j=e.find(k=>k.tenderId===s.tenderId)?.label,g=!!(r?.length&&s.onTenderChange),w=Mt(a.currency),{draft:N,setDraft:S,normalize:v}=Ii(s.amount,String),D=p.useCallback(k=>{Pi(k,w)&&(S(k),s.onAmountChange(sn(k)??0))},[s,S,w]),M=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":h,children:[t.jsx("h3",{className:"sr-only","data-testid":`${h}-title`,children:x.title}),l&&t.jsx(Ma,{tone:M?"danger":"warning",title:M?x.declinedTitle:x.networkTitle,body:M?x.partDeclinedBody:x.partNetworkBody,onRetry:l.onRetry,retryLabel:x.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${h}-part-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{"data-testid":`${h}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:ge(a.value,void 0,a.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",ge(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Qf,children:x.refundedSoFar}),b.map((k,E)=>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":`${h}-part-${k.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",E+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(I,{icon:k.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:k.label}),k.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:k.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:ge(k.refunded.value,void 0,k.refunded.currency)}),t.jsx("span",{className:c.cn(Zf,k.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:k.status==="pending"?x.pending:x.succeeded})]},k.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${h}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:x.partHeading.replace("{n}",String(b.length+1))}),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":`${h}-amount-label`,children:x.amountForPart}),t.jsx(Ea,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:D,onBlur:v,maxAmount:a.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${h}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${h}-methods`,children:r?.map(k=>{const E=k.tenderId===s.tenderId;return t.jsxs("button",{type:"button","aria-pressed":E,disabled:k.disabled||d,onClick:()=>s.onTenderChange?.(k.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",E?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${h}-method-${k.tenderId}`,children:[k.icon&&t.jsx(I,{icon:k.icon,width:15,height:15,"aria-hidden":"true"}),k.label]},k.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(V,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:o,"data-testid":`${h}-back`,children:x.back}),t.jsx(V,{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":`${h}-submit`,children:x.submit})]})]})};hl.displayName="SplitTenderPanel";const Xf={label:"Supervisor authorization",placeholder:"••••"},pl=({pin:e,onChange:n,hint:a,error:s,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...Xf,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":l,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(I,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),a&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:a}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!s,errorMessage:s,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${l}-input`})]})};pl.displayName="PinField";const Jf={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}"},ex={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},tx="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ts="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",nx="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",ax=["email","print"],gl=({state:e,total:n,destinations:a,reason:s,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const h={...Jf,...u},x=n?ge(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:h.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&nx,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(I,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:h.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),s&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:h.reason.replace("{reason}",s)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ts,children:h.destinationsTitle}),a.map((b,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${j}-${b.status}`,children:[t.jsx("span",{className:"font-semibold",children:b.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:ge(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(tx,ex[b.status]),children:b.status==="succeeded"?h.succeeded:h.pending})]})]},`${b.label}-${j}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ts,children:h.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:ax.map(b=>{const j=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>l(b),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${b}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:h[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:h.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(V,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:h.done})})]})};gl.displayName="OutcomeView";const _e={base:"relative inline-grid min-w-[10.75rem] grid-cols-[minmax(0,1fr)]",baseActive:"max-w-[20rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[4.8125rem] text-[0.875rem] font-semibold",select:"w-full",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-[3.25rem]",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]"},bl=({label:e,value:n,options:a,onChange:s,clearLabel:r,minWidth:i,"data-testid":l="filter-select"})=>{const o=n!==null,d=o?a.find(f=>f.value===n)?.label:void 0,u=p.useRef(null);return t.jsxs("div",{ref:u,"data-testid":l,"data-slot":"filter-select","data-active":o?"true":void 0,title:d,className:c.cn(_e.base,o&&_e.baseActive),style:i===void 0?void 0:{minWidth:Qe(i)},children:[t.jsx(He,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:f=>{if(f==="all")return;const m=[...f][0];s(m===void 0?null:String(m))},"data-testid":`${l}-trigger`,classNames:{base:c.cn(_e.select,_e.cell),trigger:c.cn(_e.trigger,o&&_e.triggerActive),value:c.cn(_e.value,o&&_e.valueActive),selectorIcon:c.cn(o&&_e.iconActive)},children:a.map(f=>t.jsx(c.SelectItem,{children:f.label},f.value))}),d!==void 0&&t.jsx("span",{"aria-hidden":"true","data-testid":`${l}-sizer`,className:c.cn(_e.sizer,_e.cell),children:d}),o&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{s(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${l}-clear`,className:_e.clear,children:t.jsx(I,{icon:"lucide:x",className:_e.clearIcon,"aria-hidden":"true"})})]})};bl.displayName="FilterSelect";const nt={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"},yl=({status:e,onLoadMore:n,loadingLabel:a,errorLabel:s,retryLabel:r,endLabel:i,"data-testid":l="load-more-footer"})=>{const o=p.useRef(null),d=p.useRef(n),u=p.useRef(!1);return p.useEffect(()=>{d.current=n},[n]),p.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=o.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(h=>{u.current||!h.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":l,"data-status":"idle",className:nt.idle,children:t.jsx("div",{ref:o,"aria-hidden":"true","data-testid":`${l}-sentinel`,className:nt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":l,"data-status":"loading",role:"status","aria-live":"polite",className:nt.base,children:[t.jsx("span",{"aria-hidden":"true",className:nt.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${l}-loading`,children:a})]}):e==="error"?t.jsxs("div",{"data-testid":l,"data-status":"error",className:nt.base,children:[t.jsx("span",{role:"alert","data-testid":`${l}-error`,className:nt.error,children:s}),t.jsx(V,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${l}-retry`,children:r})]}):t.jsx("div",{"data-testid":l,"data-status":"end",className:i?nt.base:nt.idle,children:i&&t.jsx("span",{"data-testid":`${l}-end`,children:i})})};yl.displayName="LoadMoreFooter";const $e={base:"w-full",list:"m-0 list-none p-0",item:"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 ${Pt}`,headline:"flex items-baseline gap-2.5",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",chips:"mt-[0.5625rem] flex 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"},Ps=({item:e})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:$e.headline,children:[t.jsx("span",{className:$e.title,children:e.title}),oe(e.amount)&&t.jsx("span",{className:$e.amount,children:e.amount})]}),oe(e.chips)&&t.jsx("span",{className:$e.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:$e.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:$e.row,children:[t.jsx("span",{className:$e.rowLabel,children:n.label}),t.jsx("span",{className:$e.rowValue,children:n.value})]},a))})]}),vl=({items:e,ariaLabel:n,onSelect:a,loading:s=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:$e.base,children:s?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(l,o)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:$e.skeletonRow,children:[t.jsx("div",{className:Qt,style:{height:Qe(13),width:Qe(130)}}),t.jsx("div",{className:Qt,style:{height:Qe(11),width:"70%",marginTop:Qe(10)}}),t.jsx("div",{className:Qt,style:{height:Qe(11),width:"45%",marginTop:Qe(8)}})]},o))})}):t.jsx("ul",{"aria-label":n,className:$e.list,children:e.map(l=>t.jsx("li",{"data-testid":`${i}-item-${l.id}`,className:$e.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(l.id),className:c.cn($e.card,$e.cardInteractive),children:t.jsx(Ps,{item:l})}):t.jsx("div",{className:$e.card,children:t.jsx(Ps,{item:l})})},l.id))})});vl.displayName="CardList";const sx=48,J={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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 ${Pt}`,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"},jl=p.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([a])=>a!=="data-testid"))}));jl.displayName="CrumbBase";const wl=({breadcrumb:e,onBack:n,backLabel:a,title:s,meta:r,amountLabel:i,amount:l,amountCaption:o,recordId:d,chips:u,statItems:f,stats:m,banner:h,"data-testid":x="record-header"})=>{const{ref:b,width:j}=yt(),g=!Rt(j,sx),w=!!(f&&f.length>0),N=!!i||oe(l)||oe(o)||oe(d)||oe(u)||w;return t.jsxs("div",{ref:b,"data-testid":x,"data-size":g?"narrow":"wide",className:J.base,children:[t.jsxs("div",{"data-testid":`${x}-band`,className:J.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":a,"data-testid":`${x}-back`,className:J.back,children:t.jsx(I,{icon:"lucide:chevron-left",className:J.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:J.breadcrumb,list:J.breadcrumbList},itemClasses:{base:J.crumbBase,item:J.crumb,separator:J.crumbSeparator},children:e.map((S,v)=>t.jsx(c.BreadcrumbItem,{as:jl,"data-testid":`${x}-crumb-${v}`,isDisabled:!S.onClick&&v<e.length-1,onPress:S.onClick?()=>S.onClick?.():void 0,children:S.label},v))})]}),t.jsxs("div",{className:c.cn(J.body,g?J.bodyNarrow:J.bodyWide),children:[t.jsxs("div",{className:J.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(J.title,g?J.titleNarrow:J.titleWide),children:s}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:J.meta,children:r.map((S,v)=>t.jsxs("li",{className:J.metaLine,children:[S.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:J.metaIcon,children:S.icon}),t.jsx("span",{className:J.metaText,children:S.text})]},v))})]}),N&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(J.money,g?J.moneyNarrow:J.moneyWide),children:[i&&t.jsx("div",{className:J.amountLabel,children:i}),oe(l)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(J.amount,g?J.amountNarrow:J.amountWide),children:l}),oe(o)&&t.jsx("div",{className:J.amountCaption,children:o}),oe(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:J.recordId,children:d}),oe(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(J.chips,g?J.chipsNarrow:J.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:J.statItems,children:f?.map((S,v)=>t.jsxs("div",{"data-testid":`${x}-stat-${v}`,className:c.cn(J.stat,g?J.statNarrow:J.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${v}-label`,className:J.statLabel,children:S.label}),t.jsx("dd",{"data-testid":`${x}-stat-${v}-value`,className:J.statValue,style:S.tone?{color:qe[S.tone].fg}:void 0,children:S.value})]},S.id??v))})]})]}),oe(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:g?J.statsNarrow:J.statsWide,children:m}),oe(h)&&t.jsx("div",{"data-testid":`${x}-banner`,children:h})]})};wl.displayName="RecordHeader";const rx=50,kt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},Nl=({children:e,aside:n,"data-testid":a="record-layout"})=>{const{ref:s,width:r}=yt(),i=oe(n),l=i&&r>0&&Rt(r,rx),o=t.jsx("div",{"data-testid":`${a}-main`,className:kt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${a}-aside`,className:kt.aside,children:n},"aside"):null;return t.jsx("div",{ref:s,"data-testid":a,"data-layout":l?"split":"stacked",className:c.cn(kt.base,l?kt.split:kt.stacked),children:l?[o,d]:[d,o]})};Nl.displayName="RecordLayout";const ix=560,St={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"},Cl=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:a,width:s}=yt(),r=s>=Lm?Math.max(e.length,1):s>=ix?2:1;return t.jsx("div",{ref:a,"data-testid":n,"data-columns":r,className:St.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,l)=>t.jsxs("div",{"data-testid":`${n}-item-${l}`,className:St.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${l}-value`,className:St.value,style:i.tone?{color:qe[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${l}-label`,className:St.label,children:i.label}),oe(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${l}-caption`,className:St.caption,children:i.caption})]},l))})};Cl.displayName="StatTiles";const at={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 px-[0.875rem] py-[0.5625rem] 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:"text-[0.84375rem] leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"inline-flex items-center gap-[0.4375rem] whitespace-nowrap",count:"rounded-full bg-default-200 px-[0.4375rem] py-px text-[0.71875rem] leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},_a="pill-tabs",Ra=(e,n=_a)=>`${n}-tab-${e}`,Ta=(e,n=_a)=>`${n}-panel-${e}`,lx=(e,n=_a)=>({role:"tabpanel",id:Ta(e,n),"aria-labelledby":Ra(e,n),tabIndex:0}),kl=({items:e,value:n,onChange:a,ariaLabel:s,idPrefix:r,"data-testid":i="pill-tabs"})=>{const l=Um(),o=!!c.useProviderContext()?.disableAnimation,d=r??i;return t.jsx(c.Tabs,{"aria-label":s,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:n,onSelectionChange:u=>a(String(u)),"data-testid":i,classNames:{base:at.base,tabList:at.tabList,cursor:at.cursor,tab:c.cn(at.tab,(l||o)&&at.tabStill),tabContent:at.tabContent},children:e.map(u=>t.jsx(c.Tab,{id:Ra(u.key,d),"aria-controls":Ta(u.key,d),"data-testid":`${i}-${u.key}`,title:t.jsxs("span",{className:at.title,children:[u.label,u.count!==void 0&&t.jsx("span",{"data-testid":`${i}-${u.key}-count`,className:at.count,children:u.count})]})},u.key))})};kl.displayName="PillTabs";const xe={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Pt}`,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"},Is=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:xe.dot,style:{backgroundColor:qe[e.tone].fg}}),t.jsxs("span",{className:xe.body,children:[t.jsx("span",{className:xe.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:xe.meta,children:[e.reference!=null&&t.jsx("span",{className:xe.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:xe.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:xe.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:xe.detail,children:e.detail})]}),t.jsx("span",{className:xe.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${n}-amount`,className:xe.amount,style:Tt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:xe.note,style:e.noteTone==="warn"?{color:qe.warn.fg}:void 0,children:e.note}):null})]}),Sl=({rows:e,footer:n,emptyContent:a,onSelect:s,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:xe.base,children:a!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:xe.empty,children:a})}):t.jsxs("div",{"data-testid":r,className:xe.base,children:[t.jsx("ul",{className:xe.list,children:e.map(i=>{const l=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":l,className:xe.item,children:s?t.jsx("button",{type:"button",onClick:()=>s(i.id),className:c.cn(xe.row,xe.rowInteractive),children:t.jsx(Is,{row:i,testId:l})}):t.jsx("div",{className:xe.row,children:t.jsx(Is,{row:i,testId:l})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:xe.footer,children:[t.jsx("span",{className:xe.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:xe.footerAmount,style:Tt(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:xe.footerNote,children:n.note})]})]});Sl.displayName="AmountList";const Re={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"},$l=({events:e,emptyContent:n,"data-testid":a="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":a,children:n!=null&&t.jsx("div",{"data-testid":`${a}-empty`,className:Re.empty,children:n})}):t.jsx("ol",{"data-testid":a,className:Re.list,children:e.map((s,r)=>{const i=r===e.length-1,l=`${a}-event-${s.id}`;return t.jsxs("li",{"data-testid":l,className:c.cn(Re.event,!i&&Re.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Re.rail,children:[t.jsx("span",{className:Re.dot,style:{backgroundColor:qe[s.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${l}-connector`,className:Re.connector})]}),t.jsxs("div",{className:Re.body,children:[t.jsxs("div",{className:Re.head,children:[t.jsx("span",{className:Re.title,children:s.title}),t.jsx("span",{className:Re.timestamp,children:s.timestamp})]}),oe(s.detail)&&t.jsx("div",{className:Re.detail,children:s.detail}),oe(s.actor)&&t.jsx("div",{"data-testid":`${l}-actor`,className:Re.actor,children:s.actor})]})]},s.id)})});$l.displayName="ActivityTimeline";const ve={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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 ${Pt}`,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"},Os=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:ve.rowBody,children:[t.jsxs("span",{className:ve.rowHead,children:[t.jsx("span",{className:e.onSelect?ve.primaryLinked:ve.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:ve.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:ve.amount,style:Tt(e.amountTone),children:e.amount})]}),Al=({title:e,count:n,rows:a,emptyContent:s,"data-testid":r="related-record-list"})=>{const i=p.useId(),l=!!e;return t.jsxs("section",{"data-testid":r,role:l?"group":void 0,"aria-labelledby":l?i:void 0,className:ve.base,children:[l&&t.jsxs("div",{className:ve.header,children:[t.jsx("h3",{id:i,className:ve.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:ve.count,children:n})]}),a.length===0?!!s&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(ve.empty,!l&&ve.emptyHeadless),children:s}):t.jsx("ul",{className:ve.list,children:a.map((o,d)=>{const u=`${r}-row-${o.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(ve.item,d===0&&!l&&ve.itemFirstHeadless),children:o.onSelect?t.jsx("button",{type:"button",onClick:o.onSelect,className:c.cn(ve.row,ve.rowInteractive),children:t.jsx(Os,{row:o,testId:u})}):t.jsx("div",{className:ve.row,children:t.jsx(Os,{row:o,testId:u})})},o.id)})})]})};Al.displayName="RelatedRecordList";const Dl=({title:e,titleAs:n="h2",icon:a,count:s,badge:r,action:i,description:l,footer:o,variant:d="section",body:u="padded",children:f,"data-testid":m="record-card"})=>{const h=p.useId(),x=oe(e);return t.jsxs("section",{"data-testid":m,"data-variant":d,role:x?"group":void 0,"aria-labelledby":x?h:void 0,className:Ke.base,children:[x&&t.jsxs("div",{"data-testid":`${m}-header`,className:Zm[d],children:[oe(a)&&t.jsx("span",{"aria-hidden":"true",className:Ke.icon,children:a}),t.jsx(n,{id:h,className:Ke.title,children:e}),oe(s)&&t.jsx("span",{"data-testid":`${m}-count`,className:Ke.count,children:s}),r,oe(i)&&t.jsx("span",{"data-testid":`${m}-action`,className:Ke.action,children:i})]}),t.jsxs("div",{"data-testid":`${m}-body`,className:Xm[d][u],children:[oe(l)&&t.jsx("p",{"data-testid":`${m}-description`,className:Ke.description,children:l}),f,oe(o)&&t.jsx("div",{"data-testid":`${m}-footer`,className:c.cn(Ke.footer,oe(f)?Ke.footerAfterContent:Ke.footerAfterDescription),children:o})]})]})};Dl.displayName="RecordCard";const ox={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]"},El=({layout:e="stack",className:n,children:a,"data-testid":s="card-stack",...r})=>t.jsx("div",{...r,"data-testid":s,"data-layout":e,className:c.cn(ox[e],n),children:a});El.displayName="CardStack";const qt={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]"},cx={regular:"py-[0.5625rem]",compact:"py-2"},Fl=({rows:e,density:n="regular","data-testid":a="key-value-rows"})=>t.jsx("dl",{"data-testid":a,className:qt.list,children:e.map((s,r)=>t.jsxs("div",{"data-testid":`${a}-row-${s.id??r}`,className:c.cn(qt.row,cx[n]),children:[t.jsx("dt",{className:qt.label,children:s.label}),t.jsx("dd",{className:qt.value,children:s.value})]},s.id??r))});Fl.displayName="KeyValueRows";const Be={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},Ll=({items:e,ariaLabel:n,originalAmountLabel:a,"data-testid":s="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":s,className:Be.list,children:e.map(r=>{const i=`${s}-item-${r.id}`,l=oe(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Be.row,style:r.tone?{backgroundColor:qe[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Be.body,children:[t.jsx("div",{className:Be.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Be.details,children:r.details.map((o,d)=>t.jsxs(p.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Be.separator,children:"·"}),t.jsx("span",{className:Be.detail,children:o})]},d))})]}),t.jsxs("div",{className:Be.trailing,children:[t.jsxs("span",{className:Be.amounts,children:[l&&t.jsxs("s",{"data-testid":`${i}-original`,className:Be.original,children:[a&&t.jsxs("span",{className:"sr-only",children:[a," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Be.amount,style:l?{color:qe.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Ll.displayName="LineItemRows";const dx=37.5,Ne={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"},Ml=({rows:e,total:n,memo:a,"data-testid":s="record-totals"})=>{const{ref:r,width:i}=yt(),l=i>0&&!Rt(i,dx),o=l?Ne.rowNarrow:Ne.rowWide,d=l?Ne.labelNarrow:Ne.labelWide,u=l?Ne.noteNarrow:Ne.noteWide;return t.jsxs("div",{ref:r,"data-testid":s,"data-size":l?"narrow":"wide",className:Ne.base,children:[e.map(f=>{const m=`${s}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(o,Ne.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ne.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ne.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ne.value,style:Tt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ne.totalRule,children:t.jsxs("div",{"data-testid":`${s}-total`,className:c.cn(o,Ne.totalRow),children:[t.jsx("span",{className:c.cn(d,Ne.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${s}-total-value`,className:Ne.totalValue,children:n.value})]})}),oe(a)&&t.jsx("div",{"data-testid":`${s}-memo`,className:Ne.memo,children:a})]})};Ml.displayName="RecordTotals";const ta={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},ux={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},_l=({variant:e="text",tone:n,secondary:a,children:s,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(ta.base,ux[e]),style:Tt(n),children:[s,oe(a)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:ta.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),a]})]});_l.displayName="CellText";const Rl=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:ta.chipStack,children:e});Rl.displayName="ChipStack";exports.ActivityTimeline=$l;exports.AdminFieldLabel=Ei;exports.AdminTable=ji;exports.AdminTextField=Fi;exports.AdminToolbar=wi;exports.AmountList=Sl;exports.AppliedCodeCard=Js;exports.Button=V;exports.CardList=vl;exports.CardStack=El;exports.CashTenderForm=tf;exports.CatalogItemCard=si;exports.CellText=_l;exports.CheckTenderForm=Oi;exports.ChipStack=Rl;exports.CommitmentDetails=vu;exports.ConfirmDialog=Ki;exports.ConfirmationModal=ja;exports.ConfirmationPageTemplate=Hc;exports.CustomerCard=ul;exports.DatePicker=ma;exports.DimensionChip=Sa;exports.DonationAmounts=Dr;exports.EmptyState=wa;exports.ErrorState=Na;exports.EventDetails=Sd;exports.EventDetailsTemplate=Wc;exports.ExpireCartTimer=Er;exports.FeedbackState=bt;exports.FilterPopover=oi;exports.FilterSelect=bl;exports.Footer=Kc;exports.HeroUIProvider=xo;exports.HorizontalSteps=Cr;exports.InstallmentFundAssignment=hu;exports.InstallmentFundAssignmentSkeleton=bu;exports.InstallmentSchedule=Ou;exports.InstallmentScheduleSkeleton=Yu;exports.InstallmentTable=Zu;exports.ItemCard=ai;exports.KeyValueChip=Sa;exports.KeyValueRows=Fl;exports.LineItemList=il;exports.LineItemRows=Ll;exports.ListPanel=Ti;exports.LoadMoreFooter=yl;exports.LoadingOverlay=Yi;exports.LoadingState=Ca;exports.MembershipSelectCards=nm;exports.MetaCard=Bf;exports.ModalShell=Vi;exports.ModalShellFooter=Hi;exports.ModalShellHeader=Ui;exports.Multiselect=Qc;exports.Navbar=Uc;exports.NotesField=fl;exports.OfferCard=Jt;exports.OfferCardEmpty=Fr;exports.OfferCardError=Lr;exports.OfferCardList=Tr;exports.OfferCardSkeleton=Mr;exports.OtherTenderForm=zi;exports.OutcomeView=gl;exports.PageHeader=ui;exports.PaginationSummary=Ri;exports.PaymentCashChangeBanner=Da;exports.PaymentSubAmountInput=Ea;exports.PaymentSuccessView=Gi;exports.PaymentTotalBanner=Wi;exports.PickerRow=Mi;exports.PillTabs=kl;exports.PinField=pl;exports.RICH_TEXT_PRESETS=$r;exports.ReasonSelect=ml;exports.RecordCard=Dl;exports.RecordHeader=wl;exports.RecordLayout=Nl;exports.RecordTotals=Ml;exports.RedeemCodeInput=Oc;exports.RelatedRecordList=Al;exports.RevenueDistributionCard=Gr;exports.RevenueDistributionEmpty=Kr;exports.RevenueDistributionError=Qr;exports.RevenueDistributionSkeleton=Zr;exports.RichTextArea=Ar;exports.RowActions=Li;exports.SectionPanel=dl;exports.Select=He;exports.SessionTimeline=ci;exports.SplitPaymentSummary=Bi;exports.SplitTenderPanel=hl;exports.StatTiles=Cl;exports.StatusChip=mi;exports.Stepper=wr;exports.SuccessState=ri;exports.Summary=sl;exports.TableSkeleton=hi;exports.TenderMethods=xl;exports.TicketSelection=Cm;exports.TileSelect=qi;exports.Toggle=ii;exports.ToolbarButton=Ni;exports.UnderlineTabs=Ci;exports.WizardShell=rl;exports.adminFieldErrorClass=Di;exports.adminFieldHintClass=Ai;exports.adminFieldLabelClass=$a;exports.adminFieldLabelSuffixClass=Aa;exports.adminInputClass=Si;exports.adminInputReadOnlyClass=$i;exports.adminInputWrapperClass=ki;exports.adminRowClass=bi;exports.adminSurfaceCss=fo;exports.adminSurfaceTokens=aa;exports.adminTableClass=yi;exports.adminTableFooterClass=vi;exports.adminTdClass=gi;exports.adminThClass=pi;exports.calculateAllocationDifference=su;exports.computeChange=qn;exports.currencyFractionDigits=Mt;exports.formatMoney=ge;exports.formatOfferCurrency=Yn;exports.formatRevenueAmount=eu;exports.formatRevenueCurrency=tu;exports.generateAutomaticInstallments=ei;exports.generateDistributionId=va;exports.getCurrencySymbol=nu;exports.offerCardVariants=Rr;exports.offerListVariants=_r;exports.pageRange=_i;exports.parseOfferCurrency=$d;exports.parseRevenueCurrency=au;exports.pillTabId=Ra;exports.pillTabPanelId=Ta;exports.pillTabPanelProps=lx;exports.posSurfaceTokens=je;exports.roundToCurrency=Nr;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,Vi=p.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:a,style:s,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:mf}),t.jsx("div",{ref:i,"data-testid":r,style:s,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",a),children:e})]}));Vi.displayName="ModalShell";const Ui=({title:e,subtitle:n,leading:a,titleClassName:s,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",s),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(I,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Ui.displayName="ModalShellHeader";const Hi=({children:e,columns:n=2,className:a,"data-testid":s="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",a),"data-testid":s,children:e});Hi.displayName="ModalShellFooter";const ff={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},xf={1:"grid-cols-1",2:"grid-cols-2"},Tn=e=>typeof e=="string"?t.jsx(I,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Ht="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",hf="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Fs="flex-none",pf=typeof window<"u"?p.useLayoutEffect:p.useEffect,Ls=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",qi=({options:e,selectedKey:n,onSelect:a,heading:s,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:f,"data-testid":m="tile-select"})=>{const h=e.find(x=>x.key===n);return i==="compact"?t.jsx(gf,{options:e,selectedKey:n,onSelect:a,ariaLabel:r,moreLabel:o,dataTestId:m,...s!==void 0?{heading:s}:{},...l!==void 0?{maxVisible:l}:{},...f!==void 0?{className:f}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",f),"data-testid":m,children:[s&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${m}-heading`,children:s}),t.jsx("div",{className:"md:hidden",children:t.jsx(He,{"aria-label":s?void 0:r,"aria-labelledby":s?`${m}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:x=>{const j=Array.from(x)[0];typeof j=="string"&&a(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${m}-mobile-select`,startContent:h?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Tn(h.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(x=>t.jsx(c.SelectItem,{isDisabled:x.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Tn(x.icon)}),"data-testid":x["data-testid"]??`${m}-${x.key}-mobile`,children:x.label},x.key))})}),t.jsx("div",{role:"group","aria-labelledby":s?`${m}-heading`:void 0,"aria-label":s?void 0:r,className:c.cn("hidden md:grid gap-3",xf[u],ff[d]),children:e.map(x=>{const b=n===x.key;return t.jsxs(B,{variant:"bordered",radius:"lg","aria-pressed":b,"aria-label":x.label,isDisabled:x.isDisabled,onPress:()=>a(x.key),"data-testid":x["data-testid"]??`${m}-${x.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",b?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:Tn(x.icon)}),t.jsx("span",{className:"text-sm font-medium",children:x.label})]},x.key)})})]})};qi.displayName="TileSelect";function gf({options:e,selectedKey:n,onSelect:a,heading:s,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=p.useRef(null),f=p.useRef(null),m=p.useMemo(()=>e.map((E,k)=>({option:E,index:k})).filter(({option:E})=>E.alwaysInMenu!==!0).map(({index:E})=>E),[e]),h=m.length<e.length,x=p.useCallback(E=>{const k=m.map(A=>({index:A,priority:e[A]?.priority??0})).sort((A,F)=>A.priority-F.priority||F.index-A.index),_=new Set(k.slice(0,m.length-E).map(A=>A.index));return m.filter(A=>!_.has(A))},[e,m]),[b,j]=p.useState(e.length);pf(()=>{const E=u.current,k=f.current;if(!E||!k)return;const _=()=>{const F=Array.from(k.children),R=F.slice(0,e.length).map(W=>W.getBoundingClientRect().width),P=F[e.length]?.getBoundingClientRect().width??0,q=window.getComputedStyle(E),z=Number.parseFloat(q.columnGap)||0,V=E.clientWidth-(Number.parseFloat(q.paddingLeft)||0)-(Number.parseFloat(q.paddingRight)||0);if(V<=0||R.some(W=>W===0)){j(m.length);return}const X=W=>{const ae=h||W<m.length,Y=W+(ae?1:0);return x(W).reduce((Z,te)=>Z+(R[te]??0),0)+(ae?P:0)+z*(Y-1)<=V};for(let W=m.length;W>=1;W-=1)if(X(W)){j(W);return}j(1)};_();const A=new ResizeObserver(_);return A.observe(E),()=>A.disconnect()},[e,l,x,m,h]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),N=!h&&g===m.length-1&&b===m.length?m.length:g,S=h||N<m.length,v=new Set(x(N)),D=e.filter((E,k)=>v.has(k)),M=S?e.filter((E,k)=>!v.has(k)):[],C=M.find(E=>E.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"data-testid":d,children:[s&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:s}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":s?`${d}-heading`:void 0,"aria-label":s?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[D.map(E=>t.jsx(B,{variant:"light",radius:"full","aria-pressed":n===E.key,isDisabled:E.isDisabled,onPress:()=>a(E.key),"data-testid":E["data-testid"]??`${d}-${E.key}`,className:c.cn(Ht,Ls(n===E.key)),children:E.label},E.key)),M.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(B,{variant:"light",radius:"full","aria-pressed":C!==void 0,"data-testid":`${d}-more`,className:c.cn(Ht,"gap-1",C!==void 0?"min-w-0":"min-w-fit",Ls(C!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:C?.label??l}),t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:C?[C.key]:[],disabledKeys:M.filter(E=>E.isDisabled).map(E=>E.key),onAction:E=>a(String(E)),children:M.map(E=>t.jsx(c.DropdownItem,{textValue:E.label,...E.description!==void 0?{description:E.description}:{},"data-testid":E["data-testid"]??`${d}-${E.key}`,children:E.label},E.key))})]})]}),t.jsxs("div",{ref:f,"aria-hidden":"true",className:hf,children:[e.map(E=>t.jsx(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Ht,Fs),children:E.label},E.key)),t.jsxs(B,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(Ht,Fs,"gap-1"),children:[l,t.jsx(I,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const bf={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Wi=({total:e,label:n,locale:a="en-US",variant:s="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=bf[s];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:be(e.value,a,e.currency)})]})};Wi.displayName="PaymentTotalBanner";const yf={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Yi=({title:e,subtitle:n,backdrop:a="white",exiting:s=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":s?"off":"polite","aria-hidden":s||void 0,"data-testid":i,"data-state":s?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",yf[a],s?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Yi.displayName="LoadingOverlay";const Da=({cashChange:e,label:n="Cash to return",secondaryLine:a,locale:s="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(I,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:be(e.value,s,e.currency)}),a&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:a})]}),r&&t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(I,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Da.displayName="PaymentCashChangeBanner";const Gi=({title:e,subtitle:n,emailLine:a,confirmationEmail:s,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(I,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),a&&s&&t.jsxs("p",{className:"text-default-700",children:[a,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:s})]})]}),m&&r&&t.jsx(Da,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(B,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Gi.displayName="PaymentSuccessView";const Ea=({heading:e,amountLabel:n,value:a,defaultValue:s,onChange:r,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:u,autoFocus:f,maxAmount:m,hideHeading:h=!1,className:x,"data-testid":b="payment-sub-amount-input"})=>{const j=`${b}-input`,g=p.useCallback(N=>{if(m!==void 0){const S=Number.parseFloat(N.replace(",","."));if(Number.isFinite(S)&&S>m)return}r?.(N)},[m,r]),w=p.useCallback(N=>{const S=N.currentTarget;requestAnimationFrame(()=>{S.isConnected&&S.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{id:j,label:n,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:a,defaultValue:s,onChange:N=>g(N.target.value),onFocus:w,onBlur:i,placeholder:l,isDisabled:o,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:f,"data-testid":`${b}-field`})]})};Ea.displayName="PaymentSubAmountInput";const vf={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"}},jf=e=>typeof e=="string"?t.jsx(I,{icon:e,className:"size-5","aria-hidden":"true"}):e,Ki=({isOpen:e,title:n,confirmLabel:a,onConfirm:s,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:h=!1,icon:x,"data-testid":b="confirm-dialog"})=>{const j=i??l??null,g=vf[d],w=h?null:jf(x??g.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:w}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),j!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-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(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(B,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(B,{color:g.confirmColor,variant:"solid",radius:"full",onPress:s,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:a})]})]})})};Ki.displayName="ConfirmDialog";const wf=60,Nf=(e,n,a=wf)=>n?e>a:e<-a,Qi=(e,n)=>Math.max(0,Math.min(e,n)),Cf=160,kf=(e,n,a=Cf)=>Math.min(e,Math.max(0,n-a)),Sf=(e,n,a)=>Qi(e-n,a),$f=(e,n,a)=>e!==null?Qi(e,a):n?a:0,Af=e=>e?"":"transition-[height] duration-300 ease-out",Df=e=>({onDrag:(n,a)=>{const s=e.open?e.fullHeight:0;e.setDragHeight(Sf(s,a?.offset?.y??0,e.fullHeight))},onDragEnd:(n,a)=>{Nf(a?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),dt=(e,n)=>be(e.value,n,e.currency);function le(e){return e!=null&&e!==!1&&e!==""}const Fa=({item:e,locale:n,onRemove:a,removeAriaLabel:s,showRemoveButton:r=!0,compact:i=!1})=>{const l=!!e.children&&e.children.length>0,o=!!a&&r,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:qe[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:"mr-2 whitespace-nowrap text-[13px] text-default-600 line-through",children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",children:dt(e.amount,n)}),o&&t.jsx(B,{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":s,"data-testid":`summary-remove-${e.id}`,onPress:()=>a(e.id),children:t.jsx(I,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),le(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(I,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(I,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,f)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??f}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??f}`,className:"flex shrink-0 items-center",children:t.jsx(I,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??f)),l&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(Fa,{item:u,locale:n,onRemove:a,removeAriaLabel:s,showRemoveButton:r,compact:i},u.id))})]})};Fa.displayName="SummaryItemRow";const Zi=({fee:e,locale:n,className:a})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",a),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:dt(e.amount,n)})]});Zi.displayName="SummaryServiceFeeRow";const La=({row:e,locale:n,emphasized:a,onRemove:s,removeAriaLabel:r,showRemoveButton:i=!0,compact:l=!1})=>{const o=!!s&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:l?"whitespace-nowrap":"whitespace-nowrap text-base",children:dt(e.amount,n)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:l?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:l?void 0:c.cn(a?"text-xl font-semibold leading-7":"text-base"),children:e.label}),o?t.jsxs("div",{className:"flex shrink-0 items-center",children:[d,t.jsx(B,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",l&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>s(e.id),children:t.jsx(I,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d]})};La.displayName="SummaryTotalsLineRow";const Xi=({pricesInLabel:e,currency:n,items:a,serviceFee:s,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:f,emptyState:m,compact:h=!1,classNames:x})=>{const b=(a?.length??0)>0;return t.jsxs(t.Fragment,{children:[!h&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",x.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),b?t.jsx("div",{className:c.cn(h?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",x.items),children:a.map(j=>t.jsx(Fa,{item:j,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:f,compact:h},j.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(Zi,{fee:s,locale:i,className:x.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(h?"flex flex-col gap-1 border-t border-default-100 pt-3":"flex flex-col gap-4",x.totalsRows),children:r.map((j,g)=>t.jsx(La,{row:j,locale:i,emphasized:!h&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:f,compact:h},j.key))})]})};Xi.displayName="SummaryBody";const Ji=({total:e,locale:n,compact:a=!1,className:s})=>{const r=a?"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`,s),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:dt(e.amount,n)})]})};Ji.displayName="SummaryGrandTotalRow";const el=({secondaryTotal:e,locale:n,className:a})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",a),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:dt(e.amount,n)})]});el.displayName="SummarySecondaryTotalRow";const rn=({action:e,disabledByLoading:n,className:a,testId:s="summary-cta"})=>t.jsx(B,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",a),"data-testid":s,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(I,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});rn.displayName="SummaryPrimaryCta";const tl=({title:e,total:n,secondaryTotal:a,locale:s,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(I,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:dt(n.amount,s)})]}),a&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:a.label}),t.jsx("span",{className:"whitespace-nowrap",children:dt(a.amount,s)})]})]})]})});tl.displayName="SummaryCollapseHeader";const nl=({cart:e,ariaLabel:n,onPress:a,className:s})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:a,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",s),children:[t.jsx(I,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});nl.displayName="SummaryCartButton";const al=({open:e,progress:n,dragging:a,primaryAction:s,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,ctaError:d,onToggleOpen:u,classNames:f})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",f.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:[i&&t.jsx(nl,{cart:i,ariaLabel:l,className:f.cart,onPress:()=>{u?.(),i.onPress?.()}}),s&&t.jsx(rn,{action:s,disabledByLoading:r,className:c.cn("h-[52px] flex-1",f.cta),testId:"summary-cta-compact"})]}),s&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!a&&"transition-opacity duration-300"),children:t.jsx(rn,{action:s,disabledByLoading:r,className:c.cn("h-[52px] w-full",f.cta)})})]}),o&&t.jsx("div",{children:o})]});al.displayName="SummaryActionBar";const Ef="(max-width: 767px)",Ff=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Lf=(e=Ef)=>{const[n,a]=p.useState(()=>Ff(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e),r=()=>a(s.matches);return r(),s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),n},sl=({title:e="Summary",pricesInLabel:n="Prices are in",currency:a,locale:s="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:f,secondaryTotal:m,collapsible:h,isOpen:x,onToggleOpen:b,defaultOpen:j=!1,primaryAction:g,isLoading:w=!1,onRemoveItem:N,showRemoveButton:S,ctaCaption:v,ctaError:D,variant:M,cart:C,emptyState:E,labels:k,classNames:_={},density:A="default","data-testid":F="summary",className:R})=>{const P=k?.removeAriaLabel??"Remove item",q=k?.removeTotalRowAriaLabel??"Remove discount",z=k?.removePostTotalRowAriaLabel??"Remove applied code",V=k?.toggleAriaLabel??"Toggle summary",X=k?.cartAriaLabel??"View cart",W=A==="compact",ae=Lf(),Q=h??(M??(ae?"mobile":"main"))==="mobile",[Z,te]=p.useState(j),ce=x!==void 0,J=!Q||(ce?x:Z),me=p.useCallback(()=>{ce||te(T=>!T),b?.()},[ce,b]),[ne,Pe]=p.useState(0),[Ee,Le]=p.useState(null),ut=p.useRef(null),We=p.useRef(null),Ie=p.useCallback(()=>{const T=ut.current;T&&Pe(kf(T.scrollHeight,window.innerHeight))},[]),Ye=p.useCallback(T=>{We.current?.disconnect(),We.current=null,ut.current=T,T&&(Ie(),typeof ResizeObserver<"u"&&(We.current=new ResizeObserver(Ie),We.current.observe(T)))},[Ie]);p.useEffect(()=>(window.addEventListener("resize",Ie),()=>window.removeEventListener("resize",Ie)),[Ie]);const se=Df({open:J,fullHeight:ne,setDragHeight:Le,onToggleOpen:me}),he=Ee!==null,Ge=$f(Ee,J,ne),It=ne>0?Math.min(1,Math.max(0,Ge/ne)):J?1:0,Je=t.jsx(Ji,{total:o,locale:s,compact:W,className:_.total}),y=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(La,{row:T,locale:s,emphasized:!1,onRemove:f,removeAriaLabel:z,showRemoveButton:S,compact:W},T.key))}),$=m&&t.jsx(el,{secondaryTotal:m,locale:s,className:_.secondaryTotal}),L=v!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:v}),U=D!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:D}),O=t.jsx(Xi,{pricesInLabel:n,currency:a,items:r,serviceFee:i,rows:l,locale:s,onRemoveItem:N,removeAriaLabel:P,onRemoveTotalRow:u,removeTotalRowAriaLabel:q,showRemoveButton:S,emptyState:E,compact:W,classNames:_});return Q?t.jsxs(De.motion.section,{"data-testid":F,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:se.onDrag,onDragEnd:se.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",R,_.base),children:[t.jsx(tl,{title:e,total:o,secondaryTotal:m,locale:s,open:J,progress:It,dragging:he,toggleAriaLabel:V,onToggleOpen:me,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!J,style:{height:Ge},className:c.cn("min-h-0",J&&!he?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!J&&"pointer-events-none",Af(he)),children:t.jsxs("div",{ref:Ye,className:W?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[O,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Je,y,$]})}),t.jsx(al,{open:J,progress:It,dragging:he,primaryAction:g,isLoading:w,cart:C,cartAriaLabel:X,ctaCaption:L,ctaError:U,onToggleOpen:me,classNames:_})]}):t.jsxs("section",{"data-testid":F,className:c.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",R,_.base),children:[!W&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),O,!W&&t.jsx(c.Divider,{className:"bg-default-200"}),Je,y,$,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(rn,{action:g,disabledByLoading:w,className:c.cn("w-full",_.cta)}),U,L]})};sl.displayName="Summary";const Mf={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},_f={backgroundColor:je.destructive,color:"#fff"},Ms="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Pn="absolute top-0 h-5 w-5 opacity-0",rl=({onClose:e,steps:n,activeStepId:a,subtitle:s,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":h="wizard-shell",children:x})=>{const b={...Mf,...f},j=n.filter(v=>v.state!=="skipped"),g=n.find(v=>v.id===a),w=Math.max(0,j.findIndex(v=>v.id===a)),N=r??e,S=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":h,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":`${h}-header`,children:[N&&t.jsx(B,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${h}-header-back`,startContent:t.jsx(I,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:S}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${h}-header-title`,children:g?.label??""}),s&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${h}-header-subtitle`,children:s})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${h}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(Pn,"left-0"),"data-testid":`${h}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(Pn,"left-6"),"data-testid":`${h}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(Pn,"left-12"),"data-testid":`${h}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${h}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:be(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Ms,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${h}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Ms,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${h}-total-owes`,children:b.owesBadge})]}),t.jsx(B,{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"?_f:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${h}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${h}-stepper`,children:j.map((v,D)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",D<w&&"bg-pos-ok",D===w&&"bg-primary",D>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${h}-body`,children:x}),u]})};rl.displayName="WizardShell";const Rf=(e,n,a)=>Math.min(Math.max(e,n),a);function Jn(e,n,a){const s=Math.max(1,Math.trunc(n)),r=Rf(Math.trunc(a),0,s);if(r===s)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Mt(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/s),d=l-o*s;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Tf(e,n){return Jn(e,n,1)}const Pf=e=>Number.isFinite(e)?e.toFixed(2):"",ea=({value:e,expected:n,max:a,onChange:s,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),h=Math.abs(e-n)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",h?"border-primary bg-primary-50":"border-pos-line bg-white",l),"data-testid":o,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??Pf(e),onChange:x=>{const b=x.target.value,j=Number.parseFloat(b.replace(",","."));a!==void 0&&Number.isFinite(j)&&j>a+.004||(f(b),Number.isFinite(j)&&j>=0?s(j):b.trim()===""&&s(0))},onFocus:x=>x.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};ea.displayName="AmountCell";const If={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"},Of="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",_s="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",In="absolute h-5 w-5 opacity-0",zf=e=>{const n=be(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const a=Tf(e.paidAmount,e.quantity);return`${e.quantity} × ${be(a.value,void 0,a.currency)} · ${n}`},il=({items:e,selections:n,onSelectionChange:a,onRestockToggle:s,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...If,...l},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":d,children:[e.map(m=>{const h=n[m.id],x=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,j=Math.max(1,Math.trunc(m.quantity)),g=h?.quantity,w=h?.selected?Math.min(g??j,j):g??0,N=Jn(m.paidAmount,j,w).value,S=h?.amount??(h?.selected?N:0),v=w===0&&S>.004,D=C=>a(m.id,{selected:C.quantity>0||C.amount>.004,mode:"full",...C}),M=C=>{const E=Math.min(Math.max(C,0),j);D({quantity:E,amount:Jn(m.paidAmount,j,E).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",x&&"opacity-60"),"data-testid":b,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${b}-icon`,children:t.jsx(I,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${b}-detail`,children:m.detail??zf(m)}),v&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${b}-partial`,children:[x?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:be(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(ea,{value:S,expected:N,max:m.paidAmount.value,onChange:C=>D({quantity:w,amount:C}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),x?t.jsx("span",{className:Of,"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:_s,"aria-label":u.decrease.replace("{name}",m.name),disabled:w===0,onClick:()=>M(w-1),"data-testid":`${b}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${b}-qty-value`,children:w}),t.jsx("button",{type:"button",className:_s,"aria-label":u.increase.replace("{name}",m.name),disabled:w===j,onClick:()=>M(w+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),w>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(j))}),h?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(I,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),w>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(He,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:C=>{if(C==="all")return;const E=[...C][0];E&&(r?.(m.id,E),s(m.id,E==="stock"))},"data-testid":`${b}-restock`,children:f.map(C=>t.jsx(c.SelectItem,{children:C.label},C.key))})]})]}),!x&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(In,"right-0 top-0 m-0 p-0"),isSelected:!!h?.selected,onValueChange:C=>a(m.id,{selected:C,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(In,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>D({quantity:w,amount:N}),className:c.cn(In,"left-5 top-0"),"data-testid":`${b}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(I,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",be(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(ea,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(I,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};il.displayName="LineItemList";const ll=({children:e,className:n,"data-testid":a="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":a,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ll.displayName="MetaCard";const ol=({label:e,htmlFor:n,children:a,className:s,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",s),"data-testid":r,children:[t.jsx("label",{htmlFor:n,className:"text-[13px] font-medium text-default-600",children:e}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});ol.displayName="MetaCard.Row";const cl=({label:e,children:n,className:a,"data-testid":s="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",a),"data-testid":s,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});cl.displayName="MetaCard.Section";const Bf=Object.assign(ll,{Row:ol,Section:cl}),dl=({heading:e,icon:n="lucide:rotate-ccw",action:a,children:s,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(I,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),a&&t.jsxs("button",{type:"button",disabled:a.disabled,onClick:a.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(I,{icon:a.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),a.label]})]}),s]});dl.displayName="SectionPanel";const ul=({name:e,detail:n,icon:a="lucide:users",labels:s,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:a,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:s?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});ul.displayName="CustomerCard";const Vf={label:"Reason for the return",placeholder:"Select a reason…"},ml=({options:e,value:n,onChange:a,error:s,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...Vf,...r};return t.jsx(He,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:n?[n]:[],isInvalid:!!s,errorMessage:s,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&a(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};ml.displayName="ReasonSelect";const Uf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},fl=({value:e,onChange:n,maxLength:a,alwaysExpanded:s=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...Uf,...i},[u,f]=p.useState(e!=="");return s?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:a,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:a,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(B,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};fl.displayName="NotesField";const Hf={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},qf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Rs="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Ma=({tone:e,title:n,body:a,onRetry:s,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=Hf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(I,{icon:qf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:a}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[s&&t.jsx(B,{color:"primary",className:Rs,onPress:s,"data-testid":u,children:r}),t.jsx(B,{variant:"bordered",className:c.cn(Rs,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Ma.displayName="TenderBanner";const Wf={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"},Yf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},xl=({tenders:e,selectedTenderId:n,onSelect:a,onSplit:s,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...Wf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,children:[r&&t.jsx(Ma,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>a(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(I,{icon:Yf[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:be(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:s,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(I,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};xl.displayName="TenderMethods";const Gf=e=>e.refunded!==null,Kf={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"},Qf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Zf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",hl=({parts:e,refundedSoFar:n,remaining:a,current:s,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":h="split-tender-panel"})=>{const x={...Kf,...f},b=e.filter(Gf),j=e.find(C=>C.tenderId===s.tenderId)?.label,g=!!(r?.length&&s.onTenderChange),w=Mt(a.currency),{draft:N,setDraft:S,normalize:v}=Ii(s.amount,String),D=p.useCallback(C=>{Pi(C,w)&&(S(C),s.onAmountChange(sn(C)??0))},[s,S,w]),M=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":h,children:[t.jsx("h3",{className:"sr-only","data-testid":`${h}-title`,children:x.title}),l&&t.jsx(Ma,{tone:M?"danger":"warning",title:M?x.declinedTitle:x.networkTitle,body:M?x.partDeclinedBody:x.partNetworkBody,onRetry:l.onRetry,retryLabel:x.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:x.chooseDifferent,className:"mb-[18px]","data-testid":`${h}-part-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{"data-testid":`${h}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:x.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:be(a.value,void 0,a.currency)}),t.jsxs("span",{className:"sr-only",children:[x.refundedSoFar,": ",be(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Qf,children:x.refundedSoFar}),b.map((C,E)=>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":`${h}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",E+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(I,{icon:C.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:C.label}),C.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:C.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:be(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(Zf,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?x.pending:x.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${h}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:x.partHeading.replace("{n}",String(b.length+1))}),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":`${h}-amount-label`,children:x.amountForPart}),t.jsx(Ea,{heading:x.amountForPart,amountLabel:x.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:D,onBlur:v,maxAmount:a.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${h}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${h}-methods`,children:r?.map(C=>{const E=C.tenderId===s.tenderId;return t.jsxs("button",{type:"button","aria-pressed":E,disabled:C.disabled||d,onClick:()=>s.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",E?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${h}-method-${C.tenderId}`,children:[C.icon&&t.jsx(I,{icon:C.icon,width:15,height:15,"aria-hidden":"true"}),C.label]},C.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(B,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:o,"data-testid":`${h}-back`,children:x.back}),t.jsx(B,{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":`${h}-submit`,children:x.submit})]})]})};hl.displayName="SplitTenderPanel";const Xf={label:"Supervisor authorization",placeholder:"••••"},pl=({pin:e,onChange:n,hint:a,error:s,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...Xf,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":l,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(I,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),a&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:a}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!s,errorMessage:s,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${l}-input`})]})};pl.displayName="PinField";const Jf={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}"},ex={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},tx="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ts="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",nx="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",ax=["email","print"],gl=({state:e,total:n,destinations:a,reason:s,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const h={...Jf,...u},x=n?be(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:h.processing}),x&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:x})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&nx,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(I,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:h.title}),x&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:x}),s&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:h.reason.replace("{reason}",s)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ts,children:h.destinationsTitle}),a.map((b,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${j}-${b.status}`,children:[t.jsx("span",{className:"font-semibold",children:b.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:be(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(tx,ex[b.status]),children:b.status==="succeeded"?h.succeeded:h.pending})]})]},`${b.label}-${j}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ts,children:h.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:ax.map(b=>{const j=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>l(b),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${b}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:h[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:h.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(B,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:h.done})})]})};gl.displayName="OutcomeView";const Me={base:"relative inline-grid min-w-[10.75rem] grid-cols-[minmax(0,1fr)]",baseActive:"max-w-[20rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[4.8125rem] text-[0.875rem] font-semibold",select:"w-full",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-[3.25rem]",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]"},bl=({label:e,value:n,options:a,onChange:s,clearLabel:r,minWidth:i,"data-testid":l="filter-select"})=>{const o=n!==null,d=o?a.find(f=>f.value===n)?.label:void 0,u=p.useRef(null);return t.jsxs("div",{ref:u,"data-testid":l,"data-slot":"filter-select","data-active":o?"true":void 0,title:d,className:c.cn(Me.base,o&&Me.baseActive),style:i===void 0?void 0:{minWidth:Ze(i)},children:[t.jsx(He,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:n===null?[]:[n],onSelectionChange:f=>{if(f==="all")return;const m=[...f][0];s(m===void 0?null:String(m))},"data-testid":`${l}-trigger`,classNames:{base:c.cn(Me.select,Me.cell),trigger:c.cn(Me.trigger,o&&Me.triggerActive),value:c.cn(Me.value,o&&Me.valueActive),selectorIcon:c.cn(o&&Me.iconActive)},children:a.map(f=>t.jsx(c.SelectItem,{children:f.label},f.value))}),d!==void 0&&t.jsx("span",{"aria-hidden":"true","data-testid":`${l}-sizer`,className:c.cn(Me.sizer,Me.cell),children:d}),o&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{s(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${l}-clear`,className:Me.clear,children:t.jsx(I,{icon:"lucide:x",className:Me.clearIcon,"aria-hidden":"true"})})]})};bl.displayName="FilterSelect";const nt={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"},yl=({status:e,onLoadMore:n,loadingLabel:a,errorLabel:s,retryLabel:r,endLabel:i,"data-testid":l="load-more-footer"})=>{const o=p.useRef(null),d=p.useRef(n),u=p.useRef(!1);return p.useEffect(()=>{d.current=n},[n]),p.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const f=o.current;if(!f||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(h=>{u.current||!h.some(x=>x.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(f),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":l,"data-status":"idle",className:nt.idle,children:t.jsx("div",{ref:o,"aria-hidden":"true","data-testid":`${l}-sentinel`,className:nt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":l,"data-status":"loading",role:"status","aria-live":"polite",className:nt.base,children:[t.jsx("span",{"aria-hidden":"true",className:nt.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${l}-loading`,children:a})]}):e==="error"?t.jsxs("div",{"data-testid":l,"data-status":"error",className:nt.base,children:[t.jsx("span",{role:"alert","data-testid":`${l}-error`,className:nt.error,children:s}),t.jsx(B,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:n,testId:`${l}-retry`,children:r})]}):t.jsx("div",{"data-testid":l,"data-status":"end",className:i?nt.base:nt.idle,children:i&&t.jsx("span",{"data-testid":`${l}-end`,children:i})})};yl.displayName="LoadMoreFooter";const $e={base:"w-full",list:"m-0 list-none p-0",item:"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 ${Pt}`,headline:"flex items-baseline gap-2.5",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",chips:"mt-[0.5625rem] flex 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"},Ps=({item:e})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:$e.headline,children:[t.jsx("span",{className:$e.title,children:e.title}),le(e.amount)&&t.jsx("span",{className:$e.amount,children:e.amount})]}),le(e.chips)&&t.jsx("span",{className:$e.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:$e.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:$e.row,children:[t.jsx("span",{className:$e.rowLabel,children:n.label}),t.jsx("span",{className:$e.rowValue,children:n.value})]},a))})]}),vl=({items:e,ariaLabel:n,onSelect:a,loading:s=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:$e.base,children:s?t.jsx("div",{role:"status","aria-busy":"true","aria-label":n,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(l,o)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:$e.skeletonRow,children:[t.jsx("div",{className:Qt,style:{height:Ze(13),width:Ze(130)}}),t.jsx("div",{className:Qt,style:{height:Ze(11),width:"70%",marginTop:Ze(10)}}),t.jsx("div",{className:Qt,style:{height:Ze(11),width:"45%",marginTop:Ze(8)}})]},o))})}):t.jsx("ul",{"aria-label":n,className:$e.list,children:e.map(l=>t.jsx("li",{"data-testid":`${i}-item-${l.id}`,className:$e.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(l.id),className:c.cn($e.card,$e.cardInteractive),children:t.jsx(Ps,{item:l})}):t.jsx("div",{className:$e.card,children:t.jsx(Ps,{item:l})})},l.id))})});vl.displayName="CardList";const sx=48,ee={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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 ${Pt}`,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"},jl=p.forwardRef((e,n)=>t.jsx("li",{ref:n,...Object.fromEntries(Object.entries(e).filter(([a])=>a!=="data-testid"))}));jl.displayName="CrumbBase";const wl=({breadcrumb:e,onBack:n,backLabel:a,title:s,meta:r,amountLabel:i,amount:l,amountCaption:o,recordId:d,chips:u,statItems:f,stats:m,banner:h,"data-testid":x="record-header"})=>{const{ref:b,width:j}=yt(),g=!Rt(j,sx),w=!!(f&&f.length>0),N=!!i||le(l)||le(o)||le(d)||le(u)||w;return t.jsxs("div",{ref:b,"data-testid":x,"data-size":g?"narrow":"wide",className:ee.base,children:[t.jsxs("div",{"data-testid":`${x}-band`,className:ee.band,children:[n&&t.jsx("button",{type:"button",onClick:n,"aria-label":a,"data-testid":`${x}-back`,className:ee.back,children:t.jsx(I,{icon:"lucide:chevron-left",className:ee.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${x}-breadcrumb`,classNames:{base:ee.breadcrumb,list:ee.breadcrumbList},itemClasses:{base:ee.crumbBase,item:ee.crumb,separator:ee.crumbSeparator},children:e.map((S,v)=>t.jsx(c.BreadcrumbItem,{as:jl,"data-testid":`${x}-crumb-${v}`,isDisabled:!S.onClick&&v<e.length-1,onPress:S.onClick?()=>S.onClick?.():void 0,children:S.label},v))})]}),t.jsxs("div",{className:c.cn(ee.body,g?ee.bodyNarrow:ee.bodyWide),children:[t.jsxs("div",{className:ee.identity,children:[t.jsx("h1",{"data-testid":`${x}-title`,className:c.cn(ee.title,g?ee.titleNarrow:ee.titleWide),children:s}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${x}-meta`,className:ee.meta,children:r.map((S,v)=>t.jsxs("li",{className:ee.metaLine,children:[S.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:ee.metaIcon,children:S.icon}),t.jsx("span",{className:ee.metaText,children:S.text})]},v))})]}),N&&t.jsxs("div",{"data-testid":`${x}-money`,className:c.cn(ee.money,g?ee.moneyNarrow:ee.moneyWide),children:[i&&t.jsx("div",{className:ee.amountLabel,children:i}),le(l)&&t.jsx("div",{"data-testid":`${x}-amount`,className:c.cn(ee.amount,g?ee.amountNarrow:ee.amountWide),children:l}),le(o)&&t.jsx("div",{className:ee.amountCaption,children:o}),le(d)&&t.jsx("div",{"data-testid":`${x}-record-id`,className:ee.recordId,children:d}),le(u)&&t.jsx("div",{"data-testid":`${x}-chips`,className:c.cn(ee.chips,g?ee.chipsNarrow:ee.chipsWide),children:u}),w&&t.jsx("dl",{"data-testid":`${x}-stat-items`,className:ee.statItems,children:f?.map((S,v)=>t.jsxs("div",{"data-testid":`${x}-stat-${v}`,className:c.cn(ee.stat,g?ee.statNarrow:ee.statWide),children:[t.jsx("dt",{"data-testid":`${x}-stat-${v}-label`,className:ee.statLabel,children:S.label}),t.jsx("dd",{"data-testid":`${x}-stat-${v}-value`,className:ee.statValue,style:S.tone?{color:qe[S.tone].fg}:void 0,children:S.value})]},S.id??v))})]})]}),le(m)&&t.jsx("div",{"data-testid":`${x}-stats`,className:g?ee.statsNarrow:ee.statsWide,children:m}),le(h)&&t.jsx("div",{"data-testid":`${x}-banner`,children:h})]})};wl.displayName="RecordHeader";const rx=50,kt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},Nl=({children:e,aside:n,"data-testid":a="record-layout"})=>{const{ref:s,width:r}=yt(),i=le(n),l=i&&r>0&&Rt(r,rx),o=t.jsx("div",{"data-testid":`${a}-main`,className:kt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${a}-aside`,className:kt.aside,children:n},"aside"):null;return t.jsx("div",{ref:s,"data-testid":a,"data-layout":l?"split":"stacked",className:c.cn(kt.base,l?kt.split:kt.stacked),children:l?[o,d]:[d,o]})};Nl.displayName="RecordLayout";const ix=560,St={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"},Cl=({items:e,"data-testid":n="stat-tiles"})=>{const{ref:a,width:s}=yt(),r=s>=Lm?Math.max(e.length,1):s>=ix?2:1;return t.jsx("div",{ref:a,"data-testid":n,"data-columns":r,className:St.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,l)=>t.jsxs("div",{"data-testid":`${n}-item-${l}`,className:St.tile,children:[t.jsx("div",{"data-testid":`${n}-item-${l}-value`,className:St.value,style:i.tone?{color:qe[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${n}-item-${l}-label`,className:St.label,children:i.label}),le(i.caption)&&t.jsx("div",{"data-testid":`${n}-item-${l}-caption`,className:St.caption,children:i.caption})]},l))})};Cl.displayName="StatTiles";const at={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 px-[0.875rem] py-[0.5625rem] 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:"text-[0.84375rem] leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"inline-flex items-center gap-[0.4375rem] whitespace-nowrap",count:"rounded-full bg-default-200 px-[0.4375rem] py-px text-[0.71875rem] leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},_a="pill-tabs",Ra=(e,n=_a)=>`${n}-tab-${e}`,Ta=(e,n=_a)=>`${n}-panel-${e}`,lx=(e,n=_a)=>({role:"tabpanel",id:Ta(e,n),"aria-labelledby":Ra(e,n),tabIndex:0}),kl=({items:e,value:n,onChange:a,ariaLabel:s,idPrefix:r,"data-testid":i="pill-tabs"})=>{const l=Um(),o=!!c.useProviderContext()?.disableAnimation,d=r??i;return t.jsx(c.Tabs,{"aria-label":s,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:n,onSelectionChange:u=>a(String(u)),"data-testid":i,classNames:{base:at.base,tabList:at.tabList,cursor:at.cursor,tab:c.cn(at.tab,(l||o)&&at.tabStill),tabContent:at.tabContent},children:e.map(u=>t.jsx(c.Tab,{id:Ra(u.key,d),"aria-controls":Ta(u.key,d),"data-testid":`${i}-${u.key}`,title:t.jsxs("span",{className:at.title,children:[u.label,u.count!==void 0&&t.jsx("span",{"data-testid":`${i}-${u.key}-count`,className:at.count,children:u.count})]})},u.key))})};kl.displayName="PillTabs";const xe={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Pt}`,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"},Is=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:xe.dot,style:{backgroundColor:qe[e.tone].fg}}),t.jsxs("span",{className:xe.body,children:[t.jsx("span",{className:xe.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:xe.meta,children:[e.reference!=null&&t.jsx("span",{className:xe.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:xe.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:xe.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:xe.detail,children:e.detail})]}),t.jsx("span",{className:xe.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${n}-amount`,className:xe.amount,style:Tt(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${n}-note`,className:xe.note,style:e.noteTone==="warn"?{color:qe.warn.fg}:void 0,children:e.note}):null})]}),Sl=({rows:e,footer:n,emptyContent:a,onSelect:s,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:xe.base,children:a!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:xe.empty,children:a})}):t.jsxs("div",{"data-testid":r,className:xe.base,children:[t.jsx("ul",{className:xe.list,children:e.map(i=>{const l=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":l,className:xe.item,children:s?t.jsx("button",{type:"button",onClick:()=>s(i.id),className:c.cn(xe.row,xe.rowInteractive),children:t.jsx(Is,{row:i,testId:l})}):t.jsx("div",{className:xe.row,children:t.jsx(Is,{row:i,testId:l})})},i.id)})}),n&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:xe.footer,children:[t.jsx("span",{className:xe.footerLabel,children:n.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:xe.footerAmount,style:Tt(n.amountTone),children:n.amount})]}),n.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:xe.footerNote,children:n.note})]})]});Sl.displayName="AmountList";const _e={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},$l=({events:e,emptyContent:n,"data-testid":a="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":a,children:n!=null&&t.jsx("div",{"data-testid":`${a}-empty`,className:_e.empty,children:n})}):t.jsx("ol",{"data-testid":a,className:_e.list,children:e.map((s,r)=>{const i=r===e.length-1,l=`${a}-event-${s.id}`;return t.jsxs("li",{"data-testid":l,className:c.cn(_e.event,!i&&_e.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:_e.rail,children:[t.jsx("span",{className:_e.dot,style:{backgroundColor:qe[s.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${l}-connector`,className:_e.connector})]}),t.jsxs("div",{className:_e.body,children:[t.jsxs("div",{className:_e.head,children:[t.jsx("span",{className:_e.title,children:s.title}),t.jsx("span",{className:_e.timestamp,children:s.timestamp})]}),le(s.detail)&&t.jsx("div",{className:_e.detail,children:s.detail}),le(s.actor)&&t.jsx("div",{"data-testid":`${l}-actor`,className:_e.actor,children:s.actor})]})]},s.id)})});$l.displayName="ActivityTimeline";const ve={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${fn}`,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 ${Pt}`,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"},Os=({row:e,testId:n})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:ve.rowBody,children:[t.jsxs("span",{className:ve.rowHead,children:[t.jsx("span",{className:e.onSelect?ve.primaryLinked:ve.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:ve.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${n}-amount`,className:ve.amount,style:Tt(e.amountTone),children:e.amount})]}),Al=({title:e,count:n,rows:a,emptyContent:s,"data-testid":r="related-record-list"})=>{const i=p.useId(),l=!!e;return t.jsxs("section",{"data-testid":r,role:l?"group":void 0,"aria-labelledby":l?i:void 0,className:ve.base,children:[l&&t.jsxs("div",{className:ve.header,children:[t.jsx("h3",{id:i,className:ve.title,children:e}),n!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:ve.count,children:n})]}),a.length===0?!!s&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(ve.empty,!l&&ve.emptyHeadless),children:s}):t.jsx("ul",{className:ve.list,children:a.map((o,d)=>{const u=`${r}-row-${o.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(ve.item,d===0&&!l&&ve.itemFirstHeadless),children:o.onSelect?t.jsx("button",{type:"button",onClick:o.onSelect,className:c.cn(ve.row,ve.rowInteractive),children:t.jsx(Os,{row:o,testId:u})}):t.jsx("div",{className:ve.row,children:t.jsx(Os,{row:o,testId:u})})},o.id)})})]})};Al.displayName="RelatedRecordList";const Dl=({title:e,titleAs:n="h2",icon:a,count:s,badge:r,action:i,description:l,footer:o,variant:d="section",body:u="padded",children:f,"data-testid":m="record-card"})=>{const h=p.useId(),x=le(e);return t.jsxs("section",{"data-testid":m,"data-variant":d,role:x?"group":void 0,"aria-labelledby":x?h:void 0,className:Qe.base,children:[x&&t.jsxs("div",{"data-testid":`${m}-header`,className:Zm[d],children:[le(a)&&t.jsx("span",{"aria-hidden":"true",className:Qe.icon,children:a}),t.jsx(n,{id:h,className:Qe.title,children:e}),le(s)&&t.jsx("span",{"data-testid":`${m}-count`,className:Qe.count,children:s}),r,le(i)&&t.jsx("span",{"data-testid":`${m}-action`,className:Qe.action,children:i})]}),t.jsxs("div",{"data-testid":`${m}-body`,className:Xm[d][u],children:[le(l)&&t.jsx("p",{"data-testid":`${m}-description`,className:Qe.description,children:l}),f,le(o)&&t.jsx("div",{"data-testid":`${m}-footer`,className:c.cn(Qe.footer,le(f)?Qe.footerAfterContent:Qe.footerAfterDescription),children:o})]})]})};Dl.displayName="RecordCard";const ox={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]"},El=({layout:e="stack",className:n,children:a,"data-testid":s="card-stack",...r})=>t.jsx("div",{...r,"data-testid":s,"data-layout":e,className:c.cn(ox[e],n),children:a});El.displayName="CardStack";const qt={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]"},cx={regular:"py-[0.5625rem]",compact:"py-2"},Fl=({rows:e,density:n="regular","data-testid":a="key-value-rows"})=>t.jsx("dl",{"data-testid":a,className:qt.list,children:e.map((s,r)=>t.jsxs("div",{"data-testid":`${a}-row-${s.id??r}`,className:c.cn(qt.row,cx[n]),children:[t.jsx("dt",{className:qt.label,children:s.label}),t.jsx("dd",{className:qt.value,children:s.value})]},s.id??r))});Fl.displayName="KeyValueRows";const Be={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},Ll=({items:e,ariaLabel:n,originalAmountLabel:a,"data-testid":s="line-item-rows"})=>t.jsx("ul",{"aria-label":n,"data-testid":s,className:Be.list,children:e.map(r=>{const i=`${s}-item-${r.id}`,l=le(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Be.row,style:r.tone?{backgroundColor:qe[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Be.body,children:[t.jsx("div",{className:Be.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Be.details,children:r.details.map((o,d)=>t.jsxs(p.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Be.separator,children:"·"}),t.jsx("span",{className:Be.detail,children:o})]},d))})]}),t.jsxs("div",{className:Be.trailing,children:[t.jsxs("span",{className:Be.amounts,children:[l&&t.jsxs("s",{"data-testid":`${i}-original`,className:Be.original,children:[a&&t.jsxs("span",{className:"sr-only",children:[a," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Be.amount,style:l?{color:qe.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});Ll.displayName="LineItemRows";const dx=37.5,Ne={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"},Ml=({rows:e,total:n,memo:a,"data-testid":s="record-totals"})=>{const{ref:r,width:i}=yt(),l=i>0&&!Rt(i,dx),o=l?Ne.rowNarrow:Ne.rowWide,d=l?Ne.labelNarrow:Ne.labelWide,u=l?Ne.noteNarrow:Ne.noteWide;return t.jsxs("div",{ref:r,"data-testid":s,"data-size":l?"narrow":"wide",className:Ne.base,children:[e.map(f=>{const m=`${s}-row-${f.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(o,Ne.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Ne.label),children:f.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Ne.note),children:f.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Ne.value,style:Tt(f.tone),children:f.value})]},f.id)}),t.jsx("div",{className:Ne.totalRule,children:t.jsxs("div",{"data-testid":`${s}-total`,className:c.cn(o,Ne.totalRow),children:[t.jsx("span",{className:c.cn(d,Ne.totalLabel),children:n.label}),t.jsx("span",{"data-testid":`${s}-total-value`,className:Ne.totalValue,children:n.value})]})}),le(a)&&t.jsx("div",{"data-testid":`${s}-memo`,className:Ne.memo,children:a})]})};Ml.displayName="RecordTotals";const ta={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},ux={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},_l=({variant:e="text",tone:n,secondary:a,children:s,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(ta.base,ux[e]),style:Tt(n),children:[s,le(a)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:ta.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),a]})]});_l.displayName="CellText";const Rl=({children:e,"data-testid":n="chip-stack"})=>t.jsx("span",{"data-testid":n,className:ta.chipStack,children:e});Rl.displayName="ChipStack";exports.ActivityTimeline=$l;exports.AdminFieldLabel=Ei;exports.AdminTable=ji;exports.AdminTextField=Fi;exports.AdminToolbar=wi;exports.AmountList=Sl;exports.AppliedCodeCard=Js;exports.Button=B;exports.CardList=vl;exports.CardStack=El;exports.CashTenderForm=tf;exports.CatalogItemCard=si;exports.CellText=_l;exports.CheckTenderForm=Oi;exports.ChipStack=Rl;exports.CommitmentDetails=vu;exports.ConfirmDialog=Ki;exports.ConfirmationModal=ja;exports.ConfirmationPageTemplate=Hc;exports.CustomerCard=ul;exports.DatePicker=ma;exports.DimensionChip=Sa;exports.DonationAmounts=Dr;exports.EmptyState=wa;exports.ErrorState=Na;exports.EventDetails=Sd;exports.EventDetailsTemplate=Wc;exports.ExpireCartTimer=Er;exports.FeedbackState=bt;exports.FilterPopover=oi;exports.FilterSelect=bl;exports.Footer=Kc;exports.HeroUIProvider=xo;exports.HorizontalSteps=Cr;exports.InstallmentFundAssignment=hu;exports.InstallmentFundAssignmentSkeleton=bu;exports.InstallmentSchedule=Ou;exports.InstallmentScheduleSkeleton=Yu;exports.InstallmentTable=Zu;exports.ItemCard=ai;exports.KeyValueChip=Sa;exports.KeyValueRows=Fl;exports.LineItemList=il;exports.LineItemRows=Ll;exports.ListPanel=Ti;exports.LoadMoreFooter=yl;exports.LoadingOverlay=Yi;exports.LoadingState=Ca;exports.MembershipSelectCards=nm;exports.MetaCard=Bf;exports.ModalShell=Vi;exports.ModalShellFooter=Hi;exports.ModalShellHeader=Ui;exports.Multiselect=Qc;exports.Navbar=Uc;exports.NotesField=fl;exports.OfferCard=Jt;exports.OfferCardEmpty=Fr;exports.OfferCardError=Lr;exports.OfferCardList=Tr;exports.OfferCardSkeleton=Mr;exports.OtherTenderForm=zi;exports.OutcomeView=gl;exports.PageHeader=ui;exports.PaginationSummary=Ri;exports.PaymentCashChangeBanner=Da;exports.PaymentSubAmountInput=Ea;exports.PaymentSuccessView=Gi;exports.PaymentTotalBanner=Wi;exports.PickerRow=Mi;exports.PillTabs=kl;exports.PinField=pl;exports.RICH_TEXT_PRESETS=$r;exports.ReasonSelect=ml;exports.RecordCard=Dl;exports.RecordHeader=wl;exports.RecordLayout=Nl;exports.RecordTotals=Ml;exports.RedeemCodeInput=Oc;exports.RelatedRecordList=Al;exports.RevenueDistributionCard=Gr;exports.RevenueDistributionEmpty=Kr;exports.RevenueDistributionError=Qr;exports.RevenueDistributionSkeleton=Zr;exports.RichTextArea=Ar;exports.RowActions=Li;exports.SectionPanel=dl;exports.Select=He;exports.SessionTimeline=ci;exports.SplitPaymentSummary=Bi;exports.SplitTenderPanel=hl;exports.StatTiles=Cl;exports.StatusChip=mi;exports.Stepper=wr;exports.SuccessState=ri;exports.Summary=sl;exports.TableSkeleton=hi;exports.TenderMethods=xl;exports.TicketSelection=Cm;exports.TileSelect=qi;exports.Toggle=ii;exports.ToolbarButton=Ni;exports.UnderlineTabs=Ci;exports.WizardShell=rl;exports.adminFieldErrorClass=Di;exports.adminFieldHintClass=Ai;exports.adminFieldLabelClass=$a;exports.adminFieldLabelSuffixClass=Aa;exports.adminInputClass=Si;exports.adminInputReadOnlyClass=$i;exports.adminInputWrapperClass=ki;exports.adminRowClass=bi;exports.adminSurfaceCss=fo;exports.adminSurfaceTokens=aa;exports.adminTableClass=yi;exports.adminTableFooterClass=vi;exports.adminTdClass=gi;exports.adminThClass=pi;exports.calculateAllocationDifference=su;exports.computeChange=qn;exports.currencyFractionDigits=Mt;exports.formatMoney=be;exports.formatOfferCurrency=Yn;exports.formatRevenueAmount=eu;exports.formatRevenueCurrency=tu;exports.generateAutomaticInstallments=ei;exports.generateDistributionId=va;exports.getCurrencySymbol=nu;exports.offerCardVariants=Rr;exports.offerListVariants=_r;exports.pageRange=_i;exports.parseOfferCurrency=$d;exports.parseRevenueCurrency=au;exports.pillTabId=Ra;exports.pillTabPanelId=Ta;exports.pillTabPanelProps=lx;exports.posSurfaceTokens=je;exports.roundToCurrency=Nr;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
42
42
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:underline}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();