@veevarts/design-system 2.0.0-alpha.8 → 2.0.0-alpha.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"),Ce=require("framer-motion"),yn=require("@tiptap/react"),Jn=require("@tiptap/core"),Ci=require("@tiptap/extension-bold"),ki=require("@tiptap/extension-italic"),Si=require("@tiptap/extension-strike"),Ai=require("@tiptap/extension-underline"),$i=require("@tiptap/extension-code"),Di=require("@tiptap/extension-color"),Ei=require("@tiptap/extension-highlight"),Fi=require("@tiptap/extension-link"),Mi=require("@tiptap/extension-text-style"),Li=require("@tiptap/extension-heading"),Ii=require("@tiptap/extension-paragraph"),Ti=require("@tiptap/extension-bullet-list"),_i=require("@tiptap/extension-ordered-list"),Pi=require("@tiptap/extension-task-list"),Oi=require("@tiptap/extension-task-item"),Ri=require("@tiptap/extension-list-item"),zi=require("@tiptap/extension-code-block"),Bi=require("@tiptap/extension-blockquote"),Vi=require("@tiptap/extension-horizontal-rule"),Ui=require("@tiptap/extension-hard-break"),es=require("@tiptap/extension-history"),Hi=require("@tiptap/extension-text-align"),qi=require("@tiptap/extension-document"),Wi=require("@tiptap/extension-text"),Yi=require("@tiptap/extension-dropcursor"),Gi=require("@tiptap/extension-gapcursor"),ge={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"}}},ie={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},oe={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:ht}=ge.neutral,Ki=ge.palettes.warning[700],Qi=ge.palettes.warning[100],ze={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},vn={"--rust":ge.brand.primary[500],"--rust-fill":ze.rustFill,"--rust-border":ze.rustBorder,"--page":ze.page,"--surface":ge.neutral.white,"--border":ze.border,"--hair":ze.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":ge.semantic.success,"--ok-fill":ze.okFill,"--warn":Ki,"--warn-fill":Qi,"--danger":ge.semantic.danger,"--danger-fill":ze.dangerFill,"--info":ge.semantic.info,"--info-fill":ze.infoFill};Object.fromEntries(Object.entries(vn).map(([e,n])=>[e.replace(/^--/,""),n]));function Zi({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(vn).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"),Ne=require("framer-motion"),yn=require("@tiptap/react"),ts=require("@tiptap/core"),ki=require("@tiptap/extension-bold"),Si=require("@tiptap/extension-italic"),$i=require("@tiptap/extension-strike"),Ai=require("@tiptap/extension-underline"),Di=require("@tiptap/extension-code"),Ei=require("@tiptap/extension-color"),Fi=require("@tiptap/extension-highlight"),Mi=require("@tiptap/extension-link"),Li=require("@tiptap/extension-text-style"),Ti=require("@tiptap/extension-heading"),Ii=require("@tiptap/extension-paragraph"),_i=require("@tiptap/extension-bullet-list"),Pi=require("@tiptap/extension-ordered-list"),Oi=require("@tiptap/extension-task-list"),Ri=require("@tiptap/extension-task-item"),zi=require("@tiptap/extension-list-item"),Bi=require("@tiptap/extension-code-block"),Vi=require("@tiptap/extension-blockquote"),Ui=require("@tiptap/extension-horizontal-rule"),Hi=require("@tiptap/extension-hard-break"),ns=require("@tiptap/extension-history"),qi=require("@tiptap/extension-text-align"),Wi=require("@tiptap/extension-document"),Yi=require("@tiptap/extension-text"),Gi=require("@tiptap/extension-dropcursor"),Ki=require("@tiptap/extension-gapcursor"),be={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"}}},le={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ce={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:ht}=be.neutral,Qi=be.palettes.warning[700],Zi=be.palettes.warning[100],Re={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},vn={"--rust":be.brand.primary[500],"--rust-fill":Re.rustFill,"--rust-border":Re.rustBorder,"--page":Re.page,"--surface":be.neutral.white,"--border":Re.border,"--hair":Re.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":be.semantic.success,"--ok-fill":Re.okFill,"--warn":Qi,"--warn-fill":Zi,"--danger":be.semantic.danger,"--danger-fill":Re.dangerFill,"--info":be.semantic.info,"--info-fill":Re.infoFill};Object.fromEntries(Object.entries(vn).map(([e,n])=>[e.replace(/^--/,""),n]));function Xi({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(vn).map(([r,i])=>` ${r}: ${i};`).join(`
2
2
  `),a=n?`
3
3
  font-family: ${n};
4
4
  color: var(--ink);`:"";return`${e} {
5
5
  ${s}${a}
6
6
  }
7
- `}const jn={line:"#E7E7E9","line-2":"#F1F1F3","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:ge.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8",destructive:"#A32D2D"};({...jn});function Xi({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function Ji(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(s[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=a[l]&&a[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Gs=Object.freeze({left:0,top:0,width:16,height:16}),vt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),wn=Object.freeze({...Gs,...vt}),sn=Object.freeze({...wn,body:"",hidden:!1});function el(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function ts(e,n){const s=el(e,n);for(const a in sn)a in vt?a in e&&!(a in s)&&(s[a]=vt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function tl(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=ts(a[o]||r[o],i)}return l(n),s.forEach(l),ts(e,i)}function Ks(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=Ji(e);for(const r in a){const i=a[r];i&&(n(r,tl(e,r,i)),s.push(r))}return s}const nl={provider:"",aliases:{},not_found:{},...Gs};function Pt(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Qs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Pt(e,nl))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Pt(i,sn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],l=i.parent;if(!r||typeof l!="string"||!s[l]&&!a[l]||!Pt(i,sn))return null}return n}const ns=Object.create(null);function sl(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Xe(e,n){const s=ns[e]||(ns[e]=Object.create(null));return s[n]||(s[n]=sl(e,n))}function Zs(e,n){return Qs(n)?Ks(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function al(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const Xs=/^[a-z0-9]+(-[a-z0-9]+)*$/,At=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:o};return n&&!gt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:a,prefix:l.shift(),name:l.join("-")};return n&&!gt(o)?null:o}if(s&&a===""){const o={provider:a,prefix:"",name:i};return n&&!gt(o,s)?null:o}return null},gt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function Js(e){return typeof e=="boolean"&&(ct=e),ct}function ss(e){const n=typeof e=="string"?At(e,!0,ct):e;if(n){const s=Xe(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function rl(e,n){const s=At(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?al(a,s.name,n):(a.missing.add(s.name),!0)}function il(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return Qs(e)&&(e.prefix="",Ks(e,(i,l)=>{rl(i,l)&&(r=!0)})),r}const s=e.prefix;if(!gt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!Zs(a,e)}const ea=Object.freeze({width:null,height:null}),ta=Object.freeze({...ea,...vt}),ll=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ol=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function as(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(ll);if(a===null||!a.length)return e;const r=[];let i=a.shift(),l=ol.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");l=!l}}function cl(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(l+1)}return{defs:s,content:e}}function dl(e,n){return e?"<defs>"+e+"</defs>"+n:n}function ul(e,n,s){const a=cl(e);return dl(a.defs,n+a.content+s)}const fl=e=>e==="unset"||e==="undefined"||e==="none";function ml(e,n){const s={...wn,...e},a={...ta,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const v=[],N=y.hFlip,j=y.vFlip;let C=y.rotate;N?j?C+=2:(v.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),v.push("scale(-1 1)"),r.top=r.left=0):j&&(v.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),v.push("scale(1 -1)"),r.top=r.left=0);let w;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:w=r.height/2+r.top,v.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:v.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,v.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}C%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),v.length&&(i=ul(i,'<g transform="'+v.join(" ")+'">',"</g>"))});const l=a.width,o=a.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=as(m,d/u)):(f=l==="auto"?d:l,m=o===null?as(f,u/d):o==="auto"?u:o);const x={},h=(y,v)=>{fl(v)||(x[y]=v.toString())};h("width",f),h("height",m);const b=[r.left,r.top,d,u];return x.viewBox=b.join(" "),{attributes:x,viewBox:b,body:i}}const hl=/\sid="(\S+)"/g,xl="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let pl=0;function gl(e,n=xl){const s=[];let a;for(;a=hl.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const l=typeof n=="function"?n(i):n+(pl++).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 an=Object.create(null);function bl(e,n){an[e]=n}function rn(e){return an[e]||an[""]}function Nn(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 Cn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],bt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?bt.push(tt.shift()):bt.push(tt.pop());Cn[""]=Nn({resources:["https://api.iconify.design"].concat(bt)});function yl(e,n){const s=Nn(n);return s===null?!1:(Cn[e]=s,!0)}function kn(e){return Cn[e]}const vl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let rs=vl();function jl(e,n){const s=kn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function wl(e){return e===404}const Nl=(e,n,s)=>{const a=[],r=jl(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return s.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(a.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),a.push(l),a};function Cl(e){if(typeof e=="string"){const n=kn(e);if(n)return n.path}return"/"}const kl=(e,n,s)=>{if(!rs){s("abort",424);return}let a=Cl(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;rs(e+a).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{s(wl(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},Sl={prepare:Nl,send:kl};function na(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Al(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),l.pending.length!==o&&(s||na([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let $l=0;function Dl(e,n,s){const a=$l++,r=na.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function El(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,l=r.prefix,o=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[l]||(d[l]=Xe(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 Fl(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?At(r,n,s):r;i&&a.push(i)}),a}const Ml={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ll(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let E=e.resources.slice(0);for(l=[];E.length>1;){const A=Math.floor(Math.random()*E.length);l.push(E[A]),E=E.slice(0,A).concat(E.slice(A+1))}l=l.concat(E)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,x=[],h=[];typeof a=="function"&&h.push(a);function b(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),b(),x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function v(E,A){A&&(h=[]),typeof E=="function"&&h.push(E)}function N(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:x.length,subscribe:v,abort:y}}function j(){d="failed",h.forEach(E=>{E(void 0,f)})}function C(){x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function w(E,A,L){const M=A!=="success";switch(x=x.filter(_=>_!==E),d){case"pending":break;case"failed":if(M||!e.dataAfterTimeout)return;break;default:return}if(A==="abort"){f=L,j();return}if(M){f=L,x.length||(l.length?S():j());return}if(b(),C(),!e.random){const _=e.resources.indexOf(E.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",h.forEach(_=>{_(L)})}function S(){if(d!=="pending")return;b();const E=l.shift();if(E===void 0){if(x.length){m=setTimeout(()=>{b(),d==="pending"&&(C(),j())},e.timeout);return}j();return}const A={status:"pending",resource:E,callback:(L,M)=>{w(A,L,M)}};x.push(A),u++,m=setTimeout(S,e.rotate),s(E,n,A.callback)}return setTimeout(S),N}function sa(e){const n={...Ml,...e};let s=[];function a(){s=s.filter(o=>o().status==="pending")}function r(o,d,u){const f=Ll(n,o,d,(m,x)=>{a(),u&&u(m,x)});return s.push(f),f}function i(o){return s.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:a}}function is(){}const Ot=Object.create(null);function Il(e){if(!Ot[e]){const n=kn(e);if(!n)return;const s=sa(n),a={config:n,redundancy:s};Ot[e]=a}return Ot[e]}function Tl(e,n,s){let a,r;if(typeof e=="string"){const i=rn(e);if(!i)return s(void 0,424),is;r=i.send;const l=Il(e);l&&(a=l.redundancy)}else{const i=Nn(e);if(i){a=sa(i);const l=e.resources?e.resources[0]:"",o=rn(l);o&&(r=o.send)}}return!a||!r?(s(void 0,424),is):a.query(n,r,s)().abort}function ls(){}function _l(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Al(e)}))}function Pl(e){const n=[],s=[];return e.forEach(a=>{(a.match(Xs)?n:s).push(a)}),{valid:n,invalid:s}}function nt(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Zs(e,s).length){a();return}}catch(r){console.error(r)}a(),_l(e)}function os(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Ol(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){os(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);os(m,x=>{const h=x?{prefix:a,icons:{[f]:x}}:null;nt(e,[f],h)})});return}const{valid:l,invalid:o}=Pl(r);if(o.length&&nt(e,o,null),!l.length)return;const d=a.match(Xs)?rn(s):null;if(!d){nt(e,l,null);return}d.prepare(s,a,l).forEach(f=>{Tl(s,f,m=>{nt(e,f.icons,m)})})}))}const Rl=(e,n)=>{const s=Fl(e,!0,Js()),a=El(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ls)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(Xe(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,x=Xe(u,f),h=x.pendingIcons||(x.pendingIcons=new Set);h.has(m)||(h.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Ol(d,u)}),n?Dl(n,a,i):ls};function zl(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in ea?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Bl=/[\s,]+/;function Vl(e,n){n.split(Bl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Ul(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function Hl(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function ql(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Wl(e){return"data:image/svg+xml,"+ql(e)}function Yl(e){return'url("'+Wl(e)+'")'}let it;function Gl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Kl(e){return it===void 0&&Gl(),it?it.createHTML(e):e}const aa={...ta,inline:!1},Ql={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Zl={display:"inline-block"},ln={backgroundColor:"currentColor"},ra={backgroundColor:"transparent"},cs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ds={WebkitMask:ln,mask:ln,background:ra};for(const e in ds){const n=ds[e];for(const s in cs)n[e+s]=cs[s]}const Xl={...aa,inline:!0};function us(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Jl=(e,n,s)=>{const a=n.inline?Xl:aa,r=zl(a,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?Ql:{}};if(s){const v=At(s,!1,!0);if(v){const N=["iconify"],j=["provider","prefix"];for(const C of j)v[C]&&N.push("iconify--"+v[C]);d.className=N.join(" ")}}for(let v in n){const N=n[v];if(N!==void 0)switch(v){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=N;break;case"className":d[v]=(d[v]?d[v]+" ":"")+N;break;case"inline":case"hFlip":case"vFlip":r[v]=N===!0||N==="true"||N===1;break;case"flip":typeof N=="string"&&Vl(r,N);break;case"color":l.color=N;break;case"rotate":typeof N=="string"?r[v]=Ul(N):typeof N=="number"&&(r[v]=N);break;case"ariaHidden":case"aria-hidden":N!==!0&&N!=="true"&&delete d["aria-hidden"];break;default:a[v]===void 0&&(d[v]=N)}}const u=ml(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let v=0,N=n.id;return typeof N=="string"&&(N=N.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Kl(gl(u.body,N?()=>N+"ID"+v++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:x,height:h}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=Hl(m,{...f,width:x+"",height:h+""});return d.style={...l,"--svg":Yl(y),width:us(f.width),height:us(f.height),...Zl,...b?ln:ra,...o},p.createElement("span",d)};Js(!0);bl("",Sl);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!il(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;yl(s,r)||console.error(a)}catch{console.error(a)}}}}function ia(e){const[n,s]=p.useState(!!e.ssr),[a,r]=p.useState({});function i(h){if(h){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const y=ss(b);if(y)return{name:b,data:y}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const h=a.callback;h&&(h(),r({}))}function u(h){if(JSON.stringify(l)!==JSON.stringify(h))return d(),o(h),!0}function f(){var h;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const y=ss(b);if(u({name:b,data:y}))if(y===void 0){const v=Rl([b],f);r({callback:v})}else y&&((h=e.onLoad)===null||h===void 0||h.call(e,b))}p.useEffect(()=>(s(!0),d),[]),p.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:x}=l;return x?Jl({...wn,...x},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const R=p.forwardRef((e,n)=>ia({...e,_ref:n}));p.forwardRef((e,n)=>ia({inline:!0,...e,_ref:n}));const U=p.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));U.displayName="Button";function la({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(U,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(R,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Rt(e,n){return e-n*Math.floor(e/n)}const oa=1721426;function xt(e,n,s,a){n=Sn(e,n);let r=n-1,i=-2;return s<=2?i=0:yt(n)&&(i=-1),oa-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function yt(e){return e%4===0&&(e%100!==0||e%400===0)}function Sn(e,n){return e==="BC"?1-n:n}function eo(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const to={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 $t{fromJulianDay(n){let s=n,a=s-oa,r=Math.floor(a/146097),i=Rt(a,146097),l=Math.floor(i/36524),o=Rt(i,36524),d=Math.floor(o/1461),u=Rt(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[x,h]=eo(m),b=s-xt(x,h,1,1),y=2;s<xt(x,h,3,1)?y=0:yt(h)&&(y=1);let v=Math.floor(((b+y)*12+373)/367),N=s-xt(x,h,v,1)+1;return new dt(x,h,v,N)}toJulianDay(n){return xt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return to[yt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return yt(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 no(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function ca(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function da(e,n){return fs(e)-fs(n)}function fs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let zt=null;function ua(){return zt==null&&(zt=new Intl.DateTimeFormat().resolvedOptions().timeZone),zt}function ms(e){e=An(e,new $t);let n=Sn(e.era,e.year);return fa(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function fa(e,n,s,a,r,i,l){let o=new Date;return o.setUTCHours(a,r,i,l),o.setUTCFullYear(e,n-1,s),o.getTime()}function hs(e,n){if(n==="UTC")return 0;if(e>0&&n===ua())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:l,second:o}=ma(e,n);return fa(s,a,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const xs=new Map;function ma(e,n){let s=xs.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),xs.set(n,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ps=864e5;function so(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>ao(e,n,i))}function ao(e,n,s){let a=ma(s,n);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function ro(e,n,s="compatible"){let a=xa(e);if(n==="UTC")return ms(a);if(n===ua()&&s==="compatible"){a=An(a,new $t);let d=new Date,u=Sn(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=ms(a),i=hs(r-ps,n),l=hs(r+ps,n),o=so(a,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(s){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ha(e,n,s="compatible"){return new Date(ro(e,n,s))}function xa(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new jt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function An(e,n){if(no(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Je(a),a}function $n(e,n){let s=e.copy(),a="hour"in s?wa(s,n):0;on(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,cn(s),pa(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,io(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,l;let d=(i=(l=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let o=s.calendar.getMonthsInYear(s);return s.month>o&&(s.month=o,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function on(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function cn(e){for(;e.month<1;)on(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,on(e,1)}function io(e){for(;e.day<1;)e.month--,cn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,cn(e)}function pa(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 Je(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),pa(e)}function ga(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function ba(e,n){return $n(e,ga(n))}function ya(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),Je(s),s}function va(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),ja(s),s}function lo(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=pt(e.hour,24),n}function ja(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 pt(e,n){let s=e%n;return s<0&&(s+=n),s}function wa(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,lo(e)}function Na(e,n){let s=e.copy();return wa(s,n),s}function oo(e,n){return Na(e,ga(n))}function Ca(e,n,s,a){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=Be(d,s,0,o.length-1,a?.round),r.era=o[d],Je(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(s=-s),r.year=Be(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=Be(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=Be(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function ka(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(a?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=Be(i,s,l,o,a?.round);break}case"minute":r.minute=Be(e.minute,s,0,59,a?.round);break;case"second":r.second=Be(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=Be(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function Be(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const co=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,uo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function fo(e){let n=e.match(co);if(!n)throw uo.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(Bt(n[1],0,9999),Bt(n[2],1,12),1);return s.day=Bt(n[3],1,s.calendar.getDaysInMonth(s)),s}function Bt(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function Sa(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 Aa(e){let n=An(e,new $t),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function mo(e){return`${Aa(e)}T${Sa(e)}`}function ho(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Dn(e,n,s){ho(e,n),n.set(e,s)}function $a(e){let n=typeof e[0]=="object"?e.shift():new $t,s;if(typeof e[0]=="string")s=e.shift();else{let l=n.getEras();s=l[l.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var xo=new WeakMap;class dt{copy(){return this.era?new dt(this.calendar,this.era,this.year,this.month,this.day):new dt(this.calendar,this.year,this.month,this.day)}add(n){return $n(this,n)}subtract(n){return ba(this,n)}set(n){return ya(this,n)}cycle(n,s,a){return Ca(this,n,s,a)}toDate(n){return ha(this,n)}toString(){return Aa(this)}compare(n){return ca(this,n)}constructor(...n){Dn(this,xo,{writable:!0,value:void 0});let[s,a,r,i,l]=$a(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,Je(this)}}var po=new WeakMap;class Dt{copy(){return new Dt(this.hour,this.minute,this.second,this.millisecond)}add(n){return Na(this,n)}subtract(n){return oo(this,n)}set(n){return va(this,n)}cycle(n,s,a){return ka(this,n,s,a)}toString(){return Sa(this)}compare(n){return da(this,n)}constructor(n=0,s=0,a=0,r=0){Dn(this,po,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,ja(this)}}var go=new WeakMap;class jt{copy(){return this.era?new jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return $n(this,n)}subtract(n){return ba(this,n)}set(n){return ya(va(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Ca(this,n,s,a);default:return ka(this,n,s,a)}}toDate(n,s){return ha(this,n,s)}toString(){return mo(this)}compare(n){let s=ca(this,n);return s===0?da(this,xa(n)):s}constructor(...n){Dn(this,go,{writable:!0,value:void 0});let[s,a,r,i,l]=$a(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Je(this)}}const bo="Open time options",yo=320;function gs(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Vt(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Dt(n,s,a)}function vo(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function jo(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new Dt(s,a));return n}function wo(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=bo,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[x,h]=p.useState(()=>Vt(d)),b=m?Vt(o):x,y=p.useMemo(()=>jo(n),[n]),v=j=>{m||h(j),l?.(j)},N=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(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:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(j=>{const C=b?.hour===j.hour&&b?.minute===j.minute;return t.jsx(c.Button,{variant:C?"flat":"light",color:C?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>v(j),children:vo(j,u)},`${j.hour}:${j.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,N]}),onChange:j=>v(Vt(j))})}function En(e){if(e.mode==="time")return t.jsx(wo,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=yo,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:gs("min-w-[20rem]",u?.popoverContent),calendarContent:gs("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function No(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Me=p.forwardRef(({popoverProps:e,...n},s)=>{const a=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(No(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:l})})});Me.displayName="Select";function Co({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),x=p.useId(),[h,b]=p.useState(e);e!==h&&(b(e),e==="applied"&&m(""));const y=()=>{const j=f.trim();j&&n(j)},v=j=>{j.key==="Enter"&&(j.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(la,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const N=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:v,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":N?x:void 0}),t.jsx(U,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:o})]}),N&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const ko={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function So({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Me,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(G.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Me,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(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 Ao({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(U,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(U,{"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:a.login})]})}function $o({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...ko,...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(So,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Ao,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Do(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 Ut;const Eo=typeof document<"u"?(Ut=p.useInsertionEffect)!==null&&Ut!==void 0?Ut:p.useLayoutEffect:()=>{};function Et(e,n,s){let[a,r]=p.useState(e||n),i=p.useRef(a),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:a;Eo(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...x)=>{let h=typeof m=="function"?m(i.current):m;Object.is(i.current,h)||(i.current=h,r(h),u(),s?.(h,...x))},[s]);return[d,f]}function Da(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ce.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 Ea=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:x,currentStep:h,hideProgressBars:b=!1,stepClassName:y,className:v,isDisabled:N=!1,...j},C)=>{const[w,S]=Et(h,a,x),E=p.useMemo(()=>{let A,L;const M=["[--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":A="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":A="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":A="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":A="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":A="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":A="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:A="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return M.unshift(L),M.unshift(A),M},[e]);return t.jsxs("nav",{ref:C,"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",v),"data-testid":"stepper-root",...j,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,s):`Step ${w+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",E,v),"data-testid":"stepper-list",children:Array.from({length:s})?.map((A,L)=>{const M=w===L?"active":w<L?"inactive":"complete",_=n==="activeLabel"&&M==="active"&&!!i?.[L],D=l&&M!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(c.Tooltip,{content:D?i?.[L]:void 0,isDisabled:!D,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":M==="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":N},y),onClick:()=>!N&&S(L),disabled:N,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:M,className:"relative z-10",children:t.jsx(Ce.m.div,{animate:M,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)":M==="complete","shadow-lg":M==="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:M==="complete"&&n==="default"?t.jsx(Da,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<s-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":L<w})})})]},L)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,s):`Step ${w+1} of ${s}`}):null]})});Ea.displayName="Stepper";function Fo(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function xe(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Ft(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Fa(e,n,s="en-US"){const a=Ft(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function dn(e,n,s,a){return Fa(e-n,s,a)}const bs={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))"}},Mo="rgb(156 163 175)",Lo="rgb(107 114 128)",Ma=p.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Mo,inactiveLabelColor:f=Lo,activeStepVariant:m="bordered",stepClassName:x,circleClassName:h,progressBarClassName:b,labelsClassName:y,labelSlotClassName:v,activeLabelClassName:N,inactiveLabelClassName:j,className:C,ariaLabel:w="Progress",invalidLabelSuffix:S=", has errors",testId:E,isStepReachable:A,...L},M){const[_,D]=Et(i,a,r),$=bs[n]??bs.primary,I=o??$.active,T=d??$.fg,K=(H,B)=>{const J=H.ariaLabel??(typeof H.title=="string"?H.title:null)??`${B+1}`;return H.invalid?`${J}${S}`:J};return t.jsxs("nav",{...L,"aria-label":w,...E?{"data-testid":E}:{},children:[t.jsx("div",{className:c.cn("flex items-center",C),children:s?.map((H,B)=>{const X=B===_?"active":B<_?"complete":"inactive",J=A?A(B):!0;return t.jsxs(p.Fragment,{children:[t.jsx(U,{ref:M,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${E??"horizontal-steps"}-step-${B}`,"aria-current":X==="active"?"step":void 0,"aria-describedby":H.describedBy,"aria-label":K(H,B),"data-invalid":H.invalid?"true":void 0,isDisabled:!J,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",J?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",H.className,x),onPress:()=>{if(i===void 0){D(B);return}r?.(B)},children:t.jsx(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:X,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",h),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?I:"transparent",borderColor:I,borderWidth:"1.5px",color:m==="solid"?T:I},complete:{backgroundColor:I,borderColor:I,borderWidth:"1.5px",color:I}},children:X==="complete"?t.jsx(Da,{className:"size-4",style:{color:T}}):t.jsx("span",{children:B+1})})})}),B<s.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:B<_?I:u}})]},B)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((H,B)=>{const X=B<=_;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",v),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?N:j),style:{color:X?I:f},children:H.title})}),B<s.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},B)})})]})});Ma.displayName="HorizontalSteps";function Io(){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 To=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(_o,{...e},n)},_o=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,x]=p.useState(null),h=p.useMemo(()=>new Set(n),[n]),b=p.useMemo(()=>new Set(e),[e]),y=p.useMemo(()=>e.filter(D=>!h.has(D)),[e,h]),v=D=>{if(D.length===0)return;const $=Array.from(new Set([...n,...D]));s($)},N=D=>{if(D.length===0)return;const $=new Set(D);s(n.filter(I=>!$.has(I)))},j=()=>{i.length!==0&&(v(i),l([]))},C=()=>{o.length!==0&&(N(o),d([]))},w=()=>{y.length!==0&&(v(y),l([]))},S=()=>{n.length!==0&&(s([]),d([]))},E=(D,$,I)=>{const T=Math.min($,I),K=Math.max($,I);return D.slice(T,K+1)},A=(D,$,I)=>{if(I&&u!==null){l(E(y,u,$)),d([]),f($);return}const T=i.includes(D);l(T?i.filter(K=>K!==D):[...i,D]),d([]),f($)},L=(D,$,I)=>{if(I&&m!==null){d(E(n,m,$)),l([]),x($);return}const T=o.includes(D);d(T?o.filter(K=>K!==D):[...o,D]),l([]),x($)},M=(D,$,I)=>{const T=I==="available"?i.includes($)?i:[$]:o.includes($)?o:[$];D.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:T})),D.dataTransfer.effectAllowed="move"},_=(D,$)=>{D.preventDefault();const I=D.dataTransfer.getData("text/plain");if(I)try{const T=JSON.parse(I),K=(T.items||[]).filter(H=>b.has(H));if(K.length===0||T.source===$)return;$==="selected"?(v(K),l([])):(N(K),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:D=>D.preventDefault(),onDrop:D=>_(D,"available"),children:y.map((D,$)=>{const I=i.includes(D);return t.jsx("button",{type:"button",onClick:T=>{A(D,$,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>M(T,D,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(U,{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:j,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:C,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:S,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:D=>D.preventDefault(),onDrop:D=>_(D,"selected"),children:n.map((D,$)=>{const I=o.includes(D);return t.jsx("button",{type:"button",onClick:T=>{L(D,$,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>M(T,D,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function qe({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(U,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const Te={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Po={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Oo({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const l=()=>a(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Te.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(U,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:Po[l]},l))})]})}const Ht={bulletList:{label:"Bullet List",icon:G.List},orderedList:{label:"Numbered List",icon:G.ListOrdered},taskList:{label:"Task List",icon:G.ListTodo}};function Ro({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const o=()=>a(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Ht[r].icon:G.List,l=o=>{const u=Te[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(U,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:n.map(o=>{const d=Ht[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ht[o].label},o)})})]})}function zo({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
7
+ `}const jn={line:"#E7E7E9","line-2":"#F1F1F3","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:be.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8",destructive:"#A32D2D"};({...jn});function Ji({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function el(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(s[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=a[l]&&a[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Qs=Object.freeze({left:0,top:0,width:16,height:16}),vt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),wn=Object.freeze({...Qs,...vt}),sn=Object.freeze({...wn,body:"",hidden:!1});function tl(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function ss(e,n){const s=tl(e,n);for(const a in sn)a in vt?a in e&&!(a in s)&&(s[a]=vt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function nl(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=ss(a[o]||r[o],i)}return l(n),s.forEach(l),ss(e,i)}function Zs(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=el(e);for(const r in a){const i=a[r];i&&(n(r,nl(e,r,i)),s.push(r))}return s}const sl={provider:"",aliases:{},not_found:{},...Qs};function _t(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Xs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!_t(e,sl))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!_t(i,sn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],l=i.parent;if(!r||typeof l!="string"||!s[l]&&!a[l]||!_t(i,sn))return null}return n}const as=Object.create(null);function al(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Xe(e,n){const s=as[e]||(as[e]=Object.create(null));return s[n]||(s[n]=al(e,n))}function Js(e,n){return Xs(n)?Zs(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function rl(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const ea=/^[a-z0-9]+(-[a-z0-9]+)*$/,$t=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:o};return n&&!gt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:a,prefix:l.shift(),name:l.join("-")};return n&&!gt(o)?null:o}if(s&&a===""){const o={provider:a,prefix:"",name:i};return n&&!gt(o,s)?null:o}return null},gt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function ta(e){return typeof e=="boolean"&&(ct=e),ct}function rs(e){const n=typeof e=="string"?$t(e,!0,ct):e;if(n){const s=Xe(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function il(e,n){const s=$t(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?rl(a,s.name,n):(a.missing.add(s.name),!0)}function ll(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return Xs(e)&&(e.prefix="",Zs(e,(i,l)=>{il(i,l)&&(r=!0)})),r}const s=e.prefix;if(!gt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!Js(a,e)}const na=Object.freeze({width:null,height:null}),sa=Object.freeze({...na,...vt}),ol=/(-?[0-9.]*[0-9]+[0-9.]*)/g,cl=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function is(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(ol);if(a===null||!a.length)return e;const r=[];let i=a.shift(),l=cl.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");l=!l}}function dl(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(l+1)}return{defs:s,content:e}}function ul(e,n){return e?"<defs>"+e+"</defs>"+n:n}function fl(e,n,s){const a=dl(e);return ul(a.defs,n+a.content+s)}const ml=e=>e==="unset"||e==="undefined"||e==="none";function hl(e,n){const s={...wn,...e},a={...sa,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(w=>{const y=[],j=w.hFlip,N=w.vFlip;let C=w.rotate;j?N?C+=2:(y.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),y.push("scale(-1 1)"),r.top=r.left=0):N&&(y.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),y.push("scale(1 -1)"),r.top=r.left=0);let v;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:v=r.height/2+r.top,y.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:y.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,y.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}C%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)),y.length&&(i=fl(i,'<g transform="'+y.join(" ")+'">',"</g>"))});const l=a.width,o=a.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=is(m,d/u)):(f=l==="auto"?d:l,m=o===null?is(f,u/d):o==="auto"?u:o);const x={},h=(w,y)=>{ml(y)||(x[w]=y.toString())};h("width",f),h("height",m);const b=[r.left,r.top,d,u];return x.viewBox=b.join(" "),{attributes:x,viewBox:b,body:i}}const xl=/\sid="(\S+)"/g,pl="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let gl=0;function bl(e,n=pl){const s=[];let a;for(;a=xl.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const l=typeof n=="function"?n(i):n+(gl++).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 an=Object.create(null);function yl(e,n){an[e]=n}function rn(e){return an[e]||an[""]}function Nn(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 Cn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],bt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?bt.push(tt.shift()):bt.push(tt.pop());Cn[""]=Nn({resources:["https://api.iconify.design"].concat(bt)});function vl(e,n){const s=Nn(n);return s===null?!1:(Cn[e]=s,!0)}function kn(e){return Cn[e]}const jl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ls=jl();function wl(e,n){const s=kn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function Nl(e){return e===404}const Cl=(e,n,s)=>{const a=[],r=wl(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return s.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(a.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),a.push(l),a};function kl(e){if(typeof e=="string"){const n=kn(e);if(n)return n.path}return"/"}const Sl=(e,n,s)=>{if(!ls){s("abort",424);return}let a=kl(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ls(e+a).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{s(Nl(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},$l={prepare:Cl,send:Sl};function aa(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Al(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),l.pending.length!==o&&(s||aa([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Dl=0;function El(e,n,s){const a=Dl++,r=aa.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function Fl(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,l=r.prefix,o=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[l]||(d[l]=Xe(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 Ml(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?$t(r,n,s):r;i&&a.push(i)}),a}const Ll={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Tl(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let L=e.resources.slice(0);for(l=[];L.length>1;){const $=Math.floor(Math.random()*L.length);l.push(L[$]),L=L.slice(0,$).concat(L.slice($+1))}l=l.concat(L)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,x=[],h=[];typeof a=="function"&&h.push(a);function b(){m&&(clearTimeout(m),m=null)}function w(){d==="pending"&&(d="aborted"),b(),x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function y(L,$){$&&(h=[]),typeof L=="function"&&h.push(L)}function j(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:x.length,subscribe:y,abort:w}}function N(){d="failed",h.forEach(L=>{L(void 0,f)})}function C(){x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function v(L,$,M){const A=$!=="success";switch(x=x.filter(I=>I!==L),d){case"pending":break;case"failed":if(A||!e.dataAfterTimeout)return;break;default:return}if($==="abort"){f=M,N();return}if(A){f=M,x.length||(l.length?k():N());return}if(b(),C(),!e.random){const I=e.resources.indexOf(L.resource);I!==-1&&I!==e.index&&(e.index=I)}d="completed",h.forEach(I=>{I(M)})}function k(){if(d!=="pending")return;b();const L=l.shift();if(L===void 0){if(x.length){m=setTimeout(()=>{b(),d==="pending"&&(C(),N())},e.timeout);return}N();return}const $={status:"pending",resource:L,callback:(M,A)=>{v($,M,A)}};x.push($),u++,m=setTimeout(k,e.rotate),s(L,n,$.callback)}return setTimeout(k),j}function ra(e){const n={...Ll,...e};let s=[];function a(){s=s.filter(o=>o().status==="pending")}function r(o,d,u){const f=Tl(n,o,d,(m,x)=>{a(),u&&u(m,x)});return s.push(f),f}function i(o){return s.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:a}}function os(){}const Pt=Object.create(null);function Il(e){if(!Pt[e]){const n=kn(e);if(!n)return;const s=ra(n),a={config:n,redundancy:s};Pt[e]=a}return Pt[e]}function _l(e,n,s){let a,r;if(typeof e=="string"){const i=rn(e);if(!i)return s(void 0,424),os;r=i.send;const l=Il(e);l&&(a=l.redundancy)}else{const i=Nn(e);if(i){a=ra(i);const l=e.resources?e.resources[0]:"",o=rn(l);o&&(r=o.send)}}return!a||!r?(s(void 0,424),os):a.query(n,r,s)().abort}function cs(){}function Pl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Al(e)}))}function Ol(e){const n=[],s=[];return e.forEach(a=>{(a.match(ea)?n:s).push(a)}),{valid:n,invalid:s}}function nt(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Js(e,s).length){a();return}}catch(r){console.error(r)}a(),Pl(e)}function ds(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Rl(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){ds(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);ds(m,x=>{const h=x?{prefix:a,icons:{[f]:x}}:null;nt(e,[f],h)})});return}const{valid:l,invalid:o}=Ol(r);if(o.length&&nt(e,o,null),!l.length)return;const d=a.match(ea)?rn(s):null;if(!d){nt(e,l,null);return}d.prepare(s,a,l).forEach(f=>{_l(s,f,m=>{nt(e,f.icons,m)})})}))}const zl=(e,n)=>{const s=Ml(e,!0,ta()),a=Fl(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,cs)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(Xe(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,x=Xe(u,f),h=x.pendingIcons||(x.pendingIcons=new Set);h.has(m)||(h.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Rl(d,u)}),n?El(n,a,i):cs};function Bl(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in na?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Vl=/[\s,]+/;function Ul(e,n){n.split(Vl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Hl(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function ql(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function Wl(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Yl(e){return"data:image/svg+xml,"+Wl(e)}function Gl(e){return'url("'+Yl(e)+'")'}let it;function Kl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Ql(e){return it===void 0&&Kl(),it?it.createHTML(e):e}const ia={...sa,inline:!1},Zl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Xl={display:"inline-block"},ln={backgroundColor:"currentColor"},la={backgroundColor:"transparent"},us={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},fs={WebkitMask:ln,mask:ln,background:la};for(const e in fs){const n=fs[e];for(const s in us)n[e+s]=us[s]}const Jl={...ia,inline:!0};function ms(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const eo=(e,n,s)=>{const a=n.inline?Jl:ia,r=Bl(a,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?Zl:{}};if(s){const y=$t(s,!1,!0);if(y){const j=["iconify"],N=["provider","prefix"];for(const C of N)y[C]&&j.push("iconify--"+y[C]);d.className=j.join(" ")}}for(let y in n){const j=n[y];if(j!==void 0)switch(y){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=j;break;case"className":d[y]=(d[y]?d[y]+" ":"")+j;break;case"inline":case"hFlip":case"vFlip":r[y]=j===!0||j==="true"||j===1;break;case"flip":typeof j=="string"&&Ul(r,j);break;case"color":l.color=j;break;case"rotate":typeof j=="string"?r[y]=Hl(j):typeof j=="number"&&(r[y]=j);break;case"ariaHidden":case"aria-hidden":j!==!0&&j!=="true"&&delete d["aria-hidden"];break;default:a[y]===void 0&&(d[y]=j)}}const u=hl(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let y=0,j=n.id;return typeof j=="string"&&(j=j.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Ql(bl(u.body,j?()=>j+"ID"+y++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:x,height:h}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),w=ql(m,{...f,width:x+"",height:h+""});return d.style={...l,"--svg":Gl(w),width:ms(f.width),height:ms(f.height),...Xl,...b?ln:la,...o},p.createElement("span",d)};ta(!0);yl("",$l);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!ll(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;vl(s,r)||console.error(a)}catch{console.error(a)}}}}function oa(e){const[n,s]=p.useState(!!e.ssr),[a,r]=p.useState({});function i(h){if(h){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const w=rs(b);if(w)return{name:b,data:w}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const h=a.callback;h&&(h(),r({}))}function u(h){if(JSON.stringify(l)!==JSON.stringify(h))return d(),o(h),!0}function f(){var h;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const w=rs(b);if(u({name:b,data:w}))if(w===void 0){const y=zl([b],f);r({callback:y})}else w&&((h=e.onLoad)===null||h===void 0||h.call(e,b))}p.useEffect(()=>(s(!0),d),[]),p.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:x}=l;return x?eo({...wn,...x},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const R=p.forwardRef((e,n)=>oa({...e,_ref:n}));p.forwardRef((e,n)=>oa({inline:!0,...e,_ref:n}));const H=p.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));H.displayName="Button";function ca({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(H,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(R,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ot(e,n){return e-n*Math.floor(e/n)}const da=1721426;function xt(e,n,s,a){n=Sn(e,n);let r=n-1,i=-2;return s<=2?i=0:yt(n)&&(i=-1),da-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function yt(e){return e%4===0&&(e%100!==0||e%400===0)}function Sn(e,n){return e==="BC"?1-n:n}function to(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const no={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 At{fromJulianDay(n){let s=n,a=s-da,r=Math.floor(a/146097),i=Ot(a,146097),l=Math.floor(i/36524),o=Ot(i,36524),d=Math.floor(o/1461),u=Ot(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[x,h]=to(m),b=s-xt(x,h,1,1),w=2;s<xt(x,h,3,1)?w=0:yt(h)&&(w=1);let y=Math.floor(((b+w)*12+373)/367),j=s-xt(x,h,y,1)+1;return new dt(x,h,y,j)}toJulianDay(n){return xt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return no[yt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return yt(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 so(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function ua(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function fa(e,n){return hs(e)-hs(n)}function hs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Rt=null;function ma(){return Rt==null&&(Rt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Rt}function xs(e){e=$n(e,new At);let n=Sn(e.era,e.year);return ha(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ha(e,n,s,a,r,i,l){let o=new Date;return o.setUTCHours(a,r,i,l),o.setUTCFullYear(e,n-1,s),o.getTime()}function ps(e,n){if(n==="UTC")return 0;if(e>0&&n===ma())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:l,second:o}=xa(e,n);return ha(s,a,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const gs=new Map;function xa(e,n){let s=gs.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),gs.set(n,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const bs=864e5;function ao(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>ro(e,n,i))}function ro(e,n,s){let a=xa(s,n);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function io(e,n,s="compatible"){let a=ga(e);if(n==="UTC")return xs(a);if(n===ma()&&s==="compatible"){a=$n(a,new At);let d=new Date,u=Sn(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=xs(a),i=ps(r-bs,n),l=ps(r+bs,n),o=ao(a,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(s){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function pa(e,n,s="compatible"){return new Date(io(e,n,s))}function ga(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new jt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function $n(e,n){if(so(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Je(a),a}function An(e,n){let s=e.copy(),a="hour"in s?Ca(s,n):0;on(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,cn(s),ba(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,lo(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,l;let d=(i=(l=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let o=s.calendar.getMonthsInYear(s);return s.month>o&&(s.month=o,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function on(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function cn(e){for(;e.month<1;)on(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,on(e,1)}function lo(e){for(;e.day<1;)e.month--,cn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,cn(e)}function ba(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 Je(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),ba(e)}function ya(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function va(e,n){return An(e,ya(n))}function ja(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),Je(s),s}function wa(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),Na(s),s}function oo(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=pt(e.hour,24),n}function Na(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 pt(e,n){let s=e%n;return s<0&&(s+=n),s}function Ca(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,oo(e)}function ka(e,n){let s=e.copy();return Ca(s,n),s}function co(e,n){return ka(e,ya(n))}function Sa(e,n,s,a){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=ze(d,s,0,o.length-1,a?.round),r.era=o[d],Je(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(s=-s),r.year=ze(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ze(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=ze(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function $a(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(a?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=ze(i,s,l,o,a?.round);break}case"minute":r.minute=ze(e.minute,s,0,59,a?.round);break;case"second":r.second=ze(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=ze(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function ze(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const uo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,fo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function mo(e){let n=e.match(uo);if(!n)throw fo.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(zt(n[1],0,9999),zt(n[2],1,12),1);return s.day=zt(n[3],1,s.calendar.getDaysInMonth(s)),s}function zt(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function Aa(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 Da(e){let n=$n(e,new At),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function ho(e){return`${Da(e)}T${Aa(e)}`}function xo(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Dn(e,n,s){xo(e,n),n.set(e,s)}function Ea(e){let n=typeof e[0]=="object"?e.shift():new At,s;if(typeof e[0]=="string")s=e.shift();else{let l=n.getEras();s=l[l.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var po=new WeakMap;class dt{copy(){return this.era?new dt(this.calendar,this.era,this.year,this.month,this.day):new dt(this.calendar,this.year,this.month,this.day)}add(n){return An(this,n)}subtract(n){return va(this,n)}set(n){return ja(this,n)}cycle(n,s,a){return Sa(this,n,s,a)}toDate(n){return pa(this,n)}toString(){return Da(this)}compare(n){return ua(this,n)}constructor(...n){Dn(this,po,{writable:!0,value:void 0});let[s,a,r,i,l]=Ea(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,Je(this)}}var go=new WeakMap;class Dt{copy(){return new Dt(this.hour,this.minute,this.second,this.millisecond)}add(n){return ka(this,n)}subtract(n){return co(this,n)}set(n){return wa(this,n)}cycle(n,s,a){return $a(this,n,s,a)}toString(){return Aa(this)}compare(n){return fa(this,n)}constructor(n=0,s=0,a=0,r=0){Dn(this,go,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,Na(this)}}var bo=new WeakMap;class jt{copy(){return this.era?new jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return An(this,n)}subtract(n){return va(this,n)}set(n){return ja(wa(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Sa(this,n,s,a);default:return $a(this,n,s,a)}}toDate(n,s){return pa(this,n,s)}toString(){return ho(this)}compare(n){let s=ua(this,n);return s===0?fa(this,ga(n)):s}constructor(...n){Dn(this,bo,{writable:!0,value:void 0});let[s,a,r,i,l]=Ea(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Je(this)}}const yo="Open time options",vo=320;function ys(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Bt(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Dt(n,s,a)}function jo(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function wo(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new Dt(s,a));return n}function No(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=yo,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[x,h]=p.useState(()=>Bt(d)),b=m?Bt(o):x,w=p.useMemo(()=>wo(n),[n]),y=N=>{m||h(N),l?.(N)},j=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(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:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:w.map(N=>{const C=b?.hour===N.hour&&b?.minute===N.minute;return t.jsx(c.Button,{variant:C?"flat":"light",color:C?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>y(N),children:jo(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,j]}),onChange:N=>y(Bt(N))})}function En(e){if(e.mode==="time")return t.jsx(No,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=vo,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:ys("min-w-[20rem]",u?.popoverContent),calendarContent:ys("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function Co(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Fe=p.forwardRef(({popoverProps:e,...n},s)=>{const a=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(Co(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:l})})});Fe.displayName="Select";function ko({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),x=p.useId(),[h,b]=p.useState(e);e!==h&&(b(e),e==="applied"&&m(""));const w=()=>{const N=f.trim();N&&n(N)},y=N=>{N.key==="Enter"&&(N.preventDefault(),w())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(ca,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const j=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:y,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":j?x:void 0}),t.jsx(H,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:w,children:o})]}),j&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const So={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function $o({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Fe,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(K.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Fe,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(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 Ao({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(H,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(H,{"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:a.login})]})}function Do({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...So,...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($o,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Ao,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Eo(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 Vt;const Fo=typeof document<"u"?(Vt=p.useInsertionEffect)!==null&&Vt!==void 0?Vt:p.useLayoutEffect:()=>{};function Et(e,n,s){let[a,r]=p.useState(e||n),i=p.useRef(a),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:a;Fo(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...x)=>{let h=typeof m=="function"?m(i.current):m;Object.is(i.current,h)||(i.current=h,r(h),u(),s?.(h,...x))},[s]);return[d,f]}function Fa(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ne.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 Ma=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:x,currentStep:h,hideProgressBars:b=!1,stepClassName:w,className:y,isDisabled:j=!1,...N},C)=>{const[v,k]=Et(h,a,x),L=p.useMemo(()=>{let $,M;const A=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":$="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":$="[--step-color:var(--heroui-secondary)]",M="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":$="[--step-color:var(--heroui-success)]",M="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":$="[--step-color:var(--heroui-warning)]",M="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":$="[--step-color:var(--heroui-danger)]",M="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":$="[--step-color:var(--heroui-default)]",M="[--step-fg-color:var(--heroui-default-foreground)]";break;default:$="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break}return A.unshift(M),A.unshift($),A},[e]);return t.jsxs("nav",{ref:C,"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",y),"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,s):`Step ${v+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",L,y),"data-testid":"stepper-list",children:Array.from({length:s})?.map(($,M)=>{const A=v===M?"active":v<M?"inactive":"complete",I=n==="activeLabel"&&A==="active"&&!!i?.[M],F=l&&A!=="active"&&!!i?.[M];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${M}`,children:[t.jsx(c.Tooltip,{content:F?i?.[M]:void 0,isDisabled:!F,offset:12,placement:o,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":A==="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":I},{"cursor-not-allowed opacity-50":j},w),onClick:()=>!j&&k(M),disabled:j,"data-testid":`stepper-step-btn-${M}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ne.LazyMotion,{features:Ne.domAnimation,children:t.jsx(Ne.m.div,{animate:A,className:"relative z-10",children:t.jsx(Ne.m.div,{animate:A,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)":I,"bg-(--complete-background-color)":A==="complete","shadow-lg":A==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:A==="complete"&&n==="default"?t.jsx(Fa,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${M}`}):t.jsx("span",{children:M+1})})})})})}),I?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${M}`,children:i[M]}):null]},M)}),M<s-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":M},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":M<v})})})]},M)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(v+1,s):`Step ${v+1} of ${s}`}):null]})});Ma.displayName="Stepper";function Mo(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 pe(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Ft(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function La(e,n,s="en-US"){const a=Ft(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function dn(e,n,s,a){return La(e-n,s,a)}const vs={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))"}},Lo="rgb(156 163 175)",To="rgb(107 114 128)",Ta=p.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Lo,inactiveLabelColor:f=To,activeStepVariant:m="bordered",stepClassName:x,circleClassName:h,progressBarClassName:b,labelsClassName:w,labelSlotClassName:y,activeLabelClassName:j,inactiveLabelClassName:N,className:C,ariaLabel:v="Progress",invalidLabelSuffix:k=", has errors",testId:L,isStepReachable:$,...M},A){const[I,F]=Et(i,a,r),D=vs[n]??vs.primary,T=o??D.active,_=d??D.fg,G=(U,B)=>{const ee=U.ariaLabel??(typeof U.title=="string"?U.title:null)??`${B+1}`;return U.invalid?`${ee}${k}`:ee};return t.jsxs("nav",{...M,"aria-label":v,...L?{"data-testid":L}:{},children:[t.jsx("div",{className:c.cn("flex items-center",C),children:s?.map((U,B)=>{const X=B===I?"active":B<I?"complete":"inactive",ee=$?$(B):!0;return t.jsxs(p.Fragment,{children:[t.jsx(H,{ref:A,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${L??"horizontal-steps"}-step-${B}`,"aria-current":X==="active"?"step":void 0,"aria-describedby":U.describedBy,"aria-label":G(U,B),"data-invalid":U.invalid?"true":void 0,isDisabled:!ee,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",ee?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",U.className,x),onPress:()=>{if(i===void 0){F(B);return}r?.(B)},children:t.jsx(Ne.LazyMotion,{features:Ne.domAnimation,children:t.jsx(Ne.m.div,{animate:X,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",h),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?T:"transparent",borderColor:T,borderWidth:"1.5px",color:m==="solid"?_:T},complete:{backgroundColor:T,borderColor:T,borderWidth:"1.5px",color:T}},children:X==="complete"?t.jsx(Fa,{className:"size-4",style:{color:_}}):t.jsx("span",{children:B+1})})})}),B<s.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:B<I?T:u}})]},B)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",w),children:s?.map((U,B)=>{const X=B<=I;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",y),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?j:N),style:{color:X?T:f},children:U.title})}),B<s.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},B)})})]})});Ta.displayName="HorizontalSteps";function Io(){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 _o=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Po,{...e},n)},Po=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,x]=p.useState(null),h=p.useMemo(()=>new Set(n),[n]),b=p.useMemo(()=>new Set(e),[e]),w=p.useMemo(()=>e.filter(F=>!h.has(F)),[e,h]),y=F=>{if(F.length===0)return;const D=Array.from(new Set([...n,...F]));s(D)},j=F=>{if(F.length===0)return;const D=new Set(F);s(n.filter(T=>!D.has(T)))},N=()=>{i.length!==0&&(y(i),l([]))},C=()=>{o.length!==0&&(j(o),d([]))},v=()=>{w.length!==0&&(y(w),l([]))},k=()=>{n.length!==0&&(s([]),d([]))},L=(F,D,T)=>{const _=Math.min(D,T),G=Math.max(D,T);return F.slice(_,G+1)},$=(F,D,T)=>{if(T&&u!==null){l(L(w,u,D)),d([]),f(D);return}const _=i.includes(F);l(_?i.filter(G=>G!==F):[...i,F]),d([]),f(D)},M=(F,D,T)=>{if(T&&m!==null){d(L(n,m,D)),l([]),x(D);return}const _=o.includes(F);d(_?o.filter(G=>G!==F):[...o,F]),l([]),x(D)},A=(F,D,T)=>{const _=T==="available"?i.includes(D)?i:[D]:o.includes(D)?o:[D];F.dataTransfer.setData("text/plain",JSON.stringify({source:T,items:_})),F.dataTransfer.effectAllowed="move"},I=(F,D)=>{F.preventDefault();const T=F.dataTransfer.getData("text/plain");if(T)try{const _=JSON.parse(T),G=(_.items||[]).filter(U=>b.has(U));if(G.length===0||_.source===D)return;D==="selected"?(y(G),l([])):(j(G),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>I(F,"available"),children:w.map((F,D)=>{const T=i.includes(F);return t.jsx("button",{type:"button",onClick:_=>{$(F,D,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>A(_,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${T?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(H,{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(H,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:C,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(H,{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:w.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(H,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:k,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>I(F,"selected"),children:n.map((F,D)=>{const T=o.includes(F);return t.jsx("button",{type:"button",onClick:_=>{M(F,D,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>A(_,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${T?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function qe({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(H,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const Te={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Oo={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Ro({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const l=()=>a(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Te.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(H,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,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:Oo[l]},l))})]})}const Ut={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function zo({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const o=()=>a(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Ut[r].icon:K.List,l=o=>{const u=Te[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(H,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:n.map(o=>{const d=Ut[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ut[o].label},o)})})]})}function Bo({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
8
8
  w-8 h-8 rounded-full border-2 cursor-pointer
9
9
  transition-all duration-200
10
10
  hover:scale-110 hover:shadow-md
11
11
  focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
12
12
  ${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
13
- `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Bo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Vo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function qt(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ye={min:50,max:200,step:10,default:100},ys={lineHeight:24,toolbarHeight:60},Uo={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},Ho={left:G.AlignLeft,center:G.AlignCenter,right:G.AlignRight,justify:G.AlignJustify};function Qe(e){return Uo[e]}function qo({value:e,onChange:n,onApply:s,placeholder:a="#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(!qt(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:qt(e)?e:"transparent"}})}),t.jsx(U,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!qt(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 vs({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=n==="textColor"?Bo:Vo,f=y=>{const v=Te[n];v&&v.execute({editor:e,config:{type:n,color:y}}),l(!1),d("")},m=y=>{f(y)},x=()=>{const y=Te[n];y&&y.execute({editor:e,config:{type:n,color:""}}),l(!1)},h=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(U,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(U,{size:"sm",variant:"light",isIconOnly:!0,onPress:x,"aria-label":"Clear color",children:t.jsx(G.X,{size:16})})]}),t.jsx(zo,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(qo,{value:o,onChange:d,onApply:m})]})]})]})})]})}function Wo({zoom:e,onZoomChange:n,min:s=ye.min,max:a=ye.max,step:r=ye.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},l=()=>{const m=Math.min(a,e+r);n(m)},o=()=>{n(ye.default)},d=e<=s,u=e>=a,f=e===ye.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(U,{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 Vo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Uo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Ht(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ye={min:50,max:200,step:10,default:100},js={lineHeight:24,toolbarHeight:60},Ho={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},qo={left:K.AlignLeft,center:K.AlignCenter,right:K.AlignRight,justify:K.AlignJustify};function Qe(e){return Ho[e]}function Wo({value:e,onChange:n,onApply:s,placeholder:a="#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(!Ht(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Ht(e)?e:"transparent"}})}),t.jsx(H,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Ht(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 ws({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=n==="textColor"?Vo:Uo,f=w=>{const y=Te[n];y&&y.execute({editor:e,config:{type:n,color:w}}),l(!1),d("")},m=w=>{f(w)},x=()=>{const w=Te[n];w&&w.execute({editor:e,config:{type:n,color:""}}),l(!1)},h=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(H,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(H,{size:"sm",variant:"light",isIconOnly:!0,onPress:x,"aria-label":"Clear color",children:t.jsx(K.X,{size:16})})]}),t.jsx(Bo,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(Wo,{value:o,onChange:d,onApply:m})]})]})]})})]})}function Yo({zoom:e,onZoomChange:n,min:s=ye.min,max:a=ye.max,step:r=ye.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},l=()=>{const m=Math.min(a,e+r);n(m)},o=()=>{n(ye.default)},d=e<=s,u=e>=a,f=e===ye.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(H,{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(U,{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 Yo({editor:e,isDisabled:n=!1}){const[s,a]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=h=>{if(h){const{from:b,to:y}=e.state.selection,v=e.isActive("link");let N="";if(v){const C=e.schema.marks.link,w=e.state.doc.resolve(b),S=Jn.getMarkRange(w,C);S&&(N=e.state.doc.textBetween(S.from,S.to,""))}else N=e.state.doc.textBetween(b,y,"");const j=e.getAttributes("link").href||"";i(N),o(j),u(v)}a(h)},x=()=>{if(l.trim()){const{from:h,to:b}=e.state.selection,y=e.schema.marks.link,v=e.state.doc.resolve(h),N=Jn.getMarkRange(v,y),j=N?.from??h,C=N?.to??b,w=e.state.doc.textBetween(j,C,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:j,to:C}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(U,{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:h=>i(h.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:h=>o(h.target.value),onKeyDown:h=>h.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(U,{size:"sm",color:"primary",onPress:x,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function Go({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function La(e,n){const s=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>ut(o)))).forEach(o=>{const d=Te[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=p.useState(s);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>ut(d)))).forEach(d=>{const u=Te[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function Ia(e,n){const s=p.useCallback((l,o)=>{if(!e)return;const d=Te[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),a=p.useCallback(l=>{s(l)},[s]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Te[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=Te[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Ko(e=ye.default){const[n,s]=p.useState(e),a=p.useCallback((o=ye.step)=>{s(d=>Math.min(ye.max,d+o))},[]),r=p.useCallback((o=ye.step)=>{s(d=>Math.max(ye.min,d-o))},[]),i=p.useCallback(()=>{s(ye.default)},[]),l=p.useCallback(o=>{const d=Math.max(ye.min,Math.min(ye.max,o));s(d)},[]);return{zoom:n,setZoom:l,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ye.min,isMaxZoom:n>=ye.max,isDefaultZoom:n===ye.default}}const Qo=["bold","italic","strike","underline","code"];function Zo({editor:e,modifiers:n,onToolbarAction:s}){const a=La(e,n),{toggleModifier:r}=Ia(e,s);if(!e)return null;const i=n.map(l=>ut(l)).filter(l=>Qo.includes(l));return i.length===0?null:t.jsx(Go,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=a[l],d=Qe(l);return t.jsx(qe,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function Xo({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:l}){const o=La(e,n),{toggleModifier:d,executeCommand:u}=Ia(e,l);if(!e)return null;const f=n.map(A=>ut(A)),m=f.some(A=>["bold","italic","strike","underline","code"].includes(A)),x=f.some(A=>["textColor","highlight"].includes(A)),h=f.includes("heading"),b=f.includes("textAlign"),y=f.some(A=>["bulletList","orderedList","taskList"].includes(A)),v=f.includes("blockquote"),N=f.includes("codeBlock"),j=f.includes("link"),C=f.includes("horizontalRule"),w=f.some(A=>["undo","redo"].includes(A)),S=s!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${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(Zo,{editor:e,modifiers:n,onToolbarAction:l}),(x||h||b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(vs,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(vs,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(h||b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx(Oo,{editor:e}),(b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const L=Ho[A],M=e.isActive({textAlign:A});return t.jsx(qe,{icon:L,label:`Align ${A}`,isActive:M,onClick:()=>u("textAlign",{type:"textAlign",alignment:A})},A)})}),(y||v||N||j||C||w||S)&&t.jsx(He,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(Ro,{editor:e,types:f.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(v||N||j||C||w||S)&&t.jsx(He,{})]}),(v||N||j||C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[v&&t.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),N&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),j&&t.jsx(Yo,{editor:e,isDisabled:o.link?.isDisabled}),C&&t.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||S)&&t.jsx(He,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(He,{})]}),S&&t.jsx(Wo,{zoom:s,onZoomChange:A=>{a?.(A),l?.({type:"zoom",modifier:`${A}%`})}})]})})}const st={bold:{category:"mark",extension:Ci.Bold,priority:100},italic:{category:"mark",extension:ki.Italic,priority:100},strike:{category:"mark",extension:Si.Strike,priority:100},underline:{category:"mark",extension:Ai.Underline,priority:100},code:{category:"mark",extension:$i.Code,priority:100},textColor:{category:"mark",extension:Di.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Ei.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Fi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Li.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ti.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:_i.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Pi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:zi.CodeBlock,priority:100},blockquote:{category:"node",extension:Bi.Blockquote,priority:100},horizontalRule:{category:"node",extension:Vi.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Ui.HardBreak,priority:100},undo:{category:"extension",extension:es.History,priority:50},redo:{category:"extension",extension:es.History,priority:50},textAlign:{category:"extension",extension:Hi.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}},Jo=[qi.Document,Wi.Text,Ii.Paragraph,Mi.TextStyle.configure({HTMLAttributes:{}}),Ri.ListItem.configure({HTMLAttributes:{}}),Oi.TaskItem.configure({nested:!0}),Yi.Dropcursor,Gi.Gapcursor];function ec(e){const n=[],s=new Set,a=new Set;Jo.forEach(o=>{o&&(n.push(o),a.add(o.name))});const r=e.map(o=>ut(o)),i=new Set;return r.forEach(o=>{const d=st[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),r.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){s.add(o);return}const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),n.sort((o,d)=>{const u=Object.values(st).find(h=>h?.extension?.name===o.name),f=Object.values(st).find(h=>h?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Ta={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"]},tc={h1:`font-size: ${oe.fontSize["4xl"]}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h2:`font-size: ${oe.fontSize["2xl"]}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h3:`font-size: ${oe.fontSize.xl}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h4:`font-size: ${oe.fontSize.lg}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h5:`font-size: ${oe.fontSize.base}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h6:`font-size: ${oe.fontSize.sm}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,p:`min-height: ${oe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${ie.xl}; margin: ${ie.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${ie.xl}; margin: ${ie.md} 0;`,li:`display: list-item; margin: ${ie.xs} 0;`,strong:`font-weight: ${oe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${oe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${oe.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${ie.sm}; color: ${ge.neutral.gray[100]}; font-family: ${oe.fontFamily.mono}; margin: ${ie.lg} 0; padding: 0.75rem ${ie.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${ie.lg} 0; padding-left: ${ie.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${ie.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.palettes.warning[200]}; border-radius: ${ie.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${ie.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},nc={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 sc(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(nc)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${l} style="${a}">`)}for(const[s,a]of Object.entries(tc)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${a}"${i.slice(l)}`}})}return n}const ac=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=yn.useCurrentEditor();return t.jsx(Xo,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},rc=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=yn.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},un=p.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=Ta.full,variant:u="bordered",initialContent:f,content:m,onContentChange:x,onUpdate:h,onToolbarAction:b,isReadOnly:y=!1,isDisabled:v=!1,includeInlineStyles:N=!0,...j}=e,{zoom:C,setZoom:w}=Ko(),S=ys.lineHeight,E=s*S,A=r?void 0:a*S,L=p.useMemo(()=>ec(d),[d]),{Component:M,label:_,shouldLabelBeOutside:D,getBaseProps:$,getLabelProps:I,getInputWrapperProps:T}=c.useInput({...j,variant:u,ref:n,isMultiline:!0}),K=_?t.jsx("label",{...I(),children:_}):null,H=p.useCallback(({editor:B})=>{const X=B.getHTML(),J=N?sc(X):X,ae=B.getJSON(),q=B.getText(),Z=q.length,Q=q.split(/\s+/).filter(ee=>ee.length>0).length,W={html:J,json:ae,text:q,characters:Z,words:Q};if(x?.(W),h?.(W),"onChange"in j&&typeof j.onChange=="function"){const ee={target:{value:J},currentTarget:{value:J}};j.onChange(ee)}},[x,h,j,N]);return t.jsxs(M,{...$(),children:[D?K:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:A?`${A+ys.toolbarHeight}px`:void 0,overflow:A?"auto":void 0},children:t.jsx(yn.EditorProvider,{editable:!y&&!v,slotBefore:o?t.jsx(ac,{modifiers:d,zoom:C,onZoomChange:w,onToolbarAction:b}):void 0,slotAfter:t.jsx(rc,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${C}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:m||f||e.defaultValue||"",onUpdate:H})})]})});un.displayName="TipTapEditor";const _a=p.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(un,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(un,{...r,variant:a,ref:n}))});_a.displayName="RichTextArea";function ic(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const js=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],lc={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Pa=({presetAmounts:e=js,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:x=3,isDisabled:h=!1,buttonVariant:b="bordered",buttonColor:y="default",inputVariant:v="bordered",size:N="md",className:j="",showCard:C=!0})=>{const w={...lc,...f},S=Array.isArray(e)?e:js,E={2:"grid-cols-2",3:"grid-cols-3"},A={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},L=`${E[m]} ${A[x]}`,[M,_]=Et(n,s,a),[D,$]=p.useState(""),[I,T]=p.useState(!1),[K,H]=p.useState(0),B=p.useCallback(Z=>{if(h)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};_(Q),$(""),T(!1),H(W=>W+1),r?.(Q)},[h,_,r]),X=p.useCallback(Z=>{if(h)return;if($(Z!==void 0?String(Z):""),r){_(null);return}if(Z===void 0||isNaN(Z)){_(null);return}_({amount:Z,isCustom:!0})},[h,_,r]),J=p.useCallback(()=>{if(h)return;const Z=D!==""?parseFloat(D):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[h,D,r]),ae=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),q=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",L),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const Q=M!==null&&!M.isCustom&&M.presetId===Z.id;return t.jsx(U,{color:Q?"primary":y,variant:Q?"solid":b,className:"w-full",onPress:()=>B(Z),isDisabled:h,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||ic(Z.amount,l,i)},Z.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,onInput:r?()=>{_(null),T(!0)}:void 0,variant:v,radius:"full",size:N,minValue:d,maxValue:u,step:.01,formatOptions:ae,value:D!==""?parseFloat(D):void 0,onValueChange:X,isDisabled:h,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:M?.isCustom===!1?M.presetId:"custom"),r&&t.jsx(U,{color:"primary",variant:"solid",radius:"full",size:N,className:"shrink-0",onPress:J,isDisabled:h||!I,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]})]});return C?t.jsx(c.Card,{className:c.cn("w-full",j),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:q})}):t.jsx("div",{className:c.cn("w-full",j),"data-testid":"donation-amounts-plain",children:q})};Pa.displayName="DonationAmounts";const oc=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},cc=e=>{switch(e){case"warning":return G.Clock;case"error":return G.AlertCircle;case"success":return G.CheckCircle;default:return G.Clock}},dc=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"}},Oa=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=oc,className:x,...h},b)=>{const[y,v]=Et(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),N=p.useRef(null),j=p.useRef(!1);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!f||y<=0){N.current&&(clearInterval(N.current),N.current=null);return}return N.current=setInterval(()=>{v(E=>E<=1?(N.current&&(clearInterval(N.current),N.current=null),j.current||(j.current=!0,a?.()),0):E-1)},1e3),()=>{N.current&&(clearInterval(N.current),N.current=null)}},[f,y,v,a]),p.useEffect(()=>{y>0&&(j.current=!1)},[y]);const C=d||cc(r),w=dc(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${l} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,S[u],x),...h,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(C,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:l})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Oa.displayName="ExpireCartTimer";const Wt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(R,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),uc=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[x,h]=p.useState(!1),[b,y]=p.useState(!1),v=p.useRef(null);return p.useEffect(()=>{const N=()=>{if(v.current){const j=v.current.scrollHeight>v.current.clientHeight;y(j)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[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&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Wt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Wt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Wt,{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:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!x&&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||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(U,{onPress:()=>h(!x),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:t.jsx(R,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function fn(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function fc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const mc={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"},Ge=e=>typeof e=="number"&&!isNaN(e),wt=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:x=!0,showPeopleCount:h=!0,showPrice:b=!0,priceDisplay:y,classNames:v={},"data-testid":N,selectedColor:j="default",compact:C=!1,isSoldOut:w,isMaxReached:S,isRuleBlocked:E,statusTone:A="default",statusLabel:L,disabledReason:M,disabled:_})=>{const D=p.useMemo(()=>({...mc,...l}),[l]),[$,I]=p.useState(s),T=n!==void 0?n:$,K=!!(d||_),H=C||!!e.compact,B=p.useMemo(()=>typeof w=="boolean"?w:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ge(e.totalTicketsSold)||!Ge(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[w,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),X=p.useMemo(()=>typeof S=="boolean"?S:typeof e.isMaxReached=="boolean"?e.isMaxReached:B||!Ge(e.ticketsAllowed)?!1:T>=e.ticketsAllowed-(e.totalTicketsSold??0),[S,e.isMaxReached,B,e.ticketsAllowed,e.totalTicketsSold,T]),J=p.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),ae=M||e.disabledReason,q=K||B||J,Z=te=>{if(q||te>0&&X)return;const he=Math.max(0,T+te);n===void 0&&I(he),a?.(e.id,he)},Q=p.useMemo(()=>{if(B)return"soldOut";if(J)return"ruleBlocked";if(K)return"disabled"},[B,J,K]),W=p.useMemo(()=>A||(B||J?"danger":X?"warning":"default"),[A,B,J,X]),ee=p.useMemo(()=>{if(Q)return Q==="ruleBlocked"?L||ae||D.ruleBlocked:Q==="soldOut"?L||ae||D.soldOut:Q==="disabled"?L||ae||D.disabled:L||D.maxReached},[Q,L,ae,D]),ce={soldOut:"danger",ruleBlocked:W,disabled:"default",maxReached:"warning"},de={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},ve=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",H&&"text-sm",v.name),children:e.name}),be=()=>{if(!b)return null;const te=y?.price??e.price,he=y?.originalPrice,Le=fn(te,i,r);if(o?.renderPrice)return o.renderPrice(te,Le,e);if(Ge(he)&&Ge(te)&&he>te){const pe=fn(he,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",H&&"mt-0.5",v.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",pe,", discounted price ",Le]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",H&&"text-xs",v.originalPrice),children:pe}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",H&&"text-sm",v.discountedPrice),children:Le})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",H&&"text-sm mt-0.5",v.price),children:Le})},Se=()=>!x||!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",H&&"mb-2 text-xs text-gray-600",v.description),children:e.description}),_e=()=>{if(!h||!Ge(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?D.person:D.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,te,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",H&&"mt-1 text-xs",v.peopleCount),children:[t.jsx(R,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Pe=()=>{const te=T===0||q,he=X||q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:T,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:he,isDisabled:q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",v.quantitySelector),children:[t.jsx(U,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:T>0?j:f,radius:"full",isIconOnly:!0,size:H?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(R,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",H&&"text-sm"),children:T}),t.jsx(U,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:he,variant:u,color:T>0?j:f,radius:"full",isIconOnly:!0,size:H?"md":"sm","aria-label":"Increase quantity",children:t.jsx(R,{icon:"gravity-ui:plus",width:16})})]})},Oe=(te,he)=>o?.renderDisabledState?o.renderDisabledState(te,he):te==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(he):te==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(he):t.jsx(c.Chip,{"data-testid":de[te],color:ce[te],variant:te==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&v.soldOut,te==="maxReached"&&v.maxReachedAlert,H&&"h-8"),startContent:t.jsx(R,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:he})}),Ve=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",H?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",q||X?"opacity-50 pointer-events-none select-none":""),children:[ve(),be(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",H?"mb-1":"mb-2"),children:[_e(),Se()]})]}),t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",H&&"space-x-1 pb-1 md:p-1",v.compactFooter),children:Q&&ee?Oe(Q,ee):Pe()})]}),Fe=X&&!B&&!J&&!K?t.jsx(Ce.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",v.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Oe("maxReached",ee||D.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",H&&v.compact,v.base),"data-testid":N||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",H?"pb-0.5":"",v.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Fe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",H?"pt-1":"",v.footer),children:Fe})})]}):t.jsxs("div",{className:c.cn("w-full",H&&v.compact,v.base),"data-testid":N||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",H?"pb-0.5":"",v.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Fe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",H?"pt-1":"",v.footer),children:Fe})})]})};wt.displayName="OfferCard";const Ra=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(R,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Ra.displayName="OfferCardEmpty";const hc={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},za=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...hc,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};za.displayName="OfferCardError";const xc={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ba=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=xc[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ba.displayName="OfferCardSkeleton";const Va={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ua={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"}}},pc={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ha=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:x="default",showCard:h=!0,animated:b=!0,gap:y=2,compact:v=!1,classNames:N={}})=>{const[j,C]=p.useState(a),w=s!==void 0?s:j,S=p.useCallback((D,$)=>{const I={...w,[D]:Math.max(0,$)};s===void 0&&C(I),r?.(I),i?.(D,I[D])},[w,s,r,i]),E=[...e].sort((D,$)=>(D.position??0)-($.position??0)),A=D=>{const $=n?n(D):D,I=(w??{})[$.id]||0;return{offer:$,quantity:I,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:v}},L=pc[y],M=c.cn("grid mx-auto pt-2",L,N.base),_=D=>{const $=A(D);return t.jsx(wt,{offer:$.offer,quantity:$.quantity,onQuantityChange:$.onQuantityChange,currency:$.currency,locale:$.locale,labels:$.labels,slots:$.slots,isDisabled:$.isDisabled,buttonVariant:$.buttonVariant,buttonColor:$.buttonColor,showCard:$.showCard,compact:$.compact,classNames:N.card},$.offer.id)};return b?t.jsx(Ce.motion.div,{"data-testid":"offer-card-list",className:M,variants:Va,initial:"hidden",animate:"show",children:t.jsx(Ce.AnimatePresence,{children:E.map(D=>{const $=A(D);return t.jsx(Ce.motion.div,{"data-testid":`offer-card-list-item-${$.offer.id}`,className:N.cardWrapper,variants:Ua,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(wt,{offer:$.offer,quantity:$.quantity,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:v||$.offer.compact,classNames:N.card})},$.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:M,children:E.map(_)})};Ha.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,ke=e=>e==null;const qa=e=>typeof e=="object";var me=e=>!ke(e)&&!Array.isArray(e)&&qa(e)&&!We(e),Wa=e=>me(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,gc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ya=(e,n)=>e.has(gc(n)),bc=e=>{const n=e.constructor&&e.constructor.prototype;return me(n)&&n.hasOwnProperty("isPrototypeOf")},Fn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ue(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Fn&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(me(e)&&bc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=ue(e[r]));return a}var Mt=e=>/^\w*$/.test(e),le=e=>e===void 0,Mn=e=>Array.isArray(e)?e.filter(Boolean):[],Ln=e=>Mn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,n,s)=>{if(!n||!me(e))return s;const a=(Mt(n)?[n]:Ln(n)).reduce((r,i)=>ke(r)?r:r[i],e);return le(a)||a===e?le(e[n])?s:e[n]:a},Ae=e=>typeof e=="boolean",Ne=e=>typeof e=="function",re=(e,n,s)=>{let a=-1;const r=Mt(n)?[n]:Ln(n),i=r.length,l=i-1;for(;++a<i;){const o=r[a];let d=s;if(a!==l){const u=e[o];d=me(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const Nt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},De={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ga=p.createContext(null);Ga.displayName="HookFormControlContext";const In=()=>p.useContext(Ga);var Ka=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==De.all&&(n._proxyFormState[l]=!a||De.all),s&&(s[l]=!0),e[l]}});return r};const Tn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function yc(e){const n=In(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[l,o]=p.useState(s._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Tn(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&o({...s._formState,...u})}}),[r,a,i]),p.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),p.useMemo(()=>Ka(l,s,d.current,!1),[l,s])}var $e=e=>typeof e=="string",mn=(e,n,s,a,r)=>$e(e)?(a&&n.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),z(s,i))):(a&&(n.watchAll=!0),s),hn=e=>ke(e)||!qa(e);function Ee(e,n,s=new WeakSet){if(hn(e)||hn(n))return Object.is(e,n);if(We(e)&&We(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(We(l)&&We(o)||me(l)&&me(o)||Array.isArray(l)&&Array.isArray(o)?!Ee(l,o,s):!Object.is(l,o))return!1}}return!0}function vc(e){const n=In(),{control:s=n,name:a,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(s),x=p.useRef(a);u.current=o;const[h,b]=p.useState(()=>{const w=s._getWatch(a,d.current);return u.current?u.current(w):w}),y=p.useCallback(w=>{const S=mn(a,s._names,w||s._formValues,!1,d.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),v=p.useCallback(w=>{if(!i){const S=mn(a,s._names,w||s._formValues,!1,d.current);if(u.current){const E=u.current(S);Ee(E,f.current)||(b(E),f.current=E)}else b(S)}},[s._formValues,s._names,i,a]);Tn(()=>((m.current!==s||!Ee(x.current,a))&&(m.current=s,x.current=a,v()),s._subscribe({name:a,formState:{values:!0},exact:l,callback:w=>{v(w.values)}})),[s,l,a,v]),p.useEffect(()=>s._removeUnmounted());const N=m.current!==s,j=x.current,C=p.useMemo(()=>{if(i)return null;const w=!N&&!Ee(j,a);return N||w?y():null},[i,N,a,j,y]);return C!==null?C:h}function jc(e){const n=In(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Ya(r._names.array,s),u=p.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,l)),[r,s,l]),f=vc({control:r,name:s,defaultValue:u,exact:o}),m=yc({control:r,name:s,exact:o}),x=p.useRef(e),h=p.useRef(void 0),b=p.useRef(r.register(s,{...e.rules,value:f,...Ae(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const y=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(m.validatingFields,s)},error:{enumerable:!0,get:()=>z(m.errors,s)}}),[m,s]),v=p.useCallback(w=>b.current.onChange({target:{value:Wa(w),name:s},type:Nt.CHANGE}),[s]),N=p.useCallback(()=>b.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Nt.BLUR}),[s,r._formValues]),j=p.useCallback(w=>{const S=z(r._fields,s);S&&S._f&&w&&(S._f.ref={focus:()=>Ne(w.focus)&&w.focus(),select:()=>Ne(w.select)&&w.select(),setCustomValidity:E=>Ne(w.setCustomValidity)&&w.setCustomValidity(E),reportValidity:()=>Ne(w.reportValidity)&&w.reportValidity()})},[r._fields,s]),C=p.useMemo(()=>({name:s,value:f,...Ae(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:v,onBlur:N,ref:j}),[s,a,m.disabled,v,N,j,f]);return p.useEffect(()=>{const w=r._options.shouldUnregister||i,S=h.current;S&&S!==s&&!d&&r.unregister(S),r.register(s,{...x.current.rules,...Ae(x.current.disabled)?{disabled:x.current.disabled}:{}});const E=(A,L)=>{const M=z(r._fields,A);M&&M._f&&(M._f.mount=L)};if(E(s,!0),w){const A=ue(z(r._options.defaultValues,s,x.current.defaultValue));re(r._defaultValues,s,A),le(z(r._formValues,s))&&re(r._formValues,s,A)}return!d&&r.register(s),h.current=s,()=>{(d?w&&!r._state.action:w)?r.unregister(s):E(s,!1)}},[s,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),p.useMemo(()=>({field:C,formState:m,fieldState:y}),[C,m,y])}const wc=p.createContext(null);wc.displayName="HookFormContext";var Nc=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},lt=e=>Array.isArray(e)?e:[e],ws=()=>{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 Qa(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&me(r)&&i){const l=Qa(r,i);me(l)&&(s[a]=l)}else e[a]&&(s[a]=i)}return s}var we=e=>me(e)&&!Object.keys(e).length,_n=e=>e.type==="file",Ct=e=>{if(!Fn)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Za=e=>e.type==="select-multiple",Pn=e=>e.type==="radio",Cc=e=>Pn(e)||ft(e),Yt=e=>Ct(e)&&e.isConnected;function kc(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=le(e)?a++:e[n[a++]];return e}function Sc(e){for(const n in e)if(e.hasOwnProperty(n)&&!le(e[n]))return!1;return!0}function fe(e,n){const s=Array.isArray(n)?n:Mt(n)?[n]:Ln(n),a=s.length===1?e:kc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(me(a)&&we(a)||Array.isArray(a)&&Sc(a))&&fe(e,s.slice(0,-1)),e}var Ac=e=>{for(const n in e)if(Ne(e[n]))return!0;return!1};function Xa(e){return Array.isArray(e)||me(e)&&!Ac(e)}function xn(e,n={}){for(const s in e){const a=e[s];Xa(a)?(n[s]=Array.isArray(a)?[]:{},xn(a,n[s])):le(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=xn(n));for(const a in e){const r=e[a];if(Xa(r))le(n)||hn(s[a])?s[a]=xn(r,Array.isArray(r)?[]:{}):Ze(r,ke(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Ee(r,i)}}return s}const Ns={value:!1,isValid:!1},Cs={value:!0,isValid:!0};var Ja=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!le(e[0].attributes.value)?le(e[0].value)||e[0].value===""?Cs:{value:e[0].value,isValid:!0}:Cs:Ns}return Ns},er=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>le(e)?e:n?e===""?NaN:e&&+e:s&&$e(e)?new Date(e):a?a(e):e;const ks={isValid:!1,value:null};var tr=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,ks):ks;function Ss(e){const n=e.ref;return _n(n)?n.files:Pn(n)?tr(e.refs).value:Za(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?Ja(e.refs).value:er(le(n.value)?e.ref.value:n.value,e)}var $c=(e,n,s,a)=>{const r={};for(const i of e){const l=z(n,i);l&&re(r,i,l._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},kt=e=>e instanceof RegExp,at=e=>le(e)?e:kt(e)?e.source:me(e)?kt(e.value)?e.value.source:e.value:e,As=e=>({isOnSubmit:!e||e===De.onSubmit,isOnBlur:e===De.onBlur,isOnChange:e===De.onChange,isOnAll:e===De.all,isOnTouch:e===De.onTouched});const $s="AsyncFunction";var Dc=e=>!!e&&!!e.validate&&!!(Ne(e.validate)&&e.validate.constructor.name===$s||me(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===$s)),Ec=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ds=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ot=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=z(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!a)return!0;if(l.ref&&n(l.ref,l.name)&&!a)return!0;if(ot(o,n))break}else if(me(o)&&ot(o,n))break}}};function Es(e,n,s){const a=z(e,s);if(a||Mt(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),l=z(n,i),o=z(e,i);if(l&&!Array.isArray(l)&&s!==i)return{name:s};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:s}}var Fc=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return we(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!a||De.all))},Mc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Lc=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,Ic=(e,n)=>!Mn(z(e,n)).length&&fe(e,n),Tc=(e,n,s)=>{const a=lt(z(e,s));return re(a,"root",n[s]),re(e,s,a),e};function Fs(e,n,s="validate"){if($e(e)||Array.isArray(e)&&e.every($e)||Ae(e)&&!e)return{type:s,message:$e(e)?e:"",ref:n}}var Ke=e=>me(e)&&!kt(e)?e:{value:e,message:""},Ms=async(e,n,s,a,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:x,pattern:h,validate:b,name:y,valueAsNumber:v,mount:N}=e._f,j=z(s,y);if(!N||n.has(y))return{};const C=o?o[0]:l,w=$=>{r&&C.reportValidity&&(C.setCustomValidity(Ae($)?"":$||""),C.reportValidity())},S={},E=Pn(l),A=ft(l),L=E||A,M=(v||_n(l))&&le(l.value)&&le(j)||Ct(l)&&l.value===""||j===""||Array.isArray(j)&&!j.length,_=Nc.bind(null,y,a,S),D=($,I,T,K=Ie.maxLength,H=Ie.minLength)=>{const B=$?I:T;S[y]={type:$?K:H,message:B,ref:l,..._($?K:H,B)}};if(i?!Array.isArray(j)||!j.length:d&&(!L&&(M||ke(j))||Ae(j)&&!j||A&&!Ja(o).isValid||E&&!tr(o).isValid)){const{value:$,message:I}=$e(d)?{value:!!d,message:d}:Ke(d);if($&&(S[y]={type:Ie.required,message:I,ref:C,..._(Ie.required,I)},!a))return w(I),S}if(!M&&(!ke(m)||!ke(x))){let $,I;const T=Ke(x),K=Ke(m);if(!ke(j)&&!isNaN(j)){const H=l.valueAsNumber||j&&+j;ke(T.value)||($=H>T.value),ke(K.value)||(I=H<K.value)}else{const H=l.valueAsDate||new Date(j),B=ae=>new Date(new Date().toDateString()+" "+ae),X=l.type=="time",J=l.type=="week";$e(T.value)&&j&&($=X?B(j)>B(T.value):J?j>T.value:H>new Date(T.value)),$e(K.value)&&j&&(I=X?B(j)<B(K.value):J?j<K.value:H<new Date(K.value))}if(($||I)&&(D(!!$,T.message,K.message,Ie.max,Ie.min),!a))return w(S[y].message),S}if((u||f)&&!M&&($e(j)||i&&Array.isArray(j))){const $=Ke(u),I=Ke(f),T=!ke($.value)&&j.length>+$.value,K=!ke(I.value)&&j.length<+I.value;if((T||K)&&(D(T,$.message,I.message),!a))return w(S[y].message),S}if(h&&!M&&$e(j)){const{value:$,message:I}=Ke(h);if(kt($)&&!j.match($)&&(S[y]={type:Ie.pattern,message:I,ref:l,..._(Ie.pattern,I)},!a))return w(I),S}if(b){if(Ne(b)){const $=await b(j,s),I=Fs($,C);if(I&&(S[y]={...I,..._(Ie.validate,I.message)},!a))return w(I.message),S}else if(me(b)){let $={};for(const I in b){if(!we($)&&!a)break;const T=Fs(await b[I](j,s),C,I);T&&($={...T,..._(I,T.message)},w(T.message),a&&(S[y]=$))}if(!we($)&&(S[y]={ref:C,...$},!a))return S}}return w(!0),S};const _c={mode:De.onSubmit,reValidateMode:De.onChange,shouldFocusError:!0};function Pc(e={}){let n={..._c,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ne(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=me(n.defaultValues)||me(n.values)?ue(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:ue(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 x={...m};const h={array:ws(),state:ws()},b=n.criteriaMode===De.all,y=g=>k=>{clearTimeout(u),u=setTimeout(g,k)},v=async g=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||x.isValid||g)){let k;n.resolver?(k=we((await L()).errors),N()):k=await _(a,!0),k!==s.isValid&&h.state.next({isValid:k})}},N=(g,k)=>{!n.disabled&&(m.isValidating||m.validatingFields||x.isValidating||x.validatingFields)&&((g||Array.from(o.mount)).forEach(F=>{F&&(k?re(s.validatingFields,F,k):fe(s.validatingFields,F))}),h.state.next({validatingFields:s.validatingFields,isValidating:!we(s.validatingFields)}))},j=(g,k=[],F,V,O=!0,P=!0)=>{if(V&&F&&!n.disabled){if(l.action=!0,P&&Array.isArray(z(a,g))){const Y=F(z(a,g),V.argA,V.argB);O&&re(a,g,Y)}if(P&&Array.isArray(z(s.errors,g))){const Y=F(z(s.errors,g),V.argA,V.argB);O&&re(s.errors,g,Y),Ic(s.errors,g)}if((m.touchedFields||x.touchedFields)&&P&&Array.isArray(z(s.touchedFields,g))){const Y=F(z(s.touchedFields,g),V.argA,V.argB);O&&re(s.touchedFields,g,Y)}(m.dirtyFields||x.dirtyFields)&&(s.dirtyFields=Ze(r,i)),h.state.next({name:g,isDirty:$(g,k),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else re(i,g,k)},C=(g,k)=>{re(s.errors,g,k),h.state.next({errors:s.errors})},w=g=>{s.errors=g,h.state.next({errors:s.errors,isValid:!1})},S=(g,k,F,V)=>{const O=z(a,g);if(O){const P=z(i,g,le(F)?z(r,g):F);le(P)||V&&V.defaultChecked||k?re(i,g,k?P:Ss(O._f)):K(g,P),l.mount&&!l.action&&v()}},E=(g,k,F,V,O)=>{let P=!1,Y=!1;const ne={name:g};if(!n.disabled){if(!F||V){(m.isDirty||x.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=$(),P=Y!==ne.isDirty);const se=Ee(z(r,g),k);Y=!!z(s.dirtyFields,g),se?fe(s.dirtyFields,g):re(s.dirtyFields,g,!0),ne.dirtyFields=s.dirtyFields,P=P||(m.dirtyFields||x.dirtyFields)&&Y!==!se}if(F){const se=z(s.touchedFields,g);se||(re(s.touchedFields,g,F),ne.touchedFields=s.touchedFields,P=P||(m.touchedFields||x.touchedFields)&&se!==F)}P&&O&&h.state.next(ne)}return P?ne:{}},A=(g,k,F,V)=>{const O=z(s.errors,g),P=(m.isValid||x.isValid)&&Ae(k)&&s.isValid!==k;if(n.delayError&&F?(d=y(()=>C(g,F)),d(n.delayError)):(clearTimeout(u),d=null,F?re(s.errors,g,F):fe(s.errors,g)),(F?!Ee(O,F):O)||!we(V)||P){const Y={...V,...P&&Ae(k)?{isValid:k}:{},errors:s.errors,name:g};s={...s,...Y},h.state.next(Y)}},L=async g=>(N(g,!0),await n.resolver(i,n.context,$c(g||o.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),M=async g=>{const{errors:k}=await L(g);if(N(g),g)for(const F of g){const V=z(k,F);V?re(s.errors,F,V):fe(s.errors,F)}else s.errors=k;return k},_=async(g,k,F={valid:!0})=>{for(const V in g){const O=g[V];if(O){const{_f:P,...Y}=O;if(P){const ne=o.array.has(P.name),se=O._f&&Dc(O._f);se&&m.validatingFields&&N([P.name],!0);const je=await Ms(O,o.disabled,i,b,n.shouldUseNativeValidation&&!k,ne);if(se&&m.validatingFields&&N([P.name]),je[P.name]&&(F.valid=!1,k||e.shouldUseNativeValidation))break;!k&&(z(je,P.name)?ne?Tc(s.errors,je,P.name):re(s.errors,P.name,je[P.name]):fe(s.errors,P.name))}!we(Y)&&await _(Y,k,F)}}return F.valid},D=()=>{for(const g of o.unMount){const k=z(a,g);k&&(k._f.refs?k._f.refs.every(F=>!Yt(F)):!Yt(k._f.ref))&&ve(g)}o.unMount=new Set},$=(g,k)=>!n.disabled&&(g&&k&&re(i,g,k),!Ee(q(),r)),I=(g,k,F)=>mn(g,o,{...l.mount?i:le(k)?r:$e(g)?{[g]:k}:k},F,k),T=g=>Mn(z(l.mount?i:r,g,n.shouldUnregister?z(r,g,[]):[])),K=(g,k,F={})=>{const V=z(a,g);let O=k;if(V){const P=V._f;P&&(!P.disabled&&re(i,g,er(k,P)),O=Ct(P.ref)&&ke(k)?"":k,Za(P.ref)?[...P.ref.options].forEach(Y=>Y.selected=O.includes(Y.value)):P.refs?ft(P.ref)?P.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(O)?Y.checked=!!O.find(ne=>ne===Y.value):Y.checked=O===Y.value||!!O)}):P.refs.forEach(Y=>Y.checked=Y.value===O):_n(P.ref)?P.ref.value="":(P.ref.value=O,P.ref.type||h.state.next({name:g,values:ue(i)})))}(F.shouldDirty||F.shouldTouch)&&E(g,O,F.shouldTouch,F.shouldDirty,!0),F.shouldValidate&&ae(g)},H=(g,k,F)=>{for(const V in k){if(!k.hasOwnProperty(V))return;const O=k[V],P=g+"."+V,Y=z(a,P);(o.array.has(g)||me(O)||Y&&!Y._f)&&!We(O)?H(P,O,F):K(P,O,F)}},B=(g,k,F={})=>{const V=z(a,g),O=o.array.has(g),P=ue(k);re(i,g,P),O?(h.array.next({name:g,values:ue(i)}),(m.isDirty||m.dirtyFields||x.isDirty||x.dirtyFields)&&F.shouldDirty&&h.state.next({name:g,dirtyFields:Ze(r,i),isDirty:$(g,P)})):V&&!V._f&&!ke(P)?H(g,P,F):K(g,P,F),Ds(g,o)?h.state.next({...s,name:g,values:ue(i)}):h.state.next({name:l.mount?g:void 0,values:ue(i)})},X=async g=>{l.mount=!0;const k=g.target;let F=k.name,V=!0;const O=z(a,F),P=se=>{V=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||Ee(se,z(i,F,se))},Y=As(n.mode),ne=As(n.reValidateMode);if(O){let se,je;const Ue=k.type?Ss(O._f):Wa(g),Re=g.type===Nt.BLUR||g.type===Nt.FOCUS_OUT,ji=!Ec(O._f)&&!n.resolver&&!z(s.errors,F)&&!O._f.deps||Lc(Re,z(s.touchedFields,F),s.isSubmitted,ne,Y),Tt=Ds(F,o,Re);re(i,F,Ue),Re?(!k||!k.readOnly)&&(O._f.onBlur&&O._f.onBlur(g),d&&d(0)):O._f.onChange&&O._f.onChange(g);const _t=E(F,Ue,Re),wi=!we(_t)||Tt;if(!Re&&h.state.next({name:F,type:g.type,values:ue(i)}),ji)return(m.isValid||x.isValid)&&(n.mode==="onBlur"?Re&&v():Re||v()),wi&&h.state.next({name:F,...Tt?{}:_t});if(!Re&&Tt&&h.state.next({...s}),n.resolver){const{errors:Zn}=await L([F]);if(N([F]),P(Ue),V){const Ni=Es(s.errors,a,F),Xn=Es(Zn,a,Ni.name||F);se=Xn.error,F=Xn.name,je=we(Zn)}}else N([F],!0),se=(await Ms(O,o.disabled,i,b,n.shouldUseNativeValidation))[F],N([F]),P(Ue),V&&(se?je=!1:(m.isValid||x.isValid)&&(je=await _(a,!0)));V&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&ae(O._f.deps),A(F,je,se,_t))}},J=(g,k)=>{if(z(s.errors,k)&&g.focus)return g.focus(),1},ae=async(g,k={})=>{let F,V;const O=lt(g);if(n.resolver){const P=await M(le(g)?g:O);F=we(P),V=g?!O.some(Y=>z(P,Y)):F}else g?(V=(await Promise.all(O.map(async P=>{const Y=z(a,P);return await _(Y&&Y._f?{[P]:Y}:Y)}))).every(Boolean),!(!V&&!s.isValid)&&v()):V=F=await _(a);return h.state.next({...!$e(g)||(m.isValid||x.isValid)&&F!==s.isValid?{}:{name:g},...n.resolver||!g?{isValid:F}:{},errors:s.errors}),k.shouldFocus&&!V&&ot(a,J,g?O:o.mount),V},q=(g,k)=>{let F={...l.mount?i:r};return k&&(F=Qa(k.dirtyFields?s.dirtyFields:s.touchedFields,F)),le(g)?F:$e(g)?z(F,g):g.map(V=>z(F,V))},Z=(g,k)=>({invalid:!!z((k||s).errors,g),isDirty:!!z((k||s).dirtyFields,g),error:z((k||s).errors,g),isValidating:!!z(s.validatingFields,g),isTouched:!!z((k||s).touchedFields,g)}),Q=g=>{g&&lt(g).forEach(k=>fe(s.errors,k)),h.state.next({errors:g?s.errors:{}})},W=(g,k,F)=>{const V=(z(a,g,{_f:{}})._f||{}).ref,O=z(s.errors,g)||{},{ref:P,message:Y,type:ne,...se}=O;re(s.errors,g,{...se,...k,ref:V}),h.state.next({name:g,errors:s.errors,isValid:!1}),F&&F.shouldFocus&&V&&V.focus&&V.focus()},ee=(g,k)=>Ne(g)?h.state.subscribe({next:F=>"values"in F&&g(I(void 0,k),F)}):I(g,k,!0),ce=g=>h.state.subscribe({next:k=>{Mc(g.name,k.name,g.exact)&&Fc(k,g.formState||m,Le,g.reRenderRoot)&&g.callback({values:{...i},...s,...k,defaultValues:r})}}).unsubscribe,de=g=>(l.mount=!0,x={...x,...g.formState},ce({...g,formState:{...f,...g.formState}})),ve=(g,k={})=>{for(const F of g?lt(g):o.mount)o.mount.delete(F),o.array.delete(F),k.keepValue||(fe(a,F),fe(i,F)),!k.keepError&&fe(s.errors,F),!k.keepDirty&&fe(s.dirtyFields,F),!k.keepTouched&&fe(s.touchedFields,F),!k.keepIsValidating&&fe(s.validatingFields,F),!n.shouldUnregister&&!k.keepDefaultValue&&fe(r,F);h.state.next({values:ue(i)}),h.state.next({...s,...k.keepDirty?{isDirty:$()}:{}}),!k.keepIsValid&&v()},be=({disabled:g,name:k})=>{if(Ae(g)&&l.mount||g||o.disabled.has(k)){const O=o.disabled.has(k)!==!!g;g?o.disabled.add(k):o.disabled.delete(k),O&&l.mount&&!l.action&&v()}},Se=(g,k={})=>{let F=z(a,g);const V=Ae(k.disabled)||Ae(n.disabled);return re(a,g,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:g}},name:g,mount:!0,...k}}),o.mount.add(g),F?be({disabled:Ae(k.disabled)?k.disabled:n.disabled,name:g}):S(g,!0,k.value),{...V?{disabled:k.disabled||n.disabled}:{},...n.progressive?{required:!!k.required,min:at(k.min),max:at(k.max),minLength:at(k.minLength),maxLength:at(k.maxLength),pattern:at(k.pattern)}:{},name:g,onChange:X,onBlur:X,ref:O=>{if(O){Se(g,k),F=z(a,g);const P=le(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,Y=Cc(P),ne=F._f.refs||[];if(Y?ne.find(se=>se===P):P===F._f.ref)return;re(a,g,{_f:{...F._f,...Y?{refs:[...ne.filter(Yt),P,...Array.isArray(z(r,g))?[{}]:[]],ref:{type:P.type,name:g}}:{ref:P}}}),S(g,!1,void 0,P)}else F=z(a,g,{}),F._f&&(F._f.mount=!1),(n.shouldUnregister||k.shouldUnregister)&&!(Ya(o.array,g)&&l.action)&&o.unMount.add(g)}}},_e=()=>n.shouldFocusError&&ot(a,J,o.mount),Pe=g=>{Ae(g)&&(h.state.next({disabled:g}),ot(a,(k,F)=>{const V=z(a,F);V&&(k.disabled=V._f.disabled||g,Array.isArray(V._f.refs)&&V._f.refs.forEach(O=>{O.disabled=V._f.disabled||g}))},0,!1))},Oe=(g,k)=>async F=>{let V;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let O=ue(i);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Y}=await L();N(),s.errors=P,O=ue(Y)}else await _(a);if(o.disabled.size)for(const P of o.disabled)fe(O,P);if(fe(s.errors,"root"),we(s.errors)){h.state.next({errors:{}});try{await g(O,F)}catch(P){V=P}}else k&&await k({...s.errors},F),_e(),setTimeout(_e);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(s.errors)&&!V,submitCount:s.submitCount+1,errors:s.errors}),V)throw V},Ve=(g,k={})=>{z(a,g)&&(le(k.defaultValue)?B(g,ue(z(r,g))):(B(g,k.defaultValue),re(r,g,ue(k.defaultValue))),k.keepTouched||fe(s.touchedFields,g),k.keepDirty||(fe(s.dirtyFields,g),s.isDirty=k.defaultValue?$(g,ue(z(r,g))):$()),k.keepError||(fe(s.errors,g),m.isValid&&v()),h.state.next({...s}))},Fe=(g,k={})=>{const F=g?ue(g):r,V=ue(F),O=we(g),P=O?r:V;if(k.keepDefaultValues||(r=F),!k.keepValues){if(k.keepDirtyValues){const Y=new Set([...o.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),je=z(i,ne),Ue=z(P,ne);se&&!le(je)?re(P,ne,je):!se&&!le(Ue)&&B(ne,Ue)}}else{if(Fn&&le(g))for(const Y of o.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Ct(se)){const je=se.closest("form");if(je){je.reset();break}}}}if(k.keepFieldsRef)for(const Y of o.mount)B(Y,z(P,Y));else a={}}i=n.shouldUnregister?k.keepDefaultValues?ue(r):{}:ue(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}o={mount:k.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!k.keepIsValid||!!k.keepDirtyValues||!n.shouldUnregister&&!we(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!k.keepIsValid,l.action=!1,k.keepErrors||(s.errors={}),h.state.next({submitCount:k.keepSubmitCount?s.submitCount:0,isDirty:O?!1:k.keepDirty?s.isDirty:!!(k.keepDefaultValues&&!Ee(g,r)),isSubmitted:k.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:O?{}:k.keepDirtyValues?k.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:k.keepDefaultValues&&g?Ze(r,g):k.keepDirty?s.dirtyFields:{},touchedFields:k.keepTouched?s.touchedFields:{},errors:k.keepErrors?s.errors:{},isSubmitSuccessful:k.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(g,k)=>Fe(Ne(g)?g(i):g,{...n.resetOptions,...k}),he=(g,k={})=>{const F=z(a,g),V=F&&F._f;if(V){const O=V.refs?V.refs[0]:V.ref;O.focus&&setTimeout(()=>{O.focus(),k.shouldSelect&&Ne(O.select)&&O.select()})}},Le=g=>{s={...s,...g}},pe={control:{register:Se,unregister:ve,getFieldState:Z,handleSubmit:Oe,setError:W,_subscribe:ce,_runSchema:L,_updateIsValidating:N,_focusError:_e,_getWatch:I,_getDirty:$,_setValid:v,_setFieldArray:j,_setDisabledField:be,_setErrors:w,_getFieldArray:T,_reset:Fe,_resetDefaultValues:()=>Ne(n.defaultValues)&&n.defaultValues().then(g=>{te(g,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:Pe,_subjects:h,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(g){l=g},get _defaultValues(){return r},get _names(){return o},set _names(g){o=g},get _formState(){return s},get _options(){return n},set _options(g){n={...n,...g}}},subscribe:de,trigger:ae,register:Se,handleSubmit:Oe,watch:ee,setValue:B,getValues:q,reset:te,resetField:Ve,clearErrors:Q,unregister:ve,setError:W,setFocus:he,getFieldState:Z};return{...pe,formControl:pe}}function Oc(e={}){const n=p.useRef(void 0),s=p.useRef(void 0),[a,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ne(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:Ne(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!Ne(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Pc(e);n.current={...o,formState:a}}const i=n.current.control;return i._options=e,Tn(()=>{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!==a.isDirty&&i._subjects.state.next({isDirty:l})}},[i,a.isDirty]),p.useEffect(()=>{var l;e.values&&!Ee(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),s.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),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(()=>Ka(a,i),[i,a]),n.current}function Rc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function zc(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Bc(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 Vc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Uc(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function On(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}On();const Hc={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:"$"},Gt=()=>({id:On(),amount:0,glAccount:null,isTaxDeductible:!1}),nr=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:x=!1,labels:h,classNames:b={},"data-testid":y,control:v,name:N,rules:j})=>{const C={...Hc,...h},w=v!==void 0&&N!==void 0,S=Oc({defaultValues:{_internal:n||Gt()}}),E=jc({control:w?v:S.control,name:w?N:"_internal",rules:w?j:void 0}),[A,L]=p.useState(n||Gt()),M=w?E.field.value??Gt():e??A,_=w&&!!E.fieldState?.error,D=w&&(E.fieldState?.isTouched??!1),$=_||D,I=$&&(!M.amount||M.amount<=0),T=$&&!M.glAccount,[K,H]=p.useState(M.glAccount?.name||""),B=p.useCallback(W=>{const ee={...M,...W};w&&E.field.onChange(ee),!w&&e===void 0&&L(ee),i?.(ee)},[M,e,i,w,E]),X=p.useCallback(W=>{const ee=W||0;B({amount:ee}),l?.(ee)},[B,l]),J=p.useCallback(W=>{H(W),r?.(W)},[r]),ae=p.useCallback(W=>{if(W===null){B({glAccount:null}),o?.(null);return}const ce=s.find(de=>String(de.id)===String(W))||null;B({glAccount:ce}),o?.(ce)},[s,B,o]),q=p.useCallback(()=>{H(""),B({glAccount:null}),o?.(null)},[B,o]),Z=p.useCallback(W=>{B({isTaxDeductible:W}),d?.(W)},[B,d]),Q=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.amount,t.jsx(c.Tooltip,{content:C.amountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:M.amount||void 0,onValueChange:X,labelPlacement:"outside",placeholder:C.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:x,isInvalid:I,errorMessage:I?"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:C.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.glAccount,t.jsx(c.Tooltip,{content:C.glAccountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:M.glAccount?.name??K,selectedKey:M.glAccount?.id??null,isDisabled:x,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?C.searching:C.noGlAccountsFound},placeholder:C.glAccountPlaceholder,onInputChange:J,onSelectionChange:ae,onClear:q,className:b.glAccountInput,children:W=>t.jsx(c.AutocompleteItem,{textValue:W.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:W.name}),W.code&&t.jsx("span",{className:"text-xs text-default-400",children:W.code})]})},W.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:M.isTaxDeductible,onValueChange:Z,isDisabled:x||!m,className:b.taxDeductibleCheckbox,children:C.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(U,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!f,onPress:Q,startContent:t.jsx(R,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:C.deleteButton})})]})})};nr.displayName="RevenueDistributionCard";const sr=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(R,{icon:n,width:s,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};sr.displayName="RevenueDistributionEmpty";const qc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},ar=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...qc,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};ar.displayName="RevenueDistributionError";const rr=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};rr.displayName="RevenueDistributionSkeleton";function Lt({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(U,{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(U,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const Wc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function pn(e){return!e.fund&&Number(e.percentage||0)<=0}function Yc({mode:e,assignments:n}){const s=n.filter(l=>!pn(l)),a=s.filter(l=>l.fund),r=a.reduce((l,o)=>l+Number(o.percentage||0),0),i=s.some(l=>!l.fund||Number(l.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Gc={title:"Payment assignment",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"},ir={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},rt={...ir,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Kc={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"},Qc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Zc(){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 Xc=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Jc=e=>e.fund!==null;function ed({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,isFundPickerOpen:l=!1,activeAssignmentId:o=null,modalPortalContainer:d,footer:u,onAssignmentsChange:f,onOpenFundPicker:m,onCloseFundPicker:x,onCollapseChange:h,onSave:b}){const[y,v]=p.useState(null),N=d??y??void 0,j={...Gc,...s},C=e.filter(W=>!pn(W)),S=C.filter(Jc).length>0,E=p.useMemo(()=>e.filter(W=>!pn(W)).reduce((W,ee)=>W+Number(ee.percentage||0),0),[e]),A=Math.round(E*100)/100,L=C.some(W=>!W.fund||Number(W.percentage||0)<=0),M=S&&(A!==100||L),_=`${j.totalError} (${j.total} ${Number(E.toFixed(2))}%)`,D=Yc({mode:"split",assignments:e}),$=S&&A>=100,[I,T]=p.useState(!1),[K,H]=p.useState(!1),B=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Zc,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title})]}),X=(W,ee)=>{f(e.map(ce=>ce.id===W?{...ce,...ee}:ce))},J=()=>{$||f([...e,Wc()])},ae=W=>{e.length<=1||f(e.filter(ee=>ee.id!==W))},q=()=>{if(!r){if(!D){H(!0);return}if(!i){b();return}T(!0)}},Z=()=>{T(!1),b()},Q=W=>{const ee=o??e.find(ce=>!ce.fund)?.id??e[0]?.id;ee&&(f(e.map(ce=>ce.id===ee?{...ce,fund:W}:ce)),x())};return t.jsxs("div",{ref:v,className:c.cn("vvt-pa relative font-sans text-zinc-900",l&&!d&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:W=>h?.(!(W==="all"||Array.from(W).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":j.title,title:B,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!S&&t.jsx(c.Alert,{icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:ir,color:"default",variant:"flat",title:j.emptySplit}),S&&t.jsx(td,{assignments:e,labels:j,total:E,hasTotalError:K&&!D||M,validationMessage:_,onSelectFund:W=>m(W),onRemoveFund:ae,onPercentageChange:(W,ee)=>X(W,{percentage:Xc(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(U,{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",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:$,onPress:()=>S?J():m(),children:j.assignSpecificFund}),t.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:q,children:j.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),l&&t.jsx(nd,{funds:n,labels:j,selectedFundIds:e.map(W=>W.fund?.id).filter(Boolean),portalContainer:N,onSelect:Q,onClose:x}),t.jsx(Lt,{isOpen:I,labels:{title:j.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:j.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:j.modifyAssignedFundsWarning})]}),cancel:j.modifyAssignedFundsCancel,confirm:j.modifyAssignedFundsConfirm},icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:N,shouldBlockScroll:!1,classNames:Qc,onClose:()=>T(!1),onConfirm:Z})]})}function td({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{className:"flex min-h-15 w-full 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 flex-1 items-center","gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(U,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(U,{type:"button",size:"lg",variant:"light",radius:"full",className:"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 w-48 flex-none items-center",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:Kc})}),e.length>1&&t.jsx(U,{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(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(R,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...rt,base:c.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function nd({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] 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 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(R,{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",children:[t.jsxs("div",{className:"grid 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",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",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[t.jsx("span",{children:u.glCode}),t.jsx("span",{children:u.accountName}),t.jsx(U,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function sd(){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 ad={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function rd({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:l}){const o={...ad,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Kt,{label:o.totalAmount,value:d.format(e)}),t.jsx(Kt,{label:o.remainingBalance,value:d.format(n)}),t.jsx(Kt,{label:o.amountReceived,value:d.format(s)})]})})}function Kt({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 id={monthly:1,quarterly:3,annual:12},lr=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},ld=(e,n)=>new Date(e,n+1,0).getDate(),od=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},cd=(e,n)=>{const{year:s,month:a,day:r}=lr(e),i=a-1+n,l=s+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,ld(l,o));return new Date(l,o,d)},dd=(e,n)=>{const{year:s,month:a,day:r}=lr(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function or(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,l=id[n.frequency];return Array.from({length:s},(o,d)=>{const u=n.frequency==="weekly"?dd(n.firstInstallmentDate,d*7):cd(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:od(u),amount:(r+(d===0?i:0))/100}})}function ud(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function fd(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const md={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",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 cannot exceed donation 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.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},hd=["weekly","monthly","quarterly","annual"],xd=Array.from({length:31},(e,n)=>n+1),pd=["numberOfInstallments","frequency","firstInstallmentDate"],gd={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Ls=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),cr=e=>Math.round(e*100)/100,bd=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},It=e=>{if(!e)return null;try{return fo(e)}catch{return null}},yd=e=>It(e)?.day??1,vd=(e,n)=>new Date(e,n,0).getDate(),jd=(e,n)=>{const s=It(e);if(!s)return e;const a=Math.min(n,vd(s.year,s.month));return s.set({day:a}).toString()},Is=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 wd({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=pd,startDate:x,firstInstallmentDateOverride:h,labels:b,classNames:y,isSaving:v=!1,isModeSwitchDisabled:N=!1,onModeChange:j,onAutomaticSettingsChange:C,onInstallmentsChange:w,onSave:S}){const[E,A]=p.useState(null),[L,M]=p.useState(l),_={...md,...b},D=e??L,$=p.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),I=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,m,x]),T=D==="automatic"?fd(or(n,I),m.includes("firstInstallmentDate")?void 0:h):r,K=p.useMemo(()=>cr(T.reduce((de,ve)=>de+Number(ve.amount||0),0)),[T]),H=D==="manual"&&K-n>.009,[B,X]=p.useState(!1),J=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:_.title})]}):void 0,ae=de=>{de!==D&&(e||M(de),j?.(de),de==="manual"&&r.length===0&&w([Ls()]))},q=(de,ve)=>{r.find(Se=>Se.id===de)?.status!=="paid"&&w(r.map(Se=>Se.id===de?{...Se,...ve}:Se))},Z=()=>{w([...r,Ls()])},Q=de=>{r.find(be=>be.id===de)?.status!=="paid"&&w(r.filter(be=>be.id!==de))},W=()=>{if(!v){if(H){X(!0);return}S?.()}},ee=()=>{X(!1),S?.()},ce=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Nd,{mode:D,labels:_,onModeChange:ae,isDisabled:N,className:y?.tabs}):null,u?t.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:v?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:v,onPress:W,children:_.saveInstallments}):null]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[D==="automatic"&&t.jsx(Cd,{settings:I,inputs:m,labels:_,className:y?.controls,onSettingsChange:C}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:D==="automatic"?_.emptyAutomatic:_.emptyManual}),T.length>0&&t.jsx(kd,{mode:D,installments:T,labels:_,formatter:$,locale:a,onUpdateInstallment:q,onRemoveInstallment:Q}),D==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(U,{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}),onPress:Z,children:_.addInstallment})}),t.jsx(Ad,{total:K,donationAmount:n,hasTotalIncreaseWarning:H,mode:D,installments:T,formatter:$,labels:_,className:y?.summary})]})]});return t.jsxs("div",{ref:A,className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:[d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:J,children:ce},"installment-schedule")}):ce,t.jsx(Lt,{isOpen:B,labels:{title:_.totalIncreaseConfirmationTitle,description:_.totalIncreaseConfirmationDescription,cancel:_.totalIncreaseConfirmationCancel,confirm:_.totalIncreaseConfirmationConfirm},icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:v,portalContainer:E??void 0,shouldBlockScroll:!1,classNames:gd,onClose:()=>X(!1),onConfirm:ee})]})}function Nd({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Cd({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Me,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:hd.map(o=>t.jsx(c.SelectItem,{textValue:s[o],children:s[o]},o))})},l);if(l==="dayOfMonth"){const o=String(yd(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Me,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:jd(e.firstInstallmentDate,u)})},children:xd.map(d=>t.jsx(c.SelectItem,{textValue:Is(d),children:Is(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(En,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:It(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(R,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function kd({mode:e,installments:n,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:l}){const o=ud(n),d=new Set(n.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));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((u,f)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===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:["#",f+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:bd(u.dueDate,r)}),f===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:a.format(u.amount)})]},u.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,f)=>{const m=o.has(u.id),x=d.has(u.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:f+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(En,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:m,errorMessage:m?s.dateOrderError:void 0,value:It(u.dueDate),onChange:h=>i(u.id,{dueDate:h?h.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:x,errorMessage:x?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:h=>i(u.id,{amount:cr(Number(h.target.value||0))}),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}),t.jsx(Sd,{isDisabled:n.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>l(u.id)})]})},u.id)})})}function Sd({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(U,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:a,"aria-label":s,children:t.jsx(R,{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 Ad({total:e,donationAmount:n,hasTotalIncreaseWarning:s,mode:a,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),x=Math.max(n-e,0),h=s?t.jsx("span",{children:l.totalIncreaseWarning}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:s?`New total: ${i.format(e)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"warning":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:h})}function $d(){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 Ts={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",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"},dr={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Dd={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",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."},Ed={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Fd=[];function Md({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Fd,labels:d,isSaving:u=!1,onEditInstallments:f,onPayInstallment:m,onDeleteInstallment:x}){const[h,b]=p.useState(null),y={...Dd,...d},[v,N]=p.useState(""),j=new Intl.NumberFormat(s,{style:"currency",currency:n}),C=a?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:y.title})]}):void 0,w=p.useMemo(()=>{const E=v.trim().toLowerCase();return E?e.filter(A=>{const L=A.status??"scheduled";return[A.id,A.amount,A.dueDate,Qt(A.dueDate,s),L,dr[L]??L].join(" ").toLowerCase().includes(E)}):e},[s,e,v]),S=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:y.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:v,placeholder:y.searchPlaceholder,onChange:E=>N(E.target.value),startContent:t.jsx(R,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(U,{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(R,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:y.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",w.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[w.map((E,A)=>{const L=E.status??"scheduled";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:["#",A+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${A+1}`})]}),t.jsx(_s,{status:L})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:j.format(E.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Qt(E.dueDate,s)})]})]}),t.jsx(Ps,{status:L,installment:E,labels:y,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:x})]})},E.id)}),w.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:y.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",w.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[w.map((E,A)=>{const L=E.status??"scheduled";return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:A+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${A+1}`})}),t.jsx("td",{className:"px-2 py-3",children:j.format(E.amount)}),t.jsx("td",{className:"px-2 py-3",children:Qt(E.dueDate,s)}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(_s,{status:L})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Ps,{status:L,installment:E,labels:y,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:x})})]},E.id)}),w.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:b,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":y.title,title:C,children:S},"installment-table")}):S})}function _s({status:e}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Ts[e]??Ts.scheduled),startContent:t.jsx(Id,{status:e}),children:dr[e]??e})}function Ps({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(U,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(R,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:s.payNow}):null,t.jsx(Ld,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>o(n.id)})]})}function Ld({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,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(U,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(R,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(R,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Lt,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(R,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Ed,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Id({status:e}){return e==="paid"?t.jsx(R,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(R,{icon:"solar:close-circle-bold",className:"size-3"}):e==="processing"?t.jsx(R,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(R,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(R,{icon:"solar:calendar-outline",className:"size-3"})}function Qt(e,n){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Td={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},_d=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const x=Array.isArray(e)?e:[],[h,b]=p.useState(o),[y,v]=p.useState(l),N={...Td,...r};p.useEffect(()=>{b(o)},[o]);const j=w=>{if(w===h){d&&f?.(w);return}b(w),f?.(w)},C=w=>{v(w),u?.(w)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:h??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:N.title}),i&&t.jsx(hr,{title:N.renewalTitle,description:N.renewalDescription,value:y,onValueChange:C}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:x.map(w=>t.jsx(ur,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:n,currency:s,isSelected:h===w.id,onSelect:j},w.id))})]})},ur=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:x,statusTone:h="default",className:b=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),v=!!d&&!f,N=m||x,j=()=>{v&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:j,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),N&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:h,size:"sm",variant:"flat",className:"px-2",children:N})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},Os="w-full bg-gray-100",Rs={variant:"light",color:"default"},fr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:x=!1,isDisabled:h=!1,compact:b=!1,className:y="",bodyClassName:v="",footerClassName:N="",dataTestId:j})=>{const C=!!(d&&d.value),w=!!u?.label,S=x&&!!m&&!w,E=!S,A=w?{variant:u?.variant??Rs.variant,color:u?.color??Rs.color,size:u?.size??"sm",isDisabled:h||u?.isDisabled,startContent:u?.icon?t.jsx(R,{icon:u.icon,width:16}):void 0}:null,L=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Os,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Os,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(R,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":j||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:S,onPress:m,isDisabled:h,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",v),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((M,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(R,{icon:M.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:M.label})]},`${M.label}-${_}`))}):null,(C||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",N),children:[C?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}),w&&E?t.jsx(U,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:A?.variant,color:A?.color,size:A?.size,startContent:A?.startContent,isDisabled:A?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};fr.displayName="CatalogItemCard";const Pd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Od={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Rd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},zd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Bd={card:"mt-1",panel:"mt-[22px]"},Vd="bg-acct-page border-acct-border text-acct-muted",Ud={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Hd={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"},qd={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"},Wd={empty:"status",error:"alert",success:"status",loading:"status"},Yd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Gd(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(p.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:Ud[e];return r?t.jsx(R,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:l,role:o=Wd[e],ariaLive:d=Yd[e],iconSize:u=24,className:f,classNames:m={},"data-testid":x="feedback-state"}){const h=Gd(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Pd[n],n==="card"?Hd[e]:"bg-transparent",f,m.base),children:[h?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",Od[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Vd:qd[e],m.iconWrapper),children:h}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${x}-title`,className:c.cn(Rd[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(zd[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Bd[n],m.actions),children:l}):null]})}function Rn(e){return t.jsx(et,{...e,variant:"empty"})}function zn(e){return t.jsx(et,{...e,variant:"error"})}function Bn(e){return t.jsx(et,{...e,variant:"loading"})}function mr(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Rn.displayName="EmptyState";zn.displayName="ErrorState";Bn.displayName="LoadingState";mr.displayName="SuccessState";const hr=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Kd={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"},Qd=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),xr=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),Zd=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Vn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),zs=(e,n,s)=>{const a={};let r=s?n??Zd(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Vn(e)){a[i.id]??={},a[i.id][l.id]??={};const d=s?Math.min(o.max,r):0;a[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return a},Bs=(e,n,s)=>`${e}::${n}::${s}`,Xd=(e,n,s)=>{const a=xr(n);for(const{exhibition:r,dateGroup:i,ticket:l}of Vn(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=s===void 0?l.max:Math.min(l.max,s-(a-o));if(d>0&&o<d)return!1}return!0},Jd=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=s||a?.(i+1)},x=()=>{r||i<=n||a?.(i-1)},h=w=>{if(r)return;o(w.target.value);const S=parseInt(w.target.value,10);isNaN(S)||a?.(Math.max(n,Math.min(s,S)))},b=w=>{const S=parseInt(w.target.value,10);if(u(!1),isNaN(S)){a?.(n);return}const E=Math.max(n,Math.min(s,S));E!==S?a?.(E):o(String(E))},y=i<=n,v=i>=s,N="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",j="bg-primary hover:bg-primary/80",C="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:x,disabled:r||y,className:c.cn(N,r||y?C:j),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:h,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||v,className:c.cn(N,r||v?C:j),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},eu=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},tu=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Qd(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(Jd,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},nu=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(tu,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),su=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=n.dates.reduce((h,b)=>h+b.tickets.reduce((y,v)=>y+a(n.id,b.id,v.id),0),0),x=n.dates.some(h=>h.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(R,{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:x?n.dates.map((h,b)=>t.jsx(nu,{exhibitionId:n.id,dateGroup:h,isLast:b===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},h.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})})})})]})},au=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...Kd,...s},[u,f]=p.useState(()=>zs(o,n,!0)),m=p.useRef(!1),x=p.useMemo(()=>{const j=Vn(o).map(({exhibition:C,dateGroup:w,ticket:S})=>[Bs(C.id,w.id,S.id),S]);return new Map(j)},[o]),h=Xd(o,u,n),b=(j,C,w)=>u[j]?.[C]?.[w]?.selectedQuantity??0,y=()=>xr(u),v=(j,C,w,S)=>{const E=b(j,C,w),A=y()-E;if(n!==void 0&&A+S>n)return;const L=x.get(Bs(j,C,w));if(!L)return;const M={...u,[j]:{...u[j],[C]:{...u[j]?.[C],[w]:{id:w,selectedQuantity:S,originalPrice:L.originalPrice,discountedPrice:L.price}}}};f(M),l?.(M)},N=j=>{const C=zs(o,n,j);f(C),l?.(C)};return p.useEffect(()=>{!m.current&&h&&(l?.(u),m.current=!0)},[h,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(eu,{label:d.selectAllButtonLabel,checked:h,onChange:N})]}),o.map(j=>t.jsx(su,{title:j.exhibitionName,exhibition:j,onQuantityChange:v,getTicketQuantity:b,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},j.id))]})},Zt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Xt=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},ru=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},iu=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,pr=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:x,countAriaLabel:h,countDisplay:b="badge",confirmLabel:y=Zt.confirm,clearLabel:v=Zt.clear,isOpen:N,defaultOpen:j=!1,onOpenChange:C,isDisabled:w=!1,closeOnConfirm:S=!0,keepOpenAfterClear:E=!1})=>{const[A,L]=p.useState(j),[M,_]=p.useState(()=>Xt(u)),D=N??A,$=x??u.filter(q=>iu(q)).length,I=q=>{q&&_(Xt(u)),N||L(q),C?.(q)},T=(q,Z)=>{_(Q=>({...Q,[q.id]:Z}))},K=(q,Z)=>{_(Q=>({...Q,[q.id]:Z?[Z]:[]}))},H=async()=>{_(Xt(u.map(q=>q.type==="checkbox"?{...q,selectedValues:[]}:{...q,selectedValue:null}))),await m(),E||I(!1)},B=async()=>{const q=ru(M,u);await f(q),S&&I(!1)},X=q=>{if(q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:q.label,value:M[q.id]??[],onValueChange:Q=>T(q,Q),children:q.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},q.id);const Z=M[q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:q.label,value:Z,onValueChange:Q=>K(q,Q||null),children:q.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},q.id)},J=p.useMemo(()=>$>0?h?.($)||`${$} filters applied`:void 0,[h,$]),ae=p.useMemo(()=>$===0?e||Zt.noLabel:h?h($):`${e} (${$})`,[$,e,h]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:D,onOpenChange:I,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(U,{isDisabled:w,variant:a,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":D,children:[t.jsx(R,{icon:s,width:16}),t.jsx("span",{children:e}),b==="badge"&&$>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":J,children:$}):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(q=>X(q)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(U,{variant:"light",color:"default",size:"sm",onPress:H,children:v}),t.jsx(U,{color:"primary",size:"sm",onPress:B,children:y})]})]})})]})})};pr.displayName="FilterPopover";const lu="No sessions available for this date",ou=e=>e==="sold-out"||e==="closed"?"danger":"success",cu=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"},Vs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",du=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,gr=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=lu,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:x,calendarSlot:h,dayGroupAriaLabel:b,sessionGridAriaLabel:y,className:v,headingClassName:N,subheadingClassName:j})=>{const C=du(s,a),w=s.find(M=>M.date===C),S=i??s.map(M=>({date:M.date,label:M.label})),E=w?.sessions??[],A=M=>M===C?"solid":"bordered",L=M=>{if(!Vs(M)){if(M.id===l){o(null);return}o(M.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",v),"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",N),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",j),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[S.map(M=>t.jsx(U,{size:"sm",variant:A(M.date),color:"default",className:c.cn("rounded-full",x),isDisabled:M.isDisabled,onPress:()=>{r(M.date)},children:t.jsx("span",{children:M.label})},M.date)),h?t.jsx("div",{children:h}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[E.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,E.map(M=>{const _=Vs(M),D=M.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{L(M)},"aria-disabled":_,"aria-pressed":_?void 0:D,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",D?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(M,{isSelected:D,isUnavailable:_}):_?`${M.startTime} ${M.endTime} sold out`:`${M.startTime} ${M.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:[M.startTime," – ",M.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(M):ou(M.status),variant:"flat",children:u?u(M):cu(M)})]})})},M.id)})]})]})};gr.displayName="SessionTimeline";const uu=(e,n)=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,br=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header"})=>{const f=uu(a,r);return t.jsxs("header",{"data-testid":u,className:c.cn("flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn("text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn("mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn("flex flex-wrap items-center gap-2",d.actions),children:i}):null]})};br.displayName="PageHeader";const fu={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},mu={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"}},yr=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(s==="dot"){const d=mu[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:d.fg,backgroundColor:d.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}return t.jsx(c.Chip,{color:r??fu[e],variant:s,size:a,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),children:n})};yr.displayName="StatusChip";const hu={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"},Un=({label:e,value:n,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>t.jsxs("span",{"data-testid":r,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",hu[s],a),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Un.displayName="KeyValueChip";const vr=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:l={},"data-testid":o="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":o,className:c.cn("w-full",i,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((d,u)=>t.jsx("div",{"data-testid":`${o}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((f,m)=>{const x=m===e.length-1;return t.jsx("div",{className:c.cn(f==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:f==="fill"?"60%":f}})},m)})},u))})]});vr.displayName="TableSkeleton";const jr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",wr="px-4 text-[13.5px] text-acct-ink2 align-middle",Nr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Cr="w-full",kr="border-t border-acct-border px-5 py-3.5",Sr=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:l={},"data-testid":o="admin-table"})=>t.jsxs("div",{className:c.cn(i,l.base),"data-testid":o,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Cr,l.table),th:c.cn(jr,l.th),tr:c.cn(Nr,l.tr),td:c.cn(wr,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:d=>t.jsx(c.TableColumn,{align:d.align==="right"?"end":"start",width:d.width,children:d.label},d.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${o}-footer`,className:c.cn(kr,l.footer),children:a}):null]});Sr.displayName="AdminTable";const xu={md:"w-[280px]",lg:"w-[360px]"},Ar=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>t.jsxs("div",{role:"search","data-testid":u,className:c.cn("flex flex-wrap items-center gap-3 mb-4",d),children:[t.jsx(c.Input,{type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:xu[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]});Ar.displayName="AdminToolbar";const pu="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",gu="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",$r=p.forwardRef(function({icon:n,children:s,count:a,className:r,testId:i,...l},o){return t.jsxs(U,{ref:o,"data-testid":i,variant:"light",size:"sm",className:c.cn(gu,r),...l,children:[t.jsx(R,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:pu,children:a})]})});$r.displayName="ToolbarButton";function Dr({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:l=>s(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Dr.displayName="UnderlineTabs";const Hn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",qn="font-normal normal-case tracking-normal",Er=["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(" "),Fr="text-[13.5px] text-acct-ink",Mr="bg-acct-page text-acct-muted cursor-default",Lr="mt-[5px] text-xs text-acct-sub",Ir="mt-[5px] text-xs text-acct-danger",Tr=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Hn,s),children:[e,n?t.jsxs("span",{className:qn,children:[" ",n]}):null]});Tr.displayName="AdminFieldLabel";const _r=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":x="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:qn,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":x,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Hn,inputWrapper:Er,input:c.cn(Fr,(o||l)&&"font-mono",l&&Mr),description:Lr,errorMessage:Ir}});_r.displayName="AdminTextField";const bu={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Pr=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",bu[n]),children:r.icon},r.key))});Pr.displayName="RowActions";const Or=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(U,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&a?t.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Or.displayName="PickerRow";function Rr(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const zr=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=Rr(e,n,s),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:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};zr.displayName="PaginationSummary";const Br=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:x,emptyIcon:h,emptyActions:b,emptyContent:y,children:v,className:N,classNames:j={},"data-testid":C="list-panel"})=>{const w={base:c.cn("border-0 bg-transparent py-12",j.state)};let S;return e?S=r??t.jsx(Bn,{title:a,classNames:w,"data-testid":`${C}-loading`}):n?S=f??t.jsx(zn,{title:i,description:l,classNames:w,"data-testid":`${C}-error`,actions:u??(d?t.jsx(U,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):s?S=y??t.jsx(Rn,{title:m,description:x,icon:h,actions:b,classNames:w,"data-testid":`${C}-empty`}):S=v,t.jsx("section",{"data-testid":C,className:c.cn("rounded-xl bg-white p-2 shadow-sm",N,j.base),children:S})};Br.displayName="ListPanel";const yu=350,vu={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}"},Jt=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),ju=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...vu,...i},x=Ft(e.currency,r),h=n!==void 0,[b,y]=p.useState(s??null),v=h?n:b,N=p.useMemo(()=>{const I=typeof v=="number"&&Number.isFinite(v)?v:0,T=dn(I,e.value,e.currency,r);return{received:I,change:T>0?T:0,isValid:I>=e.value&&I>0}},[v,e.value,e.currency,r]),j=p.useCallback(I=>{const T=I.currentTarget;requestAnimationFrame(()=>{T.isConnected&&T.select()})},[]),C=p.useCallback(I=>{if(l)return;const T=I.replace(/[^\d.,]/g,"").replace(",","."),K=T===""?null:Number.parseFloat(T),H=K===null||Number.isNaN(K)?null:K;if(H!==null&&o!==void 0&&H>o)return;h||y(H);const B=typeof H=="number"&&Number.isFinite(H)?H:0,X=dn(B,e.value,e.currency,r);a?.({received:B,change:X>0?X:0,isValid:B>=e.value&&B>0})},[h,l,e.value,e.currency,r,a,o]),w=v==null?"":String(v),S=N.isValid&&N.change>0,E=!N.isValid&&N.received>0,A=xe(N.change,r,e.currency),L=xe(e.value,r,e.currency),[M,_]=p.useState(""),D=p.useRef(null);p.useEffect(()=>{D.current&&clearTimeout(D.current);const I=S?Jt(m.changeMessageTemplate,{change:A}):"",T=S?yu:0;return D.current=setTimeout(()=>_(I),T),()=>{D.current&&clearTimeout(D.current)}},[S,A,m.changeMessageTemplate]);const $=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:$,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:x===0?"numeric":"decimal",pattern:x===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:I=>C(I.target.value),onFocus:j,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:E,errorMessage:E?Jt(m.insufficientMessageTemplate,{due:L}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),S&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:Jt(m.changeMessageTemplate,{change:A}),icon:t.jsx(R,{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:M})]})},wu={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Us=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Vr=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":x="check-tender-form"})=>{const h={...wu,...r},b=n!==void 0,[y,v]=p.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Us()}),[N,j]=p.useState(!!s?.checkNumber),C=p.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Us()}:y,[b,n,y]),w=p.useCallback(D=>{b||v(D);const $=D.checkNumber.trim(),I={amount:e.value,checkNumber:$,bankName:D.bankName.trim()||void 0,date:i?void 0:D.date,isValid:$.length>0&&e.value>0};a?.(I)},[b,e.value,i,a]),S=p.useCallback(D=>$=>{o||(D==="checkNumber"&&$.length>0&&j(!0),w({...C,[D]:$}))},[C,w,o]),E=p.useCallback(()=>{o||j(!0)},[o]),A=N&&C.checkNumber.trim()==="",L=`${x}-check-number`,M=`${x}-bank-name`,_=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":x,children:[t.jsx(c.Input,{id:L,label:h.checkNumberLabel,labelPlacement:"outside",type:"text",value:C.checkNumber,onChange:D=>S("checkNumber")(D.target.value),onBlur:E,placeholder:h.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:A,errorMessage:A?h.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${x}-check-number-input`}),!l&&t.jsx(c.Input,{id:M,label:h.bankNameLabel,labelPlacement:"outside",type:"text",value:C.bankName,onChange:D=>S("bankName")(D.target.value),placeholder:h.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:h.dateLabel,labelPlacement:"outside",type:"date",value:C.date,onChange:D=>S("date")(D.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};Vr.displayName="CheckTenderForm";const Nu={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Cu=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Ur=({dueAmount:e,methodOptions:n=Cu,value:s,defaultValue:a,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Nu,...i},m=s!==void 0,[x,h]=p.useState({method:a?.method??"",reference:a?.reference??""}),b=p.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:x,[m,s,x]),y=p.useCallback(S=>n.find(E=>E.value===S)?.label??"",[n]),v=p.useCallback(S=>{m||h(S);const E=y(S.method),A={amount:e.value,method:S.method,description:E,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(A)},[m,e.value,r,y]),N=p.useCallback(S=>{if(o)return;const E=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";v({...b,method:E})},[b,v,o]),j=p.useCallback(S=>{o||v({...b,reference:S})},[b,v,o]),C=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Me,{id:C,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:N,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),l&&t.jsx(c.Input,{id:w,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:S=>j(S.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Ur.displayName="OtherTenderForm";const ku={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Su={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Au={pending:"warning",recorded:"success",failed:"danger"},$u=e=>e==="pending"||e==="recorded",Du=e=>`#${e+1}`,Hr=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:l,"data-testid":o="split-payment-summary"})=>{const d={...ku,...r},{collected:u,remaining:f,isComplete:m}=p.useMemo(()=>{const h=n.reduce((y,v)=>$u(v.status)?y+v.amount:y,0),b=Math.max(e.value-h,0);return{collected:h,remaining:b,isComplete:h>=e.value&&e.value>0}},[n,e.value]),x=h=>h==="pending"?d.statusPending:h==="recorded"?d.statusRecorded:d.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":o,children:[t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${o}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:m?d.completeLabel:d.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${o}-remaining-amount`,children:xe(m?u:f,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${o}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:d.collectedHeading}),n.map((h,b)=>t.jsx(Eu,{index:b,tender:h,locale:a,currency:e.currency,removable:!!s&&h.status!=="recorded",onRemove:s?()=>s(h.id):void 0,statusLabel:x(h.status),removeAriaLabel:d.removeAriaLabel,recordedTooltip:d.removeTooltipForRecorded,dataTestId:`${o}-row-${b}`},h.id))]})]})};Hr.displayName="SplitPaymentSummary";const Eu=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(U,{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(R,{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:Du(e)}),t.jsx(R,{icon:Su[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Au[n.status],startContent:n.status==="recorded"?t.jsx(R,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(R,{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})}))]})},Fu=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(H,{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 Go({editor:e,isDisabled:n=!1}){const[s,a]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=h=>{if(h){const{from:b,to:w}=e.state.selection,y=e.isActive("link");let j="";if(y){const C=e.schema.marks.link,v=e.state.doc.resolve(b),k=ts.getMarkRange(v,C);k&&(j=e.state.doc.textBetween(k.from,k.to,""))}else j=e.state.doc.textBetween(b,w,"");const N=e.getAttributes("link").href||"";i(j),o(N),u(y)}a(h)},x=()=>{if(l.trim()){const{from:h,to:b}=e.state.selection,w=e.schema.marks.link,y=e.state.doc.resolve(h),j=ts.getMarkRange(y,w),N=j?.from??h,C=j?.to??b,v=e.state.doc.textBetween(N,C,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:C}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(H,{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:h=>i(h.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:h=>o(h.target.value),onKeyDown:h=>h.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(H,{size:"sm",color:"primary",onPress:x,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function Ko({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function Ia(e,n){const s=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>ut(o)))).forEach(o=>{const d=Te[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=p.useState(s);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>ut(d)))).forEach(d=>{const u=Te[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function _a(e,n){const s=p.useCallback((l,o)=>{if(!e)return;const d=Te[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),a=p.useCallback(l=>{s(l)},[s]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Te[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=Te[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Qo(e=ye.default){const[n,s]=p.useState(e),a=p.useCallback((o=ye.step)=>{s(d=>Math.min(ye.max,d+o))},[]),r=p.useCallback((o=ye.step)=>{s(d=>Math.max(ye.min,d-o))},[]),i=p.useCallback(()=>{s(ye.default)},[]),l=p.useCallback(o=>{const d=Math.max(ye.min,Math.min(ye.max,o));s(d)},[]);return{zoom:n,setZoom:l,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ye.min,isMaxZoom:n>=ye.max,isDefaultZoom:n===ye.default}}const Zo=["bold","italic","strike","underline","code"];function Xo({editor:e,modifiers:n,onToolbarAction:s}){const a=Ia(e,n),{toggleModifier:r}=_a(e,s);if(!e)return null;const i=n.map(l=>ut(l)).filter(l=>Zo.includes(l));return i.length===0?null:t.jsx(Ko,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=a[l],d=Qe(l);return t.jsx(qe,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function Jo({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:l}){const o=Ia(e,n),{toggleModifier:d,executeCommand:u}=_a(e,l);if(!e)return null;const f=n.map($=>ut($)),m=f.some($=>["bold","italic","strike","underline","code"].includes($)),x=f.some($=>["textColor","highlight"].includes($)),h=f.includes("heading"),b=f.includes("textAlign"),w=f.some($=>["bulletList","orderedList","taskList"].includes($)),y=f.includes("blockquote"),j=f.includes("codeBlock"),N=f.includes("link"),C=f.includes("horizontalRule"),v=f.some($=>["undo","redo"].includes($)),k=s!==void 0&&a!==void 0,L=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${L} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(Xo,{editor:e,modifiers:n,onToolbarAction:l}),(x||h||b||w||y||j||N||C||v||k)&&t.jsx(He,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(ws,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(ws,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(h||b||w||y||j||N||C||v||k)&&t.jsx(He,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx(Ro,{editor:e}),(b||w||y||j||N||C||v||k)&&t.jsx(He,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map($=>{const M=qo[$],A=e.isActive({textAlign:$});return t.jsx(qe,{icon:M,label:`Align ${$}`,isActive:A,onClick:()=>u("textAlign",{type:"textAlign",alignment:$})},$)})}),(w||y||j||N||C||v||k)&&t.jsx(He,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsx(zo,{editor:e,types:f.filter($=>["bulletList","orderedList","taskList"].includes($))}),(y||j||N||C||v||k)&&t.jsx(He,{})]}),(y||j||N||C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[y&&t.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),j&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(Go,{editor:e,isDisabled:o.link?.isDisabled}),C&&t.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||k)&&t.jsx(He,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),k&&t.jsx(He,{})]}),k&&t.jsx(Yo,{zoom:s,onZoomChange:$=>{a?.($),l?.({type:"zoom",modifier:`${$}%`})}})]})})}const st={bold:{category:"mark",extension:ki.Bold,priority:100},italic:{category:"mark",extension:Si.Italic,priority:100},strike:{category:"mark",extension:$i.Strike,priority:100},underline:{category:"mark",extension:Ai.Underline,priority:100},code:{category:"mark",extension:Di.Code,priority:100},textColor:{category:"mark",extension:Ei.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Fi.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Mi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ti.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:_i.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Pi.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Oi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Bi.CodeBlock,priority:100},blockquote:{category:"node",extension:Vi.Blockquote,priority:100},horizontalRule:{category:"node",extension:Ui.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Hi.HardBreak,priority:100},undo:{category:"extension",extension:ns.History,priority:50},redo:{category:"extension",extension:ns.History,priority:50},textAlign:{category:"extension",extension:qi.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}},ec=[Wi.Document,Yi.Text,Ii.Paragraph,Li.TextStyle.configure({HTMLAttributes:{}}),zi.ListItem.configure({HTMLAttributes:{}}),Ri.TaskItem.configure({nested:!0}),Gi.Dropcursor,Ki.Gapcursor];function tc(e){const n=[],s=new Set,a=new Set;ec.forEach(o=>{o&&(n.push(o),a.add(o.name))});const r=e.map(o=>ut(o)),i=new Set;return r.forEach(o=>{const d=st[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),r.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){s.add(o);return}const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),n.sort((o,d)=>{const u=Object.values(st).find(h=>h?.extension?.name===o.name),f=Object.values(st).find(h=>h?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Pa={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"]},nc={h1:`font-size: ${ce.fontSize["4xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${ce.fontSize["2xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${ce.fontSize.xl}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${ce.fontSize.lg}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${ce.fontSize.base}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${ce.fontSize.sm}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${ce.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,li:`display: list-item; margin: ${le.xs} 0;`,strong:`font-weight: ${ce.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${be.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ce.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ce.fontFamily.mono};`,pre:`background: ${be.neutral.gray[800]}; border-radius: ${le.sm}; color: ${be.neutral.gray[100]}; font-family: ${ce.fontFamily.mono}; margin: ${le.lg} 0; padding: 0.75rem ${le.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${be.neutral.gray[300]}; margin: ${le.lg} 0; padding-left: ${le.md}; color: ${be.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${be.neutral.gray[200]}; margin: ${le.xl} 0;`,a:`color: ${be.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${be.palettes.warning[200]}; border-radius: ${le.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${le.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},sc={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 ac(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(sc)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${l} style="${a}">`)}for(const[s,a]of Object.entries(nc)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${a}"${i.slice(l)}`}})}return n}const rc=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=yn.useCurrentEditor();return t.jsx(Jo,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},ic=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=yn.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},un=p.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=Pa.full,variant:u="bordered",initialContent:f,content:m,onContentChange:x,onUpdate:h,onToolbarAction:b,isReadOnly:w=!1,isDisabled:y=!1,includeInlineStyles:j=!0,...N}=e,{zoom:C,setZoom:v}=Qo(),k=js.lineHeight,L=s*k,$=r?void 0:a*k,M=p.useMemo(()=>tc(d),[d]),{Component:A,label:I,shouldLabelBeOutside:F,getBaseProps:D,getLabelProps:T,getInputWrapperProps:_}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),G=I?t.jsx("label",{...T(),children:I}):null,U=p.useCallback(({editor:B})=>{const X=B.getHTML(),ee=j?ac(X):X,ae=B.getJSON(),q=B.getText(),Q=q.length,W=q.split(/\s+/).filter(re=>re.length>0).length,J={html:ee,json:ae,text:q,characters:Q,words:W};if(x?.(J),h?.(J),"onChange"in N&&typeof N.onChange=="function"){const re={target:{value:ee},currentTarget:{value:ee}};N.onChange(re)}},[x,h,N,j]);return t.jsxs(A,{...D(),children:[F?G:null,t.jsx("div",{..._(),className:c.cn(_().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:$?`${$+js.toolbarHeight}px`:void 0,overflow:$?"auto":void 0},children:t.jsx(yn.EditorProvider,{editable:!w&&!y,slotBefore:o?t.jsx(rc,{modifiers:d,zoom:C,onZoomChange:v,onToolbarAction:b}):void 0,slotAfter:t.jsx(ic,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${L}px`,fontSize:`${C}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:M,content:m||f||e.defaultValue||"",onUpdate:U})})]})});un.displayName="TipTapEditor";const Oa=p.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(un,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(un,{...r,variant:a,ref:n}))});Oa.displayName="RichTextArea";function lc(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const Ns=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],oc={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Ra=({presetAmounts:e=Ns,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:x=3,isDisabled:h=!1,buttonVariant:b="bordered",buttonColor:w="default",inputVariant:y="bordered",size:j="md",className:N="",showCard:C=!0})=>{const v={...oc,...f},k=Array.isArray(e)?e:Ns,L={2:"grid-cols-2",3:"grid-cols-3"},$={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${L[m]} ${$[x]}`,[A,I]=Et(n,s,a),[F,D]=p.useState(""),[T,_]=p.useState(!1),[G,U]=p.useState(0),B=p.useCallback(Q=>{if(h)return;const W={amount:Q.amount,isCustom:!1,presetId:Q.id};I(W),D(""),_(!1),U(J=>J+1),r?.(W)},[h,I,r]),X=p.useCallback(Q=>{if(h)return;if(D(Q!==void 0?String(Q):""),r){I(null);return}if(Q===void 0||isNaN(Q)){I(null);return}I({amount:Q,isCustom:!0})},[h,I,r]),ee=p.useCallback(()=>{if(h)return;const Q=F!==""?parseFloat(F):void 0;Q===void 0||isNaN(Q)||r?.({amount:Q,isCustom:!0})},[h,F,r]),ae=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),q=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}),k.length>0&&t.jsx("div",{className:c.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:k.map(Q=>{const W=A!==null&&!A.isCustom&&A.presetId===Q.id;return t.jsx(H,{color:W?"primary":w,variant:W?"solid":b,className:"w-full",onPress:()=>B(Q),isDisabled:h,"data-testid":`donation-amounts-preset-${Q.id}`,children:Q.label||lc(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?()=>{I(null),_(!0)}:void 0,variant:y,radius:"full",size:j,minValue:d,maxValue:u,step:.01,formatOptions:ae,value:F!==""?parseFloat(F):void 0,onValueChange:X,isDisabled:h,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-${G}`:A?.isCustom===!1?A.presetId:"custom"),r&&t.jsx(H,{color:"primary",variant:"solid",radius:"full",size:j,className:"shrink-0",onPress:ee,isDisabled:h||!T,"data-testid":"donation-amounts-add-button",children:v.addDonationButton})]})]});return C?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:q})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:q})};Ra.displayName="DonationAmounts";const cc=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},dc=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},uc=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"}},za=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=cc,className:x,...h},b)=>{const[w,y]=Et(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),j=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{j.current&&clearInterval(j.current)},[]),p.useEffect(()=>{if(!f||w<=0){j.current&&(clearInterval(j.current),j.current=null);return}return j.current=setInterval(()=>{y(L=>L<=1?(j.current&&(clearInterval(j.current),j.current=null),N.current||(N.current=!0,a?.()),0):L-1)},1e3),()=>{j.current&&(clearInterval(j.current),j.current=null)}},[f,w,y,a]),p.useEffect(()=>{w>0&&(N.current=!1)},[w]);const C=d||dc(r),v=uc(i),k={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(w)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,k[u],x),...h,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(C,{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(w)}`,"data-testid":"expire-cart-timer-value",children:m(w)})})]})})})});za.displayName="ExpireCartTimer";const qt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(R,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),fc=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[x,h]=p.useState(!1),[b,w]=p.useState(!1),y=p.useRef(null);return p.useEffect(()=>{const j=()=>{if(y.current){const N=y.current.scrollHeight>y.current.clientHeight;w(N)}};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[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&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(qt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(qt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(qt,{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:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!x&&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||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(H,{onPress:()=>h(!x),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:t.jsx(R,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function fn(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function mc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const hc={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"},Ge=e=>typeof e=="number"&&!isNaN(e),wt=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:x=!0,showPeopleCount:h=!0,showPrice:b=!0,priceDisplay:w,classNames:y={},"data-testid":j,selectedColor:N="default",compact:C=!1,isSoldOut:v,isMaxReached:k,isRuleBlocked:L,statusTone:$="default",statusLabel:M,disabledReason:A,disabled:I})=>{const F=p.useMemo(()=>({...hc,...l}),[l]),[D,T]=p.useState(s),_=n!==void 0?n:D,G=!!(d||I),U=C||!!e.compact,B=p.useMemo(()=>typeof v=="boolean"?v:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ge(e.totalTicketsSold)||!Ge(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[v,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),X=p.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:B||!Ge(e.ticketsAllowed)?!1:_>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,B,e.ticketsAllowed,e.totalTicketsSold,_]),ee=p.useMemo(()=>typeof L=="boolean"?L:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[L,e.isRuleBlocked]),ae=A||e.disabledReason,q=G||B||ee,Q=te=>{if(q||te>0&&X)return;const xe=Math.max(0,_+te);n===void 0&&T(xe),a?.(e.id,xe)},W=p.useMemo(()=>{if(B)return"soldOut";if(ee)return"ruleBlocked";if(G)return"disabled"},[B,ee,G]),J=p.useMemo(()=>$||(B||ee?"danger":X?"warning":"default"),[$,B,ee,X]),re=p.useMemo(()=>{if(W)return W==="ruleBlocked"?M||ae||F.ruleBlocked:W==="soldOut"?M||ae||F.soldOut:W==="disabled"?M||ae||F.disabled:M||F.maxReached},[W,M,ae,F]),Z={soldOut:"danger",ruleBlocked:J,disabled:"default",maxReached:"warning"},he={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},de=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",U&&"text-sm",y.name),children:e.name}),$e=()=>{if(!b)return null;const te=w?.price??e.price,xe=w?.originalPrice,Me=fn(te,i,r);if(o?.renderPrice)return o.renderPrice(te,Me,e);if(Ge(xe)&&Ge(te)&&xe>te){const ge=fn(xe,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",U&&"mt-0.5",y.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",ge,", discounted price ",Me]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",U&&"text-xs",y.originalPrice),children:ge}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",U&&"text-sm",y.discountedPrice),children:Me})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",U&&"text-sm mt-0.5",y.price),children:Me})},Be=()=>!x||!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",U&&"mb-2 text-xs text-gray-600",y.description),children:e.description}),Ie=()=>{if(!h||!Ge(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?F.person:F.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,te,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",U&&"mt-1 text-xs",y.peopleCount),children:[t.jsx(R,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},_e=()=>{const te=_===0||q,xe=X||q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:_,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:te,isIncrementDisabled:xe,isDisabled:q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",y.quantitySelector),children:[t.jsx(H,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:te,variant:u,color:_>0?N:f,radius:"full",isIconOnly:!0,size:U?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(R,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",U&&"text-sm"),children:_}),t.jsx(H,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:xe,variant:u,color:_>0?N:f,radius:"full",isIconOnly:!0,size:U?"md":"sm","aria-label":"Increase quantity",children:t.jsx(R,{icon:"gravity-ui:plus",width:16})})]})},Pe=(te,xe)=>o?.renderDisabledState?o.renderDisabledState(te,xe):te==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(xe):te==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(xe):t.jsx(c.Chip,{"data-testid":he[te],color:Z[te],variant:te==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&y.soldOut,te==="maxReached"&&y.maxReachedAlert,U&&"h-8"),startContent:t.jsx(R,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:xe})}),Ve=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",U?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",q||X?"opacity-50 pointer-events-none select-none":""),children:[de(),$e(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",U?"mb-1":"mb-2"),children:[Ie(),Be()]})]}),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",U&&"space-x-1 pb-1 md:p-1",y.compactFooter),children:W&&re?Pe(W,re):_e()})]}),Ee=X&&!B&&!ee&&!G?t.jsx(Ne.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",y.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Pe("maxReached",re||F.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",U&&y.compact,y.base),"data-testid":j||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",U?"pb-0.5":"",y.body),children:Ve}),t.jsx(Ne.AnimatePresence,{children:Ee&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",U?"pt-1":"",y.footer),children:Ee})})]}):t.jsxs("div",{className:c.cn("w-full",U&&y.compact,y.base),"data-testid":j||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",U?"pb-0.5":"",y.body),children:Ve}),t.jsx(Ne.AnimatePresence,{children:Ee&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",U?"pt-1":"",y.footer),children:Ee})})]})};wt.displayName="OfferCard";const Ba=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(R,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Ba.displayName="OfferCardEmpty";const xc={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Va=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...xc,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};Va.displayName="OfferCardError";const pc={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ua=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=pc[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ua.displayName="OfferCardSkeleton";const Ha={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},qa={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"}}},gc={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Wa=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:x="default",showCard:h=!0,animated:b=!0,gap:w=2,compact:y=!1,classNames:j={}})=>{const[N,C]=p.useState(a),v=s!==void 0?s:N,k=p.useCallback((F,D)=>{const T={...v,[F]:Math.max(0,D)};s===void 0&&C(T),r?.(T),i?.(F,T[F])},[v,s,r,i]),L=[...e].sort((F,D)=>(F.position??0)-(D.position??0)),$=F=>{const D=n?n(F):F,T=(v??{})[D.id]||0;return{offer:D,quantity:T,onQuantityChange:k,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:y}},M=gc[w],A=c.cn("grid mx-auto pt-2",M,j.base),I=F=>{const D=$(F);return t.jsx(wt,{offer:D.offer,quantity:D.quantity,onQuantityChange:D.onQuantityChange,currency:D.currency,locale:D.locale,labels:D.labels,slots:D.slots,isDisabled:D.isDisabled,buttonVariant:D.buttonVariant,buttonColor:D.buttonColor,showCard:D.showCard,compact:D.compact,classNames:j.card},D.offer.id)};return b?t.jsx(Ne.motion.div,{"data-testid":"offer-card-list",className:A,variants:Ha,initial:"hidden",animate:"show",children:t.jsx(Ne.AnimatePresence,{children:L.map(F=>{const D=$(F);return t.jsx(Ne.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:j.cardWrapper,variants:qa,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(wt,{offer:D.offer,quantity:D.quantity,onQuantityChange:k,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:y||D.offer.compact,classNames:j.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:A,children:L.map(I)})};Wa.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Ce=e=>e==null;const Ya=e=>typeof e=="object";var me=e=>!Ce(e)&&!Array.isArray(e)&&Ya(e)&&!We(e),Ga=e=>me(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,bc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ka=(e,n)=>e.has(bc(n)),yc=e=>{const n=e.constructor&&e.constructor.prototype;return me(n)&&n.hasOwnProperty("isPrototypeOf")},Fn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ue(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Fn&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(me(e)&&yc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=ue(e[r]));return a}var Mt=e=>/^\w*$/.test(e),oe=e=>e===void 0,Mn=e=>Array.isArray(e)?e.filter(Boolean):[],Ln=e=>Mn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,n,s)=>{if(!n||!me(e))return s;const a=(Mt(n)?[n]:Ln(n)).reduce((r,i)=>Ce(r)?r:r[i],e);return oe(a)||a===e?oe(e[n])?s:e[n]:a},ke=e=>typeof e=="boolean",we=e=>typeof e=="function",ie=(e,n,s)=>{let a=-1;const r=Mt(n)?[n]:Ln(n),i=r.length,l=i-1;for(;++a<i;){const o=r[a];let d=s;if(a!==l){const u=e[o];d=me(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const Nt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ae={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Le={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Qa=p.createContext(null);Qa.displayName="HookFormControlContext";const Tn=()=>p.useContext(Qa);var Za=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==Ae.all&&(n._proxyFormState[l]=!a||Ae.all),s&&(s[l]=!0),e[l]}});return r};const In=typeof window<"u"?p.useLayoutEffect:p.useEffect;function vc(e){const n=Tn(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[l,o]=p.useState(s._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return In(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&o({...s._formState,...u})}}),[r,a,i]),p.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),p.useMemo(()=>Za(l,s,d.current,!1),[l,s])}var Se=e=>typeof e=="string",mn=(e,n,s,a,r)=>Se(e)?(a&&n.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),z(s,i))):(a&&(n.watchAll=!0),s),hn=e=>Ce(e)||!Ya(e);function De(e,n,s=new WeakSet){if(hn(e)||hn(n))return Object.is(e,n);if(We(e)&&We(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(We(l)&&We(o)||me(l)&&me(o)||Array.isArray(l)&&Array.isArray(o)?!De(l,o,s):!Object.is(l,o))return!1}}return!0}function jc(e){const n=Tn(),{control:s=n,name:a,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(s),x=p.useRef(a);u.current=o;const[h,b]=p.useState(()=>{const v=s._getWatch(a,d.current);return u.current?u.current(v):v}),w=p.useCallback(v=>{const k=mn(a,s._names,v||s._formValues,!1,d.current);return u.current?u.current(k):k},[s._formValues,s._names,a]),y=p.useCallback(v=>{if(!i){const k=mn(a,s._names,v||s._formValues,!1,d.current);if(u.current){const L=u.current(k);De(L,f.current)||(b(L),f.current=L)}else b(k)}},[s._formValues,s._names,i,a]);In(()=>((m.current!==s||!De(x.current,a))&&(m.current=s,x.current=a,y()),s._subscribe({name:a,formState:{values:!0},exact:l,callback:v=>{y(v.values)}})),[s,l,a,y]),p.useEffect(()=>s._removeUnmounted());const j=m.current!==s,N=x.current,C=p.useMemo(()=>{if(i)return null;const v=!j&&!De(N,a);return j||v?w():null},[i,j,a,N,w]);return C!==null?C:h}function wc(e){const n=Tn(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Ka(r._names.array,s),u=p.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,l)),[r,s,l]),f=jc({control:r,name:s,defaultValue:u,exact:o}),m=vc({control:r,name:s,exact:o}),x=p.useRef(e),h=p.useRef(void 0),b=p.useRef(r.register(s,{...e.rules,value:f,...ke(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const w=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(m.validatingFields,s)},error:{enumerable:!0,get:()=>z(m.errors,s)}}),[m,s]),y=p.useCallback(v=>b.current.onChange({target:{value:Ga(v),name:s},type:Nt.CHANGE}),[s]),j=p.useCallback(()=>b.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Nt.BLUR}),[s,r._formValues]),N=p.useCallback(v=>{const k=z(r._fields,s);k&&k._f&&v&&(k._f.ref={focus:()=>we(v.focus)&&v.focus(),select:()=>we(v.select)&&v.select(),setCustomValidity:L=>we(v.setCustomValidity)&&v.setCustomValidity(L),reportValidity:()=>we(v.reportValidity)&&v.reportValidity()})},[r._fields,s]),C=p.useMemo(()=>({name:s,value:f,...ke(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:y,onBlur:j,ref:N}),[s,a,m.disabled,y,j,N,f]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,k=h.current;k&&k!==s&&!d&&r.unregister(k),r.register(s,{...x.current.rules,...ke(x.current.disabled)?{disabled:x.current.disabled}:{}});const L=($,M)=>{const A=z(r._fields,$);A&&A._f&&(A._f.mount=M)};if(L(s,!0),v){const $=ue(z(r._options.defaultValues,s,x.current.defaultValue));ie(r._defaultValues,s,$),oe(z(r._formValues,s))&&ie(r._formValues,s,$)}return!d&&r.register(s),h.current=s,()=>{(d?v&&!r._state.action:v)?r.unregister(s):L(s,!1)}},[s,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),p.useMemo(()=>({field:C,formState:m,fieldState:w}),[C,m,w])}const Nc=p.createContext(null);Nc.displayName="HookFormContext";var Cc=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},lt=e=>Array.isArray(e)?e:[e],Cs=()=>{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 Xa(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&me(r)&&i){const l=Xa(r,i);me(l)&&(s[a]=l)}else e[a]&&(s[a]=i)}return s}var je=e=>me(e)&&!Object.keys(e).length,_n=e=>e.type==="file",Ct=e=>{if(!Fn)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Ja=e=>e.type==="select-multiple",Pn=e=>e.type==="radio",kc=e=>Pn(e)||ft(e),Wt=e=>Ct(e)&&e.isConnected;function Sc(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=oe(e)?a++:e[n[a++]];return e}function $c(e){for(const n in e)if(e.hasOwnProperty(n)&&!oe(e[n]))return!1;return!0}function fe(e,n){const s=Array.isArray(n)?n:Mt(n)?[n]:Ln(n),a=s.length===1?e:Sc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(me(a)&&je(a)||Array.isArray(a)&&$c(a))&&fe(e,s.slice(0,-1)),e}var Ac=e=>{for(const n in e)if(we(e[n]))return!0;return!1};function er(e){return Array.isArray(e)||me(e)&&!Ac(e)}function xn(e,n={}){for(const s in e){const a=e[s];er(a)?(n[s]=Array.isArray(a)?[]:{},xn(a,n[s])):oe(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=xn(n));for(const a in e){const r=e[a];if(er(r))oe(n)||hn(s[a])?s[a]=xn(r,Array.isArray(r)?[]:{}):Ze(r,Ce(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!De(r,i)}}return s}const ks={value:!1,isValid:!1},Ss={value:!0,isValid:!0};var tr=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oe(e[0].attributes.value)?oe(e[0].value)||e[0].value===""?Ss:{value:e[0].value,isValid:!0}:Ss:ks}return ks},nr=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>oe(e)?e:n?e===""?NaN:e&&+e:s&&Se(e)?new Date(e):a?a(e):e;const $s={isValid:!1,value:null};var sr=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,$s):$s;function As(e){const n=e.ref;return _n(n)?n.files:Pn(n)?sr(e.refs).value:Ja(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?tr(e.refs).value:nr(oe(n.value)?e.ref.value:n.value,e)}var Dc=(e,n,s,a)=>{const r={};for(const i of e){const l=z(n,i);l&&ie(r,i,l._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},kt=e=>e instanceof RegExp,at=e=>oe(e)?e:kt(e)?e.source:me(e)?kt(e.value)?e.value.source:e.value:e,Ds=e=>({isOnSubmit:!e||e===Ae.onSubmit,isOnBlur:e===Ae.onBlur,isOnChange:e===Ae.onChange,isOnAll:e===Ae.all,isOnTouch:e===Ae.onTouched});const Es="AsyncFunction";var Ec=e=>!!e&&!!e.validate&&!!(we(e.validate)&&e.validate.constructor.name===Es||me(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===Es)),Fc=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Fs=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ot=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=z(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!a)return!0;if(l.ref&&n(l.ref,l.name)&&!a)return!0;if(ot(o,n))break}else if(me(o)&&ot(o,n))break}}};function Ms(e,n,s){const a=z(e,s);if(a||Mt(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),l=z(n,i),o=z(e,i);if(l&&!Array.isArray(l)&&s!==i)return{name:s};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:s}}var Mc=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return je(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!a||Ae.all))},Lc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Tc=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,Ic=(e,n)=>!Mn(z(e,n)).length&&fe(e,n),_c=(e,n,s)=>{const a=lt(z(e,s));return ie(a,"root",n[s]),ie(e,s,a),e};function Ls(e,n,s="validate"){if(Se(e)||Array.isArray(e)&&e.every(Se)||ke(e)&&!e)return{type:s,message:Se(e)?e:"",ref:n}}var Ke=e=>me(e)&&!kt(e)?e:{value:e,message:""},Ts=async(e,n,s,a,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:x,pattern:h,validate:b,name:w,valueAsNumber:y,mount:j}=e._f,N=z(s,w);if(!j||n.has(w))return{};const C=o?o[0]:l,v=D=>{r&&C.reportValidity&&(C.setCustomValidity(ke(D)?"":D||""),C.reportValidity())},k={},L=Pn(l),$=ft(l),M=L||$,A=(y||_n(l))&&oe(l.value)&&oe(N)||Ct(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,I=Cc.bind(null,w,a,k),F=(D,T,_,G=Le.maxLength,U=Le.minLength)=>{const B=D?T:_;k[w]={type:D?G:U,message:B,ref:l,...I(D?G:U,B)}};if(i?!Array.isArray(N)||!N.length:d&&(!M&&(A||Ce(N))||ke(N)&&!N||$&&!tr(o).isValid||L&&!sr(o).isValid)){const{value:D,message:T}=Se(d)?{value:!!d,message:d}:Ke(d);if(D&&(k[w]={type:Le.required,message:T,ref:C,...I(Le.required,T)},!a))return v(T),k}if(!A&&(!Ce(m)||!Ce(x))){let D,T;const _=Ke(x),G=Ke(m);if(!Ce(N)&&!isNaN(N)){const U=l.valueAsNumber||N&&+N;Ce(_.value)||(D=U>_.value),Ce(G.value)||(T=U<G.value)}else{const U=l.valueAsDate||new Date(N),B=ae=>new Date(new Date().toDateString()+" "+ae),X=l.type=="time",ee=l.type=="week";Se(_.value)&&N&&(D=X?B(N)>B(_.value):ee?N>_.value:U>new Date(_.value)),Se(G.value)&&N&&(T=X?B(N)<B(G.value):ee?N<G.value:U<new Date(G.value))}if((D||T)&&(F(!!D,_.message,G.message,Le.max,Le.min),!a))return v(k[w].message),k}if((u||f)&&!A&&(Se(N)||i&&Array.isArray(N))){const D=Ke(u),T=Ke(f),_=!Ce(D.value)&&N.length>+D.value,G=!Ce(T.value)&&N.length<+T.value;if((_||G)&&(F(_,D.message,T.message),!a))return v(k[w].message),k}if(h&&!A&&Se(N)){const{value:D,message:T}=Ke(h);if(kt(D)&&!N.match(D)&&(k[w]={type:Le.pattern,message:T,ref:l,...I(Le.pattern,T)},!a))return v(T),k}if(b){if(we(b)){const D=await b(N,s),T=Ls(D,C);if(T&&(k[w]={...T,...I(Le.validate,T.message)},!a))return v(T.message),k}else if(me(b)){let D={};for(const T in b){if(!je(D)&&!a)break;const _=Ls(await b[T](N,s),C,T);_&&(D={..._,...I(T,_.message)},v(_.message),a&&(k[w]=D))}if(!je(D)&&(k[w]={ref:C,...D},!a))return k}}return v(!0),k};const Pc={mode:Ae.onSubmit,reValidateMode:Ae.onChange,shouldFocusError:!0};function Oc(e={}){let n={...Pc,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:we(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=me(n.defaultValues)||me(n.values)?ue(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:ue(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 x={...m};const h={array:Cs(),state:Cs()},b=n.criteriaMode===Ae.all,w=g=>S=>{clearTimeout(u),u=setTimeout(g,S)},y=async g=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||x.isValid||g)){let S;n.resolver?(S=je((await M()).errors),j()):S=await I(a,!0),S!==s.isValid&&h.state.next({isValid:S})}},j=(g,S)=>{!n.disabled&&(m.isValidating||m.validatingFields||x.isValidating||x.validatingFields)&&((g||Array.from(o.mount)).forEach(E=>{E&&(S?ie(s.validatingFields,E,S):fe(s.validatingFields,E))}),h.state.next({validatingFields:s.validatingFields,isValidating:!je(s.validatingFields)}))},N=(g,S=[],E,V,O=!0,P=!0)=>{if(V&&E&&!n.disabled){if(l.action=!0,P&&Array.isArray(z(a,g))){const Y=E(z(a,g),V.argA,V.argB);O&&ie(a,g,Y)}if(P&&Array.isArray(z(s.errors,g))){const Y=E(z(s.errors,g),V.argA,V.argB);O&&ie(s.errors,g,Y),Ic(s.errors,g)}if((m.touchedFields||x.touchedFields)&&P&&Array.isArray(z(s.touchedFields,g))){const Y=E(z(s.touchedFields,g),V.argA,V.argB);O&&ie(s.touchedFields,g,Y)}(m.dirtyFields||x.dirtyFields)&&(s.dirtyFields=Ze(r,i)),h.state.next({name:g,isDirty:D(g,S),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else ie(i,g,S)},C=(g,S)=>{ie(s.errors,g,S),h.state.next({errors:s.errors})},v=g=>{s.errors=g,h.state.next({errors:s.errors,isValid:!1})},k=(g,S,E,V)=>{const O=z(a,g);if(O){const P=z(i,g,oe(E)?z(r,g):E);oe(P)||V&&V.defaultChecked||S?ie(i,g,S?P:As(O._f)):G(g,P),l.mount&&!l.action&&y()}},L=(g,S,E,V,O)=>{let P=!1,Y=!1;const ne={name:g};if(!n.disabled){if(!E||V){(m.isDirty||x.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=D(),P=Y!==ne.isDirty);const se=De(z(r,g),S);Y=!!z(s.dirtyFields,g),se?fe(s.dirtyFields,g):ie(s.dirtyFields,g,!0),ne.dirtyFields=s.dirtyFields,P=P||(m.dirtyFields||x.dirtyFields)&&Y!==!se}if(E){const se=z(s.touchedFields,g);se||(ie(s.touchedFields,g,E),ne.touchedFields=s.touchedFields,P=P||(m.touchedFields||x.touchedFields)&&se!==E)}P&&O&&h.state.next(ne)}return P?ne:{}},$=(g,S,E,V)=>{const O=z(s.errors,g),P=(m.isValid||x.isValid)&&ke(S)&&s.isValid!==S;if(n.delayError&&E?(d=w(()=>C(g,E)),d(n.delayError)):(clearTimeout(u),d=null,E?ie(s.errors,g,E):fe(s.errors,g)),(E?!De(O,E):O)||!je(V)||P){const Y={...V,...P&&ke(S)?{isValid:S}:{},errors:s.errors,name:g};s={...s,...Y},h.state.next(Y)}},M=async g=>(j(g,!0),await n.resolver(i,n.context,Dc(g||o.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),A=async g=>{const{errors:S}=await M(g);if(j(g),g)for(const E of g){const V=z(S,E);V?ie(s.errors,E,V):fe(s.errors,E)}else s.errors=S;return S},I=async(g,S,E={valid:!0})=>{for(const V in g){const O=g[V];if(O){const{_f:P,...Y}=O;if(P){const ne=o.array.has(P.name),se=O._f&&Ec(O._f);se&&m.validatingFields&&j([P.name],!0);const ve=await Ts(O,o.disabled,i,b,n.shouldUseNativeValidation&&!S,ne);if(se&&m.validatingFields&&j([P.name]),ve[P.name]&&(E.valid=!1,S||e.shouldUseNativeValidation))break;!S&&(z(ve,P.name)?ne?_c(s.errors,ve,P.name):ie(s.errors,P.name,ve[P.name]):fe(s.errors,P.name))}!je(Y)&&await I(Y,S,E)}}return E.valid},F=()=>{for(const g of o.unMount){const S=z(a,g);S&&(S._f.refs?S._f.refs.every(E=>!Wt(E)):!Wt(S._f.ref))&&de(g)}o.unMount=new Set},D=(g,S)=>!n.disabled&&(g&&S&&ie(i,g,S),!De(q(),r)),T=(g,S,E)=>mn(g,o,{...l.mount?i:oe(S)?r:Se(g)?{[g]:S}:S},E,S),_=g=>Mn(z(l.mount?i:r,g,n.shouldUnregister?z(r,g,[]):[])),G=(g,S,E={})=>{const V=z(a,g);let O=S;if(V){const P=V._f;P&&(!P.disabled&&ie(i,g,nr(S,P)),O=Ct(P.ref)&&Ce(S)?"":S,Ja(P.ref)?[...P.ref.options].forEach(Y=>Y.selected=O.includes(Y.value)):P.refs?ft(P.ref)?P.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(O)?Y.checked=!!O.find(ne=>ne===Y.value):Y.checked=O===Y.value||!!O)}):P.refs.forEach(Y=>Y.checked=Y.value===O):_n(P.ref)?P.ref.value="":(P.ref.value=O,P.ref.type||h.state.next({name:g,values:ue(i)})))}(E.shouldDirty||E.shouldTouch)&&L(g,O,E.shouldTouch,E.shouldDirty,!0),E.shouldValidate&&ae(g)},U=(g,S,E)=>{for(const V in S){if(!S.hasOwnProperty(V))return;const O=S[V],P=g+"."+V,Y=z(a,P);(o.array.has(g)||me(O)||Y&&!Y._f)&&!We(O)?U(P,O,E):G(P,O,E)}},B=(g,S,E={})=>{const V=z(a,g),O=o.array.has(g),P=ue(S);ie(i,g,P),O?(h.array.next({name:g,values:ue(i)}),(m.isDirty||m.dirtyFields||x.isDirty||x.dirtyFields)&&E.shouldDirty&&h.state.next({name:g,dirtyFields:Ze(r,i),isDirty:D(g,P)})):V&&!V._f&&!Ce(P)?U(g,P,E):G(g,P,E),Fs(g,o)?h.state.next({...s,name:g,values:ue(i)}):h.state.next({name:l.mount?g:void 0,values:ue(i)})},X=async g=>{l.mount=!0;const S=g.target;let E=S.name,V=!0;const O=z(a,E),P=se=>{V=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||De(se,z(i,E,se))},Y=Ds(n.mode),ne=Ds(n.reValidateMode);if(O){let se,ve;const Ue=S.type?As(O._f):Ga(g),Oe=g.type===Nt.BLUR||g.type===Nt.FOCUS_OUT,wi=!Fc(O._f)&&!n.resolver&&!z(s.errors,E)&&!O._f.deps||Tc(Oe,z(s.touchedFields,E),s.isSubmitted,ne,Y),Tt=Fs(E,o,Oe);ie(i,E,Ue),Oe?(!S||!S.readOnly)&&(O._f.onBlur&&O._f.onBlur(g),d&&d(0)):O._f.onChange&&O._f.onChange(g);const It=L(E,Ue,Oe),Ni=!je(It)||Tt;if(!Oe&&h.state.next({name:E,type:g.type,values:ue(i)}),wi)return(m.isValid||x.isValid)&&(n.mode==="onBlur"?Oe&&y():Oe||y()),Ni&&h.state.next({name:E,...Tt?{}:It});if(!Oe&&Tt&&h.state.next({...s}),n.resolver){const{errors:Jn}=await M([E]);if(j([E]),P(Ue),V){const Ci=Ms(s.errors,a,E),es=Ms(Jn,a,Ci.name||E);se=es.error,E=es.name,ve=je(Jn)}}else j([E],!0),se=(await Ts(O,o.disabled,i,b,n.shouldUseNativeValidation))[E],j([E]),P(Ue),V&&(se?ve=!1:(m.isValid||x.isValid)&&(ve=await I(a,!0)));V&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&ae(O._f.deps),$(E,ve,se,It))}},ee=(g,S)=>{if(z(s.errors,S)&&g.focus)return g.focus(),1},ae=async(g,S={})=>{let E,V;const O=lt(g);if(n.resolver){const P=await A(oe(g)?g:O);E=je(P),V=g?!O.some(Y=>z(P,Y)):E}else g?(V=(await Promise.all(O.map(async P=>{const Y=z(a,P);return await I(Y&&Y._f?{[P]:Y}:Y)}))).every(Boolean),!(!V&&!s.isValid)&&y()):V=E=await I(a);return h.state.next({...!Se(g)||(m.isValid||x.isValid)&&E!==s.isValid?{}:{name:g},...n.resolver||!g?{isValid:E}:{},errors:s.errors}),S.shouldFocus&&!V&&ot(a,ee,g?O:o.mount),V},q=(g,S)=>{let E={...l.mount?i:r};return S&&(E=Xa(S.dirtyFields?s.dirtyFields:s.touchedFields,E)),oe(g)?E:Se(g)?z(E,g):g.map(V=>z(E,V))},Q=(g,S)=>({invalid:!!z((S||s).errors,g),isDirty:!!z((S||s).dirtyFields,g),error:z((S||s).errors,g),isValidating:!!z(s.validatingFields,g),isTouched:!!z((S||s).touchedFields,g)}),W=g=>{g&&lt(g).forEach(S=>fe(s.errors,S)),h.state.next({errors:g?s.errors:{}})},J=(g,S,E)=>{const V=(z(a,g,{_f:{}})._f||{}).ref,O=z(s.errors,g)||{},{ref:P,message:Y,type:ne,...se}=O;ie(s.errors,g,{...se,...S,ref:V}),h.state.next({name:g,errors:s.errors,isValid:!1}),E&&E.shouldFocus&&V&&V.focus&&V.focus()},re=(g,S)=>we(g)?h.state.subscribe({next:E=>"values"in E&&g(T(void 0,S),E)}):T(g,S,!0),Z=g=>h.state.subscribe({next:S=>{Lc(g.name,S.name,g.exact)&&Mc(S,g.formState||m,Me,g.reRenderRoot)&&g.callback({values:{...i},...s,...S,defaultValues:r})}}).unsubscribe,he=g=>(l.mount=!0,x={...x,...g.formState},Z({...g,formState:{...f,...g.formState}})),de=(g,S={})=>{for(const E of g?lt(g):o.mount)o.mount.delete(E),o.array.delete(E),S.keepValue||(fe(a,E),fe(i,E)),!S.keepError&&fe(s.errors,E),!S.keepDirty&&fe(s.dirtyFields,E),!S.keepTouched&&fe(s.touchedFields,E),!S.keepIsValidating&&fe(s.validatingFields,E),!n.shouldUnregister&&!S.keepDefaultValue&&fe(r,E);h.state.next({values:ue(i)}),h.state.next({...s,...S.keepDirty?{isDirty:D()}:{}}),!S.keepIsValid&&y()},$e=({disabled:g,name:S})=>{if(ke(g)&&l.mount||g||o.disabled.has(S)){const O=o.disabled.has(S)!==!!g;g?o.disabled.add(S):o.disabled.delete(S),O&&l.mount&&!l.action&&y()}},Be=(g,S={})=>{let E=z(a,g);const V=ke(S.disabled)||ke(n.disabled);return ie(a,g,{...E||{},_f:{...E&&E._f?E._f:{ref:{name:g}},name:g,mount:!0,...S}}),o.mount.add(g),E?$e({disabled:ke(S.disabled)?S.disabled:n.disabled,name:g}):k(g,!0,S.value),{...V?{disabled:S.disabled||n.disabled}:{},...n.progressive?{required:!!S.required,min:at(S.min),max:at(S.max),minLength:at(S.minLength),maxLength:at(S.maxLength),pattern:at(S.pattern)}:{},name:g,onChange:X,onBlur:X,ref:O=>{if(O){Be(g,S),E=z(a,g);const P=oe(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,Y=kc(P),ne=E._f.refs||[];if(Y?ne.find(se=>se===P):P===E._f.ref)return;ie(a,g,{_f:{...E._f,...Y?{refs:[...ne.filter(Wt),P,...Array.isArray(z(r,g))?[{}]:[]],ref:{type:P.type,name:g}}:{ref:P}}}),k(g,!1,void 0,P)}else E=z(a,g,{}),E._f&&(E._f.mount=!1),(n.shouldUnregister||S.shouldUnregister)&&!(Ka(o.array,g)&&l.action)&&o.unMount.add(g)}}},Ie=()=>n.shouldFocusError&&ot(a,ee,o.mount),_e=g=>{ke(g)&&(h.state.next({disabled:g}),ot(a,(S,E)=>{const V=z(a,E);V&&(S.disabled=V._f.disabled||g,Array.isArray(V._f.refs)&&V._f.refs.forEach(O=>{O.disabled=V._f.disabled||g}))},0,!1))},Pe=(g,S)=>async E=>{let V;E&&(E.preventDefault&&E.preventDefault(),E.persist&&E.persist());let O=ue(i);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Y}=await M();j(),s.errors=P,O=ue(Y)}else await I(a);if(o.disabled.size)for(const P of o.disabled)fe(O,P);if(fe(s.errors,"root"),je(s.errors)){h.state.next({errors:{}});try{await g(O,E)}catch(P){V=P}}else S&&await S({...s.errors},E),Ie(),setTimeout(Ie);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:je(s.errors)&&!V,submitCount:s.submitCount+1,errors:s.errors}),V)throw V},Ve=(g,S={})=>{z(a,g)&&(oe(S.defaultValue)?B(g,ue(z(r,g))):(B(g,S.defaultValue),ie(r,g,ue(S.defaultValue))),S.keepTouched||fe(s.touchedFields,g),S.keepDirty||(fe(s.dirtyFields,g),s.isDirty=S.defaultValue?D(g,ue(z(r,g))):D()),S.keepError||(fe(s.errors,g),m.isValid&&y()),h.state.next({...s}))},Ee=(g,S={})=>{const E=g?ue(g):r,V=ue(E),O=je(g),P=O?r:V;if(S.keepDefaultValues||(r=E),!S.keepValues){if(S.keepDirtyValues){const Y=new Set([...o.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),ve=z(i,ne),Ue=z(P,ne);se&&!oe(ve)?ie(P,ne,ve):!se&&!oe(Ue)&&B(ne,Ue)}}else{if(Fn&&oe(g))for(const Y of o.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Ct(se)){const ve=se.closest("form");if(ve){ve.reset();break}}}}if(S.keepFieldsRef)for(const Y of o.mount)B(Y,z(P,Y));else a={}}i=n.shouldUnregister?S.keepDefaultValues?ue(r):{}:ue(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}o={mount:S.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!S.keepIsValid||!!S.keepDirtyValues||!n.shouldUnregister&&!je(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!S.keepIsValid,l.action=!1,S.keepErrors||(s.errors={}),h.state.next({submitCount:S.keepSubmitCount?s.submitCount:0,isDirty:O?!1:S.keepDirty?s.isDirty:!!(S.keepDefaultValues&&!De(g,r)),isSubmitted:S.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:O?{}:S.keepDirtyValues?S.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:S.keepDefaultValues&&g?Ze(r,g):S.keepDirty?s.dirtyFields:{},touchedFields:S.keepTouched?s.touchedFields:{},errors:S.keepErrors?s.errors:{},isSubmitSuccessful:S.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(g,S)=>Ee(we(g)?g(i):g,{...n.resetOptions,...S}),xe=(g,S={})=>{const E=z(a,g),V=E&&E._f;if(V){const O=V.refs?V.refs[0]:V.ref;O.focus&&setTimeout(()=>{O.focus(),S.shouldSelect&&we(O.select)&&O.select()})}},Me=g=>{s={...s,...g}},ge={control:{register:Be,unregister:de,getFieldState:Q,handleSubmit:Pe,setError:J,_subscribe:Z,_runSchema:M,_updateIsValidating:j,_focusError:Ie,_getWatch:T,_getDirty:D,_setValid:y,_setFieldArray:N,_setDisabledField:$e,_setErrors:v,_getFieldArray:_,_reset:Ee,_resetDefaultValues:()=>we(n.defaultValues)&&n.defaultValues().then(g=>{te(g,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:_e,_subjects:h,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(g){l=g},get _defaultValues(){return r},get _names(){return o},set _names(g){o=g},get _formState(){return s},get _options(){return n},set _options(g){n={...n,...g}}},subscribe:he,trigger:ae,register:Be,handleSubmit:Pe,watch:re,setValue:B,getValues:q,reset:te,resetField:Ve,clearErrors:W,unregister:de,setError:J,setFocus:xe,getFieldState:Q};return{...ge,formControl:ge}}function Rc(e={}){const n=p.useRef(void 0),s=p.useRef(void 0),[a,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:we(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:we(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!we(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Oc(e);n.current={...o,formState:a}}const i=n.current.control;return i._options=e,In(()=>{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!==a.isDirty&&i._subjects.state.next({isDirty:l})}},[i,a.isDirty]),p.useEffect(()=>{var l;e.values&&!De(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),s.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),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(()=>Za(a,i),[i,a]),n.current}function zc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function Bc(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Vc(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 Uc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Hc(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function On(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}On();const qc={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:"$"},Yt=()=>({id:On(),amount:0,glAccount:null,isTaxDeductible:!1}),ar=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:x=!1,labels:h,classNames:b={},"data-testid":w,control:y,name:j,rules:N})=>{const C={...qc,...h},v=y!==void 0&&j!==void 0,k=Rc({defaultValues:{_internal:n||Yt()}}),L=wc({control:v?y:k.control,name:v?j:"_internal",rules:v?N:void 0}),[$,M]=p.useState(n||Yt()),A=v?L.field.value??Yt():e??$,I=v&&!!L.fieldState?.error,F=v&&(L.fieldState?.isTouched??!1),D=I||F,T=D&&(!A.amount||A.amount<=0),_=D&&!A.glAccount,[G,U]=p.useState(A.glAccount?.name||""),B=p.useCallback(J=>{const re={...A,...J};v&&L.field.onChange(re),!v&&e===void 0&&M(re),i?.(re)},[A,e,i,v,L]),X=p.useCallback(J=>{const re=J||0;B({amount:re}),l?.(re)},[B,l]),ee=p.useCallback(J=>{U(J),r?.(J)},[r]),ae=p.useCallback(J=>{if(J===null){B({glAccount:null}),o?.(null);return}const Z=s.find(he=>String(he.id)===String(J))||null;B({glAccount:Z}),o?.(Z)},[s,B,o]),q=p.useCallback(()=>{U(""),B({glAccount:null}),o?.(null)},[B,o]),Q=p.useCallback(J=>{B({isTaxDeductible:J}),d?.(J)},[B,d]),W=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":w||"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":`${w||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.amount,t.jsx(c.Tooltip,{content:C.amountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:A.amount||void 0,onValueChange:X,labelPlacement:"outside",placeholder:C.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:x,isInvalid:T,errorMessage:T?"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:C.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${w||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.glAccount,t.jsx(c.Tooltip,{content:C.glAccountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:A.glAccount?.name??G,selectedKey:A.glAccount?.id??null,isDisabled:x,isInvalid:_,errorMessage:_?"GL Account is required":void 0,listboxProps:{emptyContent:a?C.searching:C.noGlAccountsFound},placeholder:C.glAccountPlaceholder,onInputChange:ee,onSelectionChange:ae,onClear:q,className:b.glAccountInput,children:J=>t.jsx(c.AutocompleteItem,{textValue:J.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:J.name}),J.code&&t.jsx("span",{className:"text-xs text-default-400",children:J.code})]})},J.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${w||"revenue-distribution-card"}-tax-deductible`,isSelected:A.isTaxDeductible,onValueChange:Q,isDisabled:x||!m,className:b.taxDeductibleCheckbox,children:C.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(H,{"data-testid":`${w||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!f,onPress:W,startContent:t.jsx(R,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:C.deleteButton})})]})})};ar.displayName="RevenueDistributionCard";const rr=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(R,{icon:n,width:s,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};rr.displayName="RevenueDistributionEmpty";const Wc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},ir=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Wc,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};ir.displayName="RevenueDistributionError";const lr=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};lr.displayName="RevenueDistributionSkeleton";function Rn({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(H,{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(H,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const Yc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function pn(e){return!e.fund&&Number(e.percentage||0)<=0}function Gc({mode:e,assignments:n}){const s=n.filter(l=>!pn(l)),a=s.filter(l=>l.fund),r=a.reduce((l,o)=>l+Number(o.percentage||0),0),i=s.some(l=>!l.fund||Number(l.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Kc={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"},or={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},rt={...or,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Qc={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"},Zc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Xc(){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 Jc=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,ed=e=>e.fund!==null;function td({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:l=!1,isCollapsed:o,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:f,footer:m,onAssignmentsChange:x,onOpenFundPicker:h,onCloseFundPicker:b,onCollapseChange:w,onSave:y}){const[j,N]=p.useState(null),C=f??j??void 0,v={...Kc,...s},k=e.filter(Z=>!pn(Z)),$=k.filter(ed).length>0,M=p.useMemo(()=>e.filter(Z=>!pn(Z)).reduce((Z,he)=>Z+Number(he.percentage||0),0),[e]),A=Math.round(M*100)/100,I=k.some(Z=>!Z.fund||Number(Z.percentage||0)<=0),F=$&&(A!==100||I),D=`${v.totalError} (${v.total} ${Number(M.toFixed(2))}%)`,T=Gc({mode:"split",assignments:e}),_=$&&A>=100,[G,U]=p.useState(!1),[B,X]=p.useState(!1),ee=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Xc,{}),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=(Z,he)=>{x(e.map(de=>de.id===Z?{...de,...he}:de))},q=()=>{_||x([...e,Yc()])},Q=Z=>{e.length<=1||x(e.filter(he=>he.id!==Z))},W=()=>{if(!r){if(!T){X(!0);return}if(!i){y();return}U(!0)}},J=()=>{U(!1),y()},re=Z=>{const he=u??e.find(de=>!de.fund)?.id??e[0]?.id;he&&(x(e.map(de=>de.id===he?{...de,fund:Z}:de)),b())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative font-sans text-zinc-900",d&&!f&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:o===void 0?["installment-fund-assignment"]:void 0,selectedKeys:o===void 0?void 0:new Set(o?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:Z=>w?.(!(Z==="all"||Array.from(Z).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:ee,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!$&&t.jsx(c.Alert,{icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:or,color:"default",variant:"flat",title:v.emptySplit}),$&&t.jsx(nd,{assignments:e,labels:v,total:M,hasTotalError:B&&!T||F,validationMessage:D,onSelectFund:Z=>h(Z),onRemoveFund:Q,onPercentageChange:(Z,he)=>ae(Z,{percentage:Jc(he)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(H,{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",startContent:t.jsx(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:_,onPress:()=>$?q():h(),children:v.assignSpecificFund}),t.jsx(H,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:W,children:v.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(sd,{funds:n,labels:v,selectedFundIds:e.map(Z=>Z.fund?.id).filter(Boolean),portalContainer:C,onSelect:re,onClose:b}),t.jsx(Rn,{isOpen:G,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(R,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:C,shouldBlockScroll:!1,classNames:Zc,onClose:()=>U(!1),onConfirm:J})]})}function nd({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{className:"flex min-h-15 w-full 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 flex-1 items-center","gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(H,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(H,{type:"button",size:"lg",variant:"light",radius:"full",className:"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 w-48 flex-none items-center",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:Qc})}),e.length>1&&t.jsx(H,{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(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(R,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...rt,base:c.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function sd({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] 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 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(R,{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",children:[t.jsxs("div",{className:"grid 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",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",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[t.jsx("span",{children:u.glCode}),t.jsx("span",{children:u.accountName}),t.jsx(H,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function ad(){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 rd={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function id({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:l}){const o={...rd,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Gt,{label:o.totalAmount,value:d.format(e)}),t.jsx(Gt,{label:o.remainingBalance,value:d.format(n)}),t.jsx(Gt,{label:o.amountReceived,value:d.format(s)})]})})}function Gt({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 ld={monthly:1,quarterly:3,annual:12},cr=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},od=(e,n)=>new Date(e,n+1,0).getDate(),cd=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},dd=(e,n)=>{const{year:s,month:a,day:r}=cr(e),i=a-1+n,l=s+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,od(l,o));return new Date(l,o,d)},ud=(e,n)=>{const{year:s,month:a,day:r}=cr(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function dr(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,l=ld[n.frequency];return Array.from({length:s},(o,d)=>{const u=n.frequency==="weekly"?ud(n.firstInstallmentDate,d*7):dd(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:cd(u),amount:(r+(d===0?i:0))/100}})}function fd(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function md(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const hd={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",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.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},xd=["weekly","monthly","quarterly","annual"],pd=Array.from({length:31},(e,n)=>n+1),gd=["numberOfInstallments","frequency","firstInstallmentDate"],Is=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),zn=e=>Math.round(e*100)/100,bd=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},Lt=e=>{if(!e)return null;try{return mo(e)}catch{return null}},yd=e=>Lt(e)?.day??1,vd=(e,n)=>new Date(e,n,0).getDate(),jd=(e,n)=>{const s=Lt(e);if(!s)return e;const a=Math.min(n,vd(s.year,s.month));return s.set({day:a}).toString()},_s=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 wd({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=gd,startDate:x,firstInstallmentDateOverride:h,labels:b,classNames:w,isSaving:y=!1,showSavedIndicator:j=!1,isModeSwitchDisabled:N=!1,onModeChange:C,onAutomaticSettingsChange:v,onInstallmentsChange:k,onSave:L}){const[$,M]=p.useState(l),A={...hd,...b},I=e??$,F=p.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),D=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,m,x]),T=I==="automatic"?md(dr(n,D),m.includes("firstInstallmentDate")?void 0:h):r,_=p.useMemo(()=>zn(T.reduce((W,J)=>W+Number(J.amount||0),0)),[T]),G=Math.abs(_-n)>.009,U=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:A.title}),j?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:A.saved}):null]}):void 0,B=W=>{W!==I&&(e||M(W),C?.(W),W==="manual"&&r.length===0&&k([Is()]))},X=(W,J)=>{r.find(Z=>Z.id===W)?.status!=="paid"&&k(r.map(Z=>Z.id===W?{...Z,...J}:Z))},ee=()=>{k([...r,Is()])},ae=W=>{r.find(re=>re.id===W)?.status!=="paid"&&k(r.filter(re=>re.id!==W))},q=()=>{y||G||L?.()},Q=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",w?.content),children:[f||u?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Nd,{mode:I,labels:A,onModeChange:B,isDisabled:N,className:w?.tabs}):null,u?t.jsx(H,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:y?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:y,isDisabled:G,onPress:q,children:A.saveInstallments}):null]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",w?.preview),children:[I==="automatic"&&t.jsx(Cd,{settings:D,inputs:m,labels:A,className:w?.controls,onSettingsChange:v}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:I==="automatic"?A.emptyAutomatic:A.emptyManual}),T.length>0&&t.jsx(kd,{mode:I,installments:T,labels:A,formatter:F,locale:a,onUpdateInstallment:X,onRemoveInstallment:ae}),I==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(H,{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}),onPress:ee,children:A.addInstallment})}),t.jsx($d,{total:_,donationAmount:n,hasTotalMismatch:G,mode:I,installments:T,formatter:F,labels:A,className:w?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",w?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",w?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",w?.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":A.title,title:U,children:Q},"installment-schedule")}):Q})}function Nd({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Cd({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Fe,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:xd.map(o=>t.jsx(c.SelectItem,{textValue:s[o],children:s[o]},o))})},l);if(l==="dayOfMonth"){const o=String(yd(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Fe,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:jd(e.firstInstallmentDate,u)})},children:pd.map(d=>t.jsx(c.SelectItem,{textValue:_s(d),children:_s(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(En,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Lt(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(R,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function kd({mode:e,installments:n,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:l}){const o=fd(n),d=new Set(n.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));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((u,f)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===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:["#",f+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:bd(u.dueDate,r)}),f===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:a.format(u.amount)})]},u.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,f)=>{const m=o.has(u.id),x=d.has(u.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:f+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(En,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:m,errorMessage:m?s.dateOrderError:void 0,value:Lt(u.dueDate),onChange:h=>i(u.id,{dueDate:h?h.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:x,errorMessage:x?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:h=>i(u.id,{amount:zn(Number(h.target.value||0))}),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}),t.jsx(Sd,{isDisabled:n.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>l(u.id)})]})},u.id)})})}function Sd({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(H,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:a,"aria-label":s,children:t.jsx(R,{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 $d({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),x=zn(n-e),h=Math.max(x,0),b=Math.max(-x,0),w=s?t.jsxs("span",{children:[l.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),y=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${l.remaining}: ${i.format(h)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:y}),title:w})}function Ad(){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 Ps={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",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"},ur={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Dd={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",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."},Ed={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Fd=[];function Md({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Fd,showSavedIndicator:d=!1,labels:u,isSaving:f=!1,onEditInstallments:m,onPayInstallment:x,onDeleteInstallment:h}){const[b,w]=p.useState(null),y={...Dd,...u},[j,N]=p.useState(""),C=new Intl.NumberFormat(s,{style:"currency",currency:n}),v=a?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:y.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:y.saved}):null]}):void 0,k=p.useMemo(()=>{const $=j.trim().toLowerCase();return $?e.filter(M=>{const A=M.status??"scheduled";return[Kt(M),M.id,M.amount,M.dueDate,Qt(M.dueDate,s),A,ur[A]??A].join(" ").toLowerCase().includes($)}):e},[s,e,j]),L=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:y.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:j,placeholder:y.searchPlaceholder,onChange:$=>N($.target.value),startContent:t.jsx(R,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(H,{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(R,{icon:"solar:pen-outline",className:"size-4"}),isLoading:f,onPress:m,children:y.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(($,M)=>{const A=$.status??"scheduled",I=Kt($);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:I||`PMT-${M+1}`})]}),t.jsx(Os,{status:A})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:C.format($.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Qt($.dueDate,s)})]})]}),t.jsx(Rs,{status:A,installment:$,labels:y,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:x,onDeleteInstallment:h})]})},$.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:y.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:"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[k.map(($,M)=>{const A=$.status??"scheduled",I=Kt($);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:I||`PMT-${M+1}`})}),t.jsx("td",{className:"px-2 py-3",children:C.format($.amount)}),t.jsx("td",{className:"px-2 py-3",children:Qt($.dueDate,s)}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Os,{status:A})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Rs,{status:A,installment:$,labels:y,portalContainer:b??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:x,onDeleteInstallment:h})})]},$.id)}),k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:w,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":y.title,title:v,children:L},"installment-table")}):L})}function Kt(e){return e.name?.trim()||e.id}function Os({status:e}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Ps[e]??Ps.scheduled),startContent:t.jsx(Td,{status:e}),children:ur[e]??e})}function Rs({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(H,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(R,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:s.payNow}):null,t.jsx(Ld,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>o(n.id)})]})}function Ld({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,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(H,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(R,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(R,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Rn,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(R,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Ed,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Td({status:e}){return e==="paid"?t.jsx(R,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(R,{icon:"solar:close-circle-bold",className:"size-3"}):e==="processing"?t.jsx(R,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(R,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(R,{icon:"solar:calendar-outline",className:"size-3"})}function Qt(e,n){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Id={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},_d=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const x=Array.isArray(e)?e:[],[h,b]=p.useState(o),[w,y]=p.useState(l),j={...Id,...r};p.useEffect(()=>{b(o)},[o]);const N=v=>{if(v===h){d&&f?.(v);return}b(v),f?.(v)},C=v=>{y(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:h??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:j.title}),i&&t.jsx(xr,{title:j.renewalTitle,description:j.renewalDescription,value:w,onValueChange:C}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:x.map(v=>t.jsx(fr,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:s,isSelected:h===v.id,onSelect:N},v.id))})]})},fr=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:x,statusTone:h="default",className:b=""})=>{const w=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),y=!!d&&!f,j=m||x,N=()=>{y&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),j&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:h,size:"sm",variant:"flat",className:"px-2",children:j})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:w})]})})},zs="w-full bg-gray-100",Bs={variant:"light",color:"default"},mr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:x=!1,isDisabled:h=!1,compact:b=!1,className:w="",bodyClassName:y="",footerClassName:j="",dataTestId:N})=>{const C=!!(d&&d.value),v=!!u?.label,k=x&&!!m&&!v,L=!k,$=v?{variant:u?.variant??Bs.variant,color:u?.color??Bs.color,size:u?.size??"sm",isDisabled:h||u?.isDisabled,startContent:u?.icon?t.jsx(R,{icon:u.icon,width:16}):void 0}:null,M=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,zs,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,zs,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(R,{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",w),isPressable:k,onPress:m,isDisabled:h,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:M}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",y),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((A,I)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(R,{icon:A.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:A.label})]},`${A.label}-${I}`))}):null,(C||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",j),children:[C?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&&L?t.jsx(H,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:$?.variant,color:$?.color,size:$?.size,startContent:$?.startContent,isDisabled:$?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};mr.displayName="CatalogItemCard";const Pd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Od={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Rd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},zd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Bd={card:"mt-1",panel:"mt-[22px]"},Vd="bg-acct-page border-acct-border text-acct-muted",Ud={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Hd={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"},qd={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"},Wd={empty:"status",error:"alert",success:"status",loading:"status"},Yd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Gd(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(p.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:Ud[e];return r?t.jsx(R,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:l,role:o=Wd[e],ariaLive:d=Yd[e],iconSize:u=24,className:f,classNames:m={},"data-testid":x="feedback-state"}){const h=Gd(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Pd[n],n==="card"?Hd[e]:"bg-transparent",f,m.base),children:[h?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",Od[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Vd:qd[e],m.iconWrapper),children:h}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${x}-title`,className:c.cn(Rd[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(zd[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Bd[n],m.actions),children:l}):null]})}function Bn(e){return t.jsx(et,{...e,variant:"empty"})}function Vn(e){return t.jsx(et,{...e,variant:"error"})}function Un(e){return t.jsx(et,{...e,variant:"loading"})}function hr(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Bn.displayName="EmptyState";Vn.displayName="ErrorState";Un.displayName="LoadingState";hr.displayName="SuccessState";const xr=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Kd={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"},Qd=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),pr=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),Zd=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Hn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),Vs=(e,n,s)=>{const a={};let r=s?n??Zd(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Hn(e)){a[i.id]??={},a[i.id][l.id]??={};const d=s?Math.min(o.max,r):0;a[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return a},Us=(e,n,s)=>`${e}::${n}::${s}`,Xd=(e,n,s)=>{const a=pr(n);for(const{exhibition:r,dateGroup:i,ticket:l}of Hn(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=s===void 0?l.max:Math.min(l.max,s-(a-o));if(d>0&&o<d)return!1}return!0},Jd=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=s||a?.(i+1)},x=()=>{r||i<=n||a?.(i-1)},h=v=>{if(r)return;o(v.target.value);const k=parseInt(v.target.value,10);isNaN(k)||a?.(Math.max(n,Math.min(s,k)))},b=v=>{const k=parseInt(v.target.value,10);if(u(!1),isNaN(k)){a?.(n);return}const L=Math.max(n,Math.min(s,k));L!==k?a?.(L):o(String(L))},w=i<=n,y=i>=s,j="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",C="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:x,disabled:r||w,className:c.cn(j,r||w?C:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:h,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||y,className:c.cn(j,r||y?C:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},eu=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},tu=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Qd(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(Jd,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},nu=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(tu,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),su=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=n.dates.reduce((h,b)=>h+b.tickets.reduce((w,y)=>w+a(n.id,b.id,y.id),0),0),x=n.dates.some(h=>h.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(R,{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:x?n.dates.map((h,b)=>t.jsx(nu,{exhibitionId:n.id,dateGroup:h,isLast:b===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},h.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})})})})]})},au=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...Kd,...s},[u,f]=p.useState(()=>Vs(o,n,!0)),m=p.useRef(!1),x=p.useMemo(()=>{const N=Hn(o).map(({exhibition:C,dateGroup:v,ticket:k})=>[Us(C.id,v.id,k.id),k]);return new Map(N)},[o]),h=Xd(o,u,n),b=(N,C,v)=>u[N]?.[C]?.[v]?.selectedQuantity??0,w=()=>pr(u),y=(N,C,v,k)=>{const L=b(N,C,v),$=w()-L;if(n!==void 0&&$+k>n)return;const M=x.get(Us(N,C,v));if(!M)return;const A={...u,[N]:{...u[N],[C]:{...u[N]?.[C],[v]:{id:v,selectedQuantity:k,originalPrice:M.originalPrice,discountedPrice:M.price}}}};f(A),l?.(A)},j=N=>{const C=Vs(o,n,N);f(C),l?.(C)};return p.useEffect(()=>{!m.current&&h&&(l?.(u),m.current=!0)},[h,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(eu,{label:d.selectAllButtonLabel,checked:h,onChange:j})]}),o.map(N=>t.jsx(su,{title:N.exhibitionName,exhibition:N,onQuantityChange:y,getTicketQuantity:b,getTotalSelectedTickets:w,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},N.id))]})},Zt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Xt=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},ru=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},iu=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,gr=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:x,countAriaLabel:h,countDisplay:b="badge",confirmLabel:w=Zt.confirm,clearLabel:y=Zt.clear,isOpen:j,defaultOpen:N=!1,onOpenChange:C,isDisabled:v=!1,closeOnConfirm:k=!0,keepOpenAfterClear:L=!1})=>{const[$,M]=p.useState(N),[A,I]=p.useState(()=>Xt(u)),F=j??$,D=x??u.filter(q=>iu(q)).length,T=q=>{q&&I(Xt(u)),j||M(q),C?.(q)},_=(q,Q)=>{I(W=>({...W,[q.id]:Q}))},G=(q,Q)=>{I(W=>({...W,[q.id]:Q?[Q]:[]}))},U=async()=>{I(Xt(u.map(q=>q.type==="checkbox"?{...q,selectedValues:[]}:{...q,selectedValue:null}))),await m(),L||T(!1)},B=async()=>{const q=ru(A,u);await f(q),k&&T(!1)},X=q=>{if(q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:q.label,value:A[q.id]??[],onValueChange:W=>_(q,W),children:q.options.map(W=>t.jsx(c.Checkbox,{value:W.value,isDisabled:W.isDisabled,children:W.label},W.value))},q.id);const Q=A[q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:q.label,value:Q,onValueChange:W=>G(q,W||null),children:q.options.map(W=>t.jsx(c.Radio,{value:W.value,isDisabled:W.isDisabled,children:W.label},W.value))},q.id)},ee=p.useMemo(()=>D>0?h?.(D)||`${D} filters applied`:void 0,[h,D]),ae=p.useMemo(()=>D===0?e||Zt.noLabel:h?h(D):`${e} (${D})`,[D,e,h]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:T,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(H,{isDisabled:v,variant:a,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(R,{icon:s,width:16}),t.jsx("span",{children:e}),b==="badge"&&D>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":ee,children:D}):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(q=>X(q)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(H,{variant:"light",color:"default",size:"sm",onPress:U,children:y}),t.jsx(H,{color:"primary",size:"sm",onPress:B,children:w})]})]})})]})})};gr.displayName="FilterPopover";const lu="No sessions available for this date",ou=e=>e==="sold-out"||e==="closed"?"danger":"success",cu=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"},Hs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",du=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,br=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=lu,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:x,calendarSlot:h,dayGroupAriaLabel:b,sessionGridAriaLabel:w,className:y,headingClassName:j,subheadingClassName:N})=>{const C=du(s,a),v=s.find(A=>A.date===C),k=i??s.map(A=>({date:A.date,label:A.label})),L=v?.sessions??[],$=A=>A===C?"solid":"bordered",M=A=>{if(!Hs(A)){if(A.id===l){o(null);return}o(A.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",y),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",j),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:[k.map(A=>t.jsx(H,{size:"sm",variant:$(A.date),color:"default",className:c.cn("rounded-full",x),isDisabled:A.isDisabled,onPress:()=>{r(A.date)},children:t.jsx("span",{children:A.label})},A.date)),h?t.jsx("div",{children:h}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":w||"Sessions",children:[L.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,L.map(A=>{const I=Hs(A),F=A.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!I,onPress:()=>{M(A)},"aria-disabled":I,"aria-pressed":I?void 0:F,className:c.cn("w-full",I?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(A,{isSelected:F,isUnavailable:I}):I?`${A.startTime} ${A.endTime} sold out`:`${A.startTime} ${A.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:[A.startTime," – ",A.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(A):ou(A.status),variant:"flat",children:u?u(A):cu(A)})]})})},A.id)})]})]})};br.displayName="SessionTimeline";const uu=(e,n)=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,yr=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header"})=>{const f=uu(a,r);return t.jsxs("header",{"data-testid":u,className:c.cn("flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn("text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn("mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn("flex flex-wrap items-center gap-2",d.actions),children:i}):null]})};yr.displayName="PageHeader";const fu={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},mu={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"}},vr=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(s==="dot"){const d=mu[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:d.fg,backgroundColor:d.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}return t.jsx(c.Chip,{color:r??fu[e],variant:s,size:a,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),children:n})};vr.displayName="StatusChip";const hu={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"},qn=({label:e,value:n,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>t.jsxs("span",{"data-testid":r,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",hu[s],a),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});qn.displayName="KeyValueChip";const jr=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:l={},"data-testid":o="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":o,className:c.cn("w-full",i,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((d,u)=>t.jsx("div",{"data-testid":`${o}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((f,m)=>{const x=m===e.length-1;return t.jsx("div",{className:c.cn(f==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:f==="fill"?"60%":f}})},m)})},u))})]});jr.displayName="TableSkeleton";const wr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Nr="px-4 text-[13.5px] text-acct-ink2 align-middle",Cr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",kr="w-full",Sr="border-t border-acct-border px-5 py-3.5",$r=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:l={},"data-testid":o="admin-table"})=>t.jsxs("div",{className:c.cn(i,l.base),"data-testid":o,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(kr,l.table),th:c.cn(wr,l.th),tr:c.cn(Cr,l.tr),td:c.cn(Nr,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:d=>t.jsx(c.TableColumn,{align:d.align==="right"?"end":"start",width:d.width,children:d.label},d.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${o}-footer`,className:c.cn(Sr,l.footer),children:a}):null]});$r.displayName="AdminTable";const xu={md:"w-[280px]",lg:"w-[360px]"},Ar=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>t.jsxs("div",{role:"search","data-testid":u,className:c.cn("flex flex-wrap items-center gap-3 mb-4",d),children:[t.jsx(c.Input,{type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:xu[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]});Ar.displayName="AdminToolbar";const pu="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",gu="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",Dr=p.forwardRef(function({icon:n,children:s,count:a,className:r,testId:i,...l},o){return t.jsxs(H,{ref:o,"data-testid":i,variant:"light",size:"sm",className:c.cn(gu,r),...l,children:[t.jsx(R,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:pu,children:a})]})});Dr.displayName="ToolbarButton";function Er({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:l=>s(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Er.displayName="UnderlineTabs";const Wn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Yn="font-normal normal-case tracking-normal",Fr=["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(" "),Mr="text-[13.5px] text-acct-ink",Lr="bg-acct-page text-acct-muted cursor-default",Tr="mt-[5px] text-xs text-acct-sub",Ir="mt-[5px] text-xs text-acct-danger",_r=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Wn,s),children:[e,n?t.jsxs("span",{className:Yn,children:[" ",n]}):null]});_r.displayName="AdminFieldLabel";const Pr=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":x="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:Yn,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":x,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Wn,inputWrapper:Fr,input:c.cn(Mr,(o||l)&&"font-mono",l&&Lr),description:Tr,errorMessage:Ir}});Pr.displayName="AdminTextField";const bu={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Or=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(H,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",bu[n]),children:r.icon},r.key))});Or.displayName="RowActions";const Rr=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(H,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&a?t.jsx(H,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Rr.displayName="PickerRow";function zr(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const Br=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=zr(e,n,s),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:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};Br.displayName="PaginationSummary";const Vr=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:x,emptyIcon:h,emptyActions:b,emptyContent:w,children:y,className:j,classNames:N={},"data-testid":C="list-panel"})=>{const v={base:c.cn("border-0 bg-transparent py-12",N.state)};let k;return e?k=r??t.jsx(Un,{title:a,classNames:v,"data-testid":`${C}-loading`}):n?k=f??t.jsx(Vn,{title:i,description:l,classNames:v,"data-testid":`${C}-error`,actions:u??(d?t.jsx(H,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):s?k=w??t.jsx(Bn,{title:m,description:x,icon:h,actions:b,classNames:v,"data-testid":`${C}-empty`}):k=y,t.jsx("section",{"data-testid":C,className:c.cn("rounded-xl bg-white p-2 shadow-sm",j,N.base),children:k})};Vr.displayName="ListPanel";const yu=350,vu={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}"},Jt=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),ju=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...vu,...i},x=Ft(e.currency,r),h=n!==void 0,[b,w]=p.useState(s??null),y=h?n:b,j=p.useMemo(()=>{const T=typeof y=="number"&&Number.isFinite(y)?y:0,_=dn(T,e.value,e.currency,r);return{received:T,change:_>0?_:0,isValid:T>=e.value&&T>0}},[y,e.value,e.currency,r]),N=p.useCallback(T=>{const _=T.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]),C=p.useCallback(T=>{if(l)return;const _=T.replace(/[^\d.,]/g,"").replace(",","."),G=_===""?null:Number.parseFloat(_),U=G===null||Number.isNaN(G)?null:G;if(U!==null&&o!==void 0&&U>o)return;h||w(U);const B=typeof U=="number"&&Number.isFinite(U)?U:0,X=dn(B,e.value,e.currency,r);a?.({received:B,change:X>0?X:0,isValid:B>=e.value&&B>0})},[h,l,e.value,e.currency,r,a,o]),v=y==null?"":String(y),k=j.isValid&&j.change>0,L=!j.isValid&&j.received>0,$=pe(j.change,r,e.currency),M=pe(e.value,r,e.currency),[A,I]=p.useState(""),F=p.useRef(null);p.useEffect(()=>{F.current&&clearTimeout(F.current);const T=k?Jt(m.changeMessageTemplate,{change:$}):"",_=k?yu:0;return F.current=setTimeout(()=>I(T),_),()=>{F.current&&clearTimeout(F.current)}},[k,$,m.changeMessageTemplate]);const D=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:D,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:x===0?"numeric":"decimal",pattern:x===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:v,onChange:T=>C(T.target.value),onFocus:N,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:L,errorMessage:L?Jt(m.insufficientMessageTemplate,{due:M}):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:Jt(m.changeMessageTemplate,{change:$}),icon:t.jsx(R,{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})]})},wu={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},qs=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Ur=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":x="check-tender-form"})=>{const h={...wu,...r},b=n!==void 0,[w,y]=p.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??qs()}),[j,N]=p.useState(!!s?.checkNumber),C=p.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??qs()}:w,[b,n,w]),v=p.useCallback(F=>{b||y(F);const D=F.checkNumber.trim(),T={amount:e.value,checkNumber:D,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:D.length>0&&e.value>0};a?.(T)},[b,e.value,i,a]),k=p.useCallback(F=>D=>{o||(F==="checkNumber"&&D.length>0&&N(!0),v({...C,[F]:D}))},[C,v,o]),L=p.useCallback(()=>{o||N(!0)},[o]),$=j&&C.checkNumber.trim()==="",M=`${x}-check-number`,A=`${x}-bank-name`,I=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":x,children:[t.jsx(c.Input,{id:M,label:h.checkNumberLabel,labelPlacement:"outside",type:"text",value:C.checkNumber,onChange:F=>k("checkNumber")(F.target.value),onBlur:L,placeholder:h.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:$,errorMessage:$?h.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${x}-check-number-input`}),!l&&t.jsx(c.Input,{id:A,label:h.bankNameLabel,labelPlacement:"outside",type:"text",value:C.bankName,onChange:F=>k("bankName")(F.target.value),placeholder:h.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:I,label:h.dateLabel,labelPlacement:"outside",type:"date",value:C.date,onChange:F=>k("date")(F.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};Ur.displayName="CheckTenderForm";const Nu={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Cu=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Hr=({dueAmount:e,methodOptions:n=Cu,value:s,defaultValue:a,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Nu,...i},m=s!==void 0,[x,h]=p.useState({method:a?.method??"",reference:a?.reference??""}),b=p.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:x,[m,s,x]),w=p.useCallback(k=>n.find(L=>L.value===k)?.label??"",[n]),y=p.useCallback(k=>{m||h(k);const L=w(k.method),$={amount:e.value,method:k.method,description:L,reference:k.reference.trim()||void 0,isValid:k.method!==""};r?.($)},[m,e.value,r,w]),j=p.useCallback(k=>{if(o)return;const L=typeof k=="string"?k:Array.from(k)[0]?.toString()??"";y({...b,method:L})},[b,y,o]),N=p.useCallback(k=>{o||y({...b,reference:k})},[b,y,o]),C=`${u}-method`,v=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Fe,{id:C,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:j,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(k=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${k.value}`,children:k.label},k.value))}),l&&t.jsx(c.Input,{id:v,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:k=>N(k.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Hr.displayName="OtherTenderForm";const ku={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Su={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},$u={pending:"warning",recorded:"success",failed:"danger"},Au=e=>e==="pending"||e==="recorded",Du=e=>`#${e+1}`,qr=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:l,"data-testid":o="split-payment-summary"})=>{const d={...ku,...r},{collected:u,remaining:f,isComplete:m}=p.useMemo(()=>{const h=n.reduce((w,y)=>Au(y.status)?w+y.amount:w,0),b=Math.max(e.value-h,0);return{collected:h,remaining:b,isComplete:h>=e.value&&e.value>0}},[n,e.value]),x=h=>h==="pending"?d.statusPending:h==="recorded"?d.statusRecorded:d.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":o,children:[t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${o}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:m?d.completeLabel:d.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${o}-remaining-amount`,children:pe(m?u:f,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${o}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:d.collectedHeading}),n.map((h,b)=>t.jsx(Eu,{index:b,tender:h,locale:a,currency:e.currency,removable:!!s&&h.status!=="recorded",onRemove:s?()=>s(h.id):void 0,statusLabel:x(h.status),removeAriaLabel:d.removeAriaLabel,recordedTooltip:d.removeTooltipForRecorded,dataTestId:`${o}-row-${b}`},h.id))]})]})};qr.displayName="SplitPaymentSummary";const Eu=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(H,{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(R,{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:Du(e)}),t.jsx(R,{icon:Su[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:pe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:$u[n.status],startContent:n.status==="recorded"?t.jsx(R,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(R,{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})}))]})},Fu=`
17
17
  @keyframes pp-modal-in {
18
18
  from { opacity: 0; transform: scale(0.96); }
19
19
  to { opacity: 1; transform: scale(1); }
@@ -38,5 +38,5 @@ ${s}${a}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,qr=p.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Fu}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));qr.displayName="ModalShell";const Wr=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(R,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Wr.displayName="ModalShellHeader";const Yr=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});Yr.displayName="ModalShellFooter";const Mu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Lu={1:"grid-cols-1",2:"grid-cols-2"},en=e=>typeof e=="string"?t.jsx(R,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Gr=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:l=2,className:o,"data-testid":d="tile-select"})=>{const u=e.find(f=>f.key===n);return t.jsxs("div",{className:c.cn("flex flex-col gap-3",o),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Me,{"aria-label":a?void 0:r,"aria-labelledby":a?`${d}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:f=>{const x=Array.from(f)[0];typeof x=="string"&&s(x)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${d}-mobile-select`,startContent:u?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(u.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(f=>t.jsx(c.SelectItem,{isDisabled:f.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(f.icon)}),"data-testid":f["data-testid"]??`${d}-${f.key}-mobile`,children:f.label},f.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",Lu[l],Mu[i]),children:e.map(f=>{const m=n===f.key;return t.jsxs(U,{variant:"bordered",radius:"lg","aria-pressed":m,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${d}-${f.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",m?"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:en(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Gr.displayName="TileSelect";const Iu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Kr=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=Iu[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:xe(e.value,s,e.currency)})]})};Kr.displayName="PaymentTotalBanner";const Tu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Qr=({title:e,subtitle:n,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Tu[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Qr.displayName="LoadingOverlay";const Wn=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(R,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(U,{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(R,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Wn.displayName="PaymentCashChangeBanner";const Zr=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(R,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Wn,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(U,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Zr.displayName="PaymentSuccessView";const Yn=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:d,autoFocus:u,maxAmount:f,hideHeading:m=!1,className:x,"data-testid":h="payment-sub-amount-input"})=>{const b=`${h}-input`,y=p.useCallback(N=>{if(f!==void 0){const j=Number.parseFloat(N.replace(",","."));if(Number.isFinite(j)&&j>f)return}r?.(N)},[f,r]),v=p.useCallback(N=>{const j=N.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":h,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",m&&"sr-only"),"data-testid":`${h}-heading`,children:e}),t.jsx(c.Input,{id:b,label:n,labelPlacement:"outside",classNames:m?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:N=>y(N.target.value),onFocus:v,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:o?d:void 0,variant:"bordered",radius:"lg","aria-invalid":o||void 0,autoFocus:u,"data-testid":`${h}-field`})]})};Yn.displayName="PaymentSubAmountInput";const _u={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"}},Pu=e=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e,Xr=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:x=!1,icon:h,"data-testid":b="confirm-dialog"})=>{const y=i??l??null,v=_u[d],N=x?null:Pu(h??v.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:j=>r?.(j),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:[N?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",v.tile),children:N}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(U,{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(U,{color:v.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Xr.displayName="ConfirmDialog";const Ou=60,Ru=(e,n,s=Ou)=>n?e>s:e<-s,Jr=(e,n)=>Math.max(0,Math.min(e,n)),zu=160,Bu=(e,n,s=zu)=>Math.min(e,Math.max(0,n-s)),Vu=(e,n,s)=>Jr(e-n,s),Uu=(e,n,s)=>e!==null?Jr(e,s):n?s:0,Hu=e=>e?"":"transition-[height] duration-300 ease-out",qu=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Vu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{Ru(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,n)=>xe(e.value,n,e.currency),Gn=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0})=>{const i=!!e.children&&e.children.length>0,l=!!s&&r;return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"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:[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:c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)}),l&&t.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{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:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((o,d)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${o.key??d}`,className:"flex items-center justify-between gap-2 text-sm text-default-500",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.icon,t.jsx("span",{className:"truncate",children:o.label})]}),(o.value!=null||o.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",o.valueTone==="primary"&&"font-medium text-primary"),children:o.value}),o.tooltip!=null&&t.jsx(c.Tooltip,{content:o.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${o.key??d}`,className:"flex shrink-0 items-center",children:t.jsx(R,{icon:"lucide:info",width:16,height:16,className:c.cn(o.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},o.key??d)),i&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(o=>t.jsx(Gn,{item:o,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},o.id))})]})};Gn.displayName="SummaryItemRow";const ei=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)})]});ei.displayName="SummaryServiceFeeRow";const Kn=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const l=!!a&&i&&!!e.id,o=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,n)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label}),l?t.jsxs("div",{className:"flex shrink-0 items-center",children:[o,t.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):o]})};Kn.displayName="SummaryTotalsLineRow";const ti=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,showRemoveButton:d,emptyState:u,classNames:f})=>{const m=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),m?t.jsx("div",{className:c.cn("flex flex-col gap-4",f.items),children:s.map(x=>t.jsx(Gn,{item:x,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:d},x.id))}):t.jsx("div",{"data-testid":"summary-empty",children:u}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(ei,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn("flex flex-col gap-4",f.totalsRows),children:r.map((x,h)=>t.jsx(Kn,{row:x,locale:i,emphasized:h===0},x.key))})]})};ti.displayName="SummaryBody";const ni=({total:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-total",className:c.cn("flex items-center justify-between text-xl 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 text-xl font-semibold leading-7",children:Ye(e.amount,n)})]});ni.displayName="SummaryGrandTotalRow";const si=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,n)})]});si.displayName="SummarySecondaryTotalRow";const St=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(U,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});St.displayName="SummaryPrimaryCta";const ai=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(R,{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:Ye(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:Ye(s.amount,a)})]})]})]})});ai.displayName="SummaryCollapseHeader";const ri=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(R,{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})]});ri.displayName="SummaryCartButton";const ii=({open:e,progress:n,dragging:s,primaryAction:a,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",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(ri,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),a&&t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&t.jsx("div",{children:o})]});ii.displayName="SummaryActionBar";const Wu="(max-width: 767px)",Yu=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Gu=(e=Wu)=>{const[n,s]=p.useState(()=>Yu(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},li=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:m,isOpen:x,onToggleOpen:h,defaultOpen:b=!1,primaryAction:y,isLoading:v=!1,onRemoveItem:N,showRemoveButton:j,ctaCaption:C,variant:w,cart:S,emptyState:E,labels:A,classNames:L={},"data-testid":M="summary",className:_})=>{const D=A?.removeAriaLabel??"Remove item",$=A?.removePostTotalRowAriaLabel??"Remove applied code",I=A?.toggleAriaLabel??"Toggle summary",T=A?.cartAriaLabel??"View cart",K=Gu(),B=m??(w??(K?"mobile":"main"))==="mobile",[X,J]=p.useState(b),ae=x!==void 0,q=!B||(ae?x:X),Z=p.useCallback(()=>{ae||J(pe=>!pe),h?.()},[ae,h]),[Q,W]=p.useState(0),[ee,ce]=p.useState(null),de=p.useRef(null),ve=p.useRef(null),be=p.useCallback(()=>{const pe=de.current;pe&&W(Bu(pe.scrollHeight,window.innerHeight))},[]),Se=p.useCallback(pe=>{ve.current?.disconnect(),ve.current=null,de.current=pe,pe&&(be(),typeof ResizeObserver<"u"&&(ve.current=new ResizeObserver(be),ve.current.observe(pe)))},[be]);p.useEffect(()=>(window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)),[be]);const _e=qu({open:q,fullHeight:Q,setDragHeight:ce,onToggleOpen:Z}),Pe=ee!==null,Oe=Uu(ee,q,Q),Ve=Q>0?Math.min(1,Math.max(0,Oe/Q)):q?1:0,Fe=t.jsx(ni,{total:o,locale:a,className:L.total}),te=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(pe=>t.jsx(Kn,{row:pe,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:$,showRemoveButton:j},pe.key))}),he=f&&t.jsx(si,{secondaryTotal:f,locale:a,className:L.secondaryTotal}),Le=C!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",L.ctaCaption),children:C}),mt=t.jsx(ti,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:l,locale:a,onRemoveItem:N,removeAriaLabel:D,showRemoveButton:j,emptyState:E,classNames:L});return B?t.jsxs(Ce.motion.section,{"data-testid":M,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:_e.onDrag,onDragEnd:_e.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)]",_,L.base),children:[t.jsx(ai,{title:e,total:o,secondaryTotal:f,locale:a,open:q,progress:Ve,dragging:Pe,toggleAriaLabel:I,onToggleOpen:Z,classNames:L}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!q,style:{height:Oe},className:c.cn("min-h-0",q&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!q&&"pointer-events-none",Hu(Pe)),children:t.jsxs("div",{ref:Se,className:"flex flex-col gap-4 pb-4",children:[mt,t.jsx(c.Divider,{className:"bg-default-200"}),Fe,te,he]})}),t.jsx(ii,{open:q,progress:Ve,dragging:Pe,primaryAction:y,isLoading:v,cart:S,cartAriaLabel:T,ctaCaption:Le,onToggleOpen:Z,classNames:L})]}):t.jsxs("section",{"data-testid":M,className:c.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",_,L.base),children:[t.jsx("div",{className:c.cn("flex items-center justify-between",L.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",L.title),children:e})}),mt,t.jsx(c.Divider,{className:"bg-default-200"}),Fe,te,he,f&&y&&t.jsx(c.Divider,{className:"bg-default-200"}),y&&t.jsx(St,{action:y,disabledByLoading:v,className:c.cn("w-full",L.cta)}),Le]})};li.displayName="Summary";const Ku={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},Qu={backgroundColor:jn.destructive,color:"#fff"},Hs="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",tn="absolute top-0 h-5 w-5 opacity-0",oi=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":x="wizard-shell",children:h})=>{const b={...Ku,...f},y=n.filter(w=>w.state!=="skipped"),v=n.find(w=>w.id===s),N=Math.max(0,y.findIndex(w=>w.id===s)),j=r??e,C=r?b.back:b.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":x,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${x}-header`,children:[j&&t.jsx(U,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:j,"data-testid":`${x}-header-back`,startContent:t.jsx(R,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:C}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${x}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${x}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${x}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(tn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(tn,"left-6"),"data-testid":`${x}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(tn,"left-12"),"data-testid":`${x}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${x}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:xe(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Hs,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Hs,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:b.owesBadge})]}),t.jsx(U,{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"?Qu:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${x}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${x}-stepper`,children:y.map((w,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<N&&"bg-pos-ok",S===N&&"bg-primary",S>N&&"bg-pos-line")},w.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:h}),u]})};oi.displayName="WizardShell";const Zu=(e,n,s)=>Math.min(Math.max(e,n),s);function gn(e,n,s){const a=Math.max(1,Math.trunc(n)),r=Zu(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Ft(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/a),d=l-o*a;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Xu(e,n){return gn(e,n,1)}const Ju=e=>Number.isFinite(e)?e.toFixed(2):"",bn=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),x=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",x?"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??Ju(e),onChange:h=>{const b=h.target.value,y=Number.parseFloat(b.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(b),Number.isFinite(y)&&y>=0?a(y):b.trim()===""&&a(0))},onFocus:h=>h.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};bn.displayName="AmountCell";const ef={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"},tf="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",qs="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",nn="absolute h-5 w-5 opacity-0",nf=e=>{const n=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Xu(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(s.value,void 0,s.currency)} · ${n}`},ci=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...ef,...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 x=n[m.id],h=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),v=x?.quantity,N=x?.selected?Math.min(v??y,y):v??0,j=gn(m.paidAmount,y,N).value,C=x?.amount??(x?.selected?j:0),w=N===0&&C>.004,S=A=>s(m.id,{selected:A.quantity>0||A.amount>.004,mode:"full",...A}),E=A=>{const L=Math.min(Math.max(A,0),y);S({quantity:L,amount:gn(m.paidAmount,y,L).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",h&&"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(R,{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??nf(m)}),w&&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:[h?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(bn,{value:C,expected:j,max:m.paidAmount.value,onChange:A=>S({quantity:N,amount:A}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),h?t.jsx("span",{className:tf,"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:qs,"aria-label":u.decrease.replace("{name}",m.name),disabled:N===0,onClick:()=>E(N-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:N}),t.jsx("button",{type:"button",className:qs,"aria-label":u.increase.replace("{name}",m.name),disabled:N===y,onClick:()=>E(N+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),N>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(y))}),x?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(R,{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})]}),N>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(Me,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:A=>{if(A==="all")return;const L=[...A][0];L&&(r?.(m.id,L),a(m.id,L==="stock"))},"data-testid":`${b}-restock`,children:f.map(A=>t.jsx(c.SelectItem,{children:A.label},A.key))})]})]}),!h&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(nn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:A=>s(m.id,{selected:A,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(nn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>S({quantity:N,amount:j}),className:c.cn(nn,"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(R,{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(R,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",xe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(bn,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(R,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};ci.displayName="LineItemList";const di=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});di.displayName="MetaCard";const ui=({label:e,htmlFor:n,children:s,className:a,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",a),"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:s})]});ui.displayName="MetaCard.Row";const fi=({label:e,children:n,className:s,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});fi.displayName="MetaCard.Section";const sf=Object.assign(di,{Row:ui,Section:fi}),mi=({heading:e,icon:n="lucide:rotate-ccw",action:s,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(R,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(R,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});mi.displayName="SectionPanel";const hi=({name:e,detail:n,icon:s="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});hi.displayName="CustomerCard";const af={label:"Reason for the return",placeholder:"Select a reason…"},xi=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...af,...r};return t.jsx(Me,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:n?[n]:[],isInvalid:!!a,errorMessage:a,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&s(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};xi.displayName="ReasonSelect";const rf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},pi=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...rf,...i},[u,f]=p.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(U,{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})]})})};pi.displayName="NotesField";const lf={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"}},of={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Ws="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Qn=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=lf[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(R,{icon:of[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(U,{color:"primary",className:Ws,onPress:a,"data-testid":u,children:r}),t.jsx(U,{variant:"bordered",className:c.cn(Ws,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Qn.displayName="TenderBanner";const cf={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"},df={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},gi=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...cf,...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(Qn,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(R,{icon:df[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${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(R,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};gi.displayName="TenderMethods";const uf=e=>e.refunded!==null,ff={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"},mf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",hf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",bi=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":x="split-tender-panel"})=>{const h={...ff,...f},b=e.filter(uf),y=e.find(C=>C.tenderId===a.tenderId)?.label,v=!!(r?.length&&a.onTenderChange),N=p.useCallback(C=>{const w=Number.parseFloat(C.replace(",","."));a.onAmountChange(Number.isFinite(w)?w:0)},[a]),j=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:h.title}),l&&t.jsx(Qn,{tone:j?"danger":"warning",title:j?h.declinedTitle:h.networkTitle,body:j?h.partDeclinedBody:h.partNetworkBody,onRetry:l.onRetry,retryLabel:h.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:h.chooseDifferent,className:"mb-[18px]","data-testid":`${x}-part-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{"data-testid":`${x}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:h.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[h.refundedSoFar,": ",xe(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:mf,children:h.refundedSoFar}),b.map((C,w)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${x}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",w+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(R,{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:xe(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(hf,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?h.pending:h.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${x}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:h.partHeading.replace("{n}",String(b.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:h.amountForPart}),t.jsx(Yn,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:N,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),v&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${x}-methods`,children:r?.map(C=>{const w=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":w,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",w?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${x}-method-${C.tenderId}`,children:[C.icon&&t.jsx(R,{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(U,{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":`${x}-back`,children:h.back}),t.jsx(U,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${x}-submit`,children:h.submit})]})]})};bi.displayName="SplitTenderPanel";const xf={label:"Supervisor authorization",placeholder:"••••"},yi=({pin:e,onChange:n,hint:s,error:a,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(R,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${l}-input`})]})};yi.displayName="PinField";const pf={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}"},gf={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},bf="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ys="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",yf="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)]",vf=["email","print"],vi=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const x={...pf,...u},h=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:x.processing}),h&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:h})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&yf,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(R,{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:x.title}),h&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:h}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:x.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ys,children:x.destinationsTitle}),s.map((b,y)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${y}-${b.status}`,children:[t.jsx("span",{className:"font-semibold",children:b.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:xe(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(bf,gf[b.status]),children:b.status==="succeeded"?x.succeeded:x.pending})]})]},`${b.label}-${y}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ys,children:x.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:vf.map(b=>{const y=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":y,onClick:()=>l(b),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${b}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:y,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:x[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:x.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(U,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:x.done})})]})};vi.displayName="OutcomeView";exports.AdminFieldLabel=Tr;exports.AdminTable=Sr;exports.AdminTextField=_r;exports.AdminToolbar=Ar;exports.AppliedCodeCard=la;exports.Button=U;exports.CashTenderForm=ju;exports.CatalogItemCard=fr;exports.CheckTenderForm=Vr;exports.CommitmentDetails=rd;exports.ConfirmDialog=Xr;exports.ConfirmationModal=Lt;exports.ConfirmationPageTemplate=Do;exports.CustomerCard=hi;exports.DatePicker=En;exports.DimensionChip=Un;exports.DonationAmounts=Pa;exports.EmptyState=Rn;exports.ErrorState=zn;exports.EventDetails=uc;exports.EventDetailsTemplate=Fo;exports.ExpireCartTimer=Oa;exports.FeedbackState=et;exports.FilterPopover=pr;exports.Footer=Io;exports.HeroUIProvider=Xi;exports.HorizontalSteps=Ma;exports.InstallmentFundAssignment=ed;exports.InstallmentFundAssignmentSkeleton=sd;exports.InstallmentSchedule=wd;exports.InstallmentScheduleSkeleton=$d;exports.InstallmentTable=Md;exports.ItemCard=ur;exports.KeyValueChip=Un;exports.LineItemList=ci;exports.ListPanel=Br;exports.LoadingOverlay=Qr;exports.LoadingState=Bn;exports.MembershipSelectCards=_d;exports.MetaCard=sf;exports.ModalShell=qr;exports.ModalShellFooter=Yr;exports.ModalShellHeader=Wr;exports.Multiselect=To;exports.Navbar=$o;exports.NotesField=pi;exports.OfferCard=wt;exports.OfferCardEmpty=Ra;exports.OfferCardError=za;exports.OfferCardList=Ha;exports.OfferCardSkeleton=Ba;exports.OtherTenderForm=Ur;exports.OutcomeView=vi;exports.PageHeader=br;exports.PaginationSummary=zr;exports.PaymentCashChangeBanner=Wn;exports.PaymentSubAmountInput=Yn;exports.PaymentSuccessView=Zr;exports.PaymentTotalBanner=Kr;exports.PickerRow=Or;exports.PinField=yi;exports.RICH_TEXT_PRESETS=Ta;exports.ReasonSelect=xi;exports.RedeemCodeInput=Co;exports.RevenueDistributionCard=nr;exports.RevenueDistributionEmpty=sr;exports.RevenueDistributionError=ar;exports.RevenueDistributionSkeleton=rr;exports.RichTextArea=_a;exports.RowActions=Pr;exports.SectionPanel=mi;exports.Select=Me;exports.SessionTimeline=gr;exports.SplitPaymentSummary=Hr;exports.SplitTenderPanel=bi;exports.StatusChip=yr;exports.Stepper=Ea;exports.SuccessState=mr;exports.Summary=li;exports.TableSkeleton=vr;exports.TenderMethods=gi;exports.TicketSelection=au;exports.TileSelect=Gr;exports.Toggle=hr;exports.ToolbarButton=$r;exports.UnderlineTabs=Dr;exports.WizardShell=oi;exports.adminFieldErrorClass=Ir;exports.adminFieldHintClass=Lr;exports.adminFieldLabelClass=Hn;exports.adminFieldLabelSuffixClass=qn;exports.adminInputClass=Fr;exports.adminInputReadOnlyClass=Mr;exports.adminInputWrapperClass=Er;exports.adminRowClass=Nr;exports.adminSurfaceCss=Zi;exports.adminSurfaceTokens=vn;exports.adminTableClass=Cr;exports.adminTableFooterClass=kr;exports.adminTdClass=wr;exports.adminThClass=jr;exports.calculateAllocationDifference=Uc;exports.computeChange=dn;exports.currencyFractionDigits=Ft;exports.formatMoney=xe;exports.formatOfferCurrency=fn;exports.formatRevenueAmount=Rc;exports.formatRevenueCurrency=zc;exports.generateAutomaticInstallments=or;exports.generateDistributionId=On;exports.getCurrencySymbol=Bc;exports.offerCardVariants=Ua;exports.offerListVariants=Va;exports.pageRange=Rr;exports.parseOfferCurrency=fc;exports.parseRevenueCurrency=Vc;exports.posSurfaceTokens=jn;exports.roundToCurrency=Fa;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,Wr=p.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Fu}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));Wr.displayName="ModalShell";const Yr=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(H,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(R,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Yr.displayName="ModalShellHeader";const Gr=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});Gr.displayName="ModalShellFooter";const Mu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Lu={1:"grid-cols-1",2:"grid-cols-2"},en=e=>typeof e=="string"?t.jsx(R,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Kr=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:l=2,className:o,"data-testid":d="tile-select"})=>{const u=e.find(f=>f.key===n);return t.jsxs("div",{className:c.cn("flex flex-col gap-3",o),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Fe,{"aria-label":a?void 0:r,"aria-labelledby":a?`${d}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:f=>{const x=Array.from(f)[0];typeof x=="string"&&s(x)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${d}-mobile-select`,startContent:u?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(u.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(f=>t.jsx(c.SelectItem,{isDisabled:f.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(f.icon)}),"data-testid":f["data-testid"]??`${d}-${f.key}-mobile`,children:f.label},f.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",Lu[l],Mu[i]),children:e.map(f=>{const m=n===f.key;return t.jsxs(H,{variant:"bordered",radius:"lg","aria-pressed":m,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${d}-${f.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",m?"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:en(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Kr.displayName="TileSelect";const Tu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Qr=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=Tu[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:pe(e.value,s,e.currency)})]})};Qr.displayName="PaymentTotalBanner";const Iu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Zr=({title:e,subtitle:n,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Iu[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Zr.displayName="LoadingOverlay";const Gn=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(R,{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:pe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(H,{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(R,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Gn.displayName="PaymentCashChangeBanner";const Xr=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(R,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Gn,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(H,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Xr.displayName="PaymentSuccessView";const Kn=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:d,autoFocus:u,maxAmount:f,hideHeading:m=!1,className:x,"data-testid":h="payment-sub-amount-input"})=>{const b=`${h}-input`,w=p.useCallback(j=>{if(f!==void 0){const N=Number.parseFloat(j.replace(",","."));if(Number.isFinite(N)&&N>f)return}r?.(j)},[f,r]),y=p.useCallback(j=>{const N=j.currentTarget;requestAnimationFrame(()=>{N.isConnected&&N.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":h,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",m&&"sr-only"),"data-testid":`${h}-heading`,children:e}),t.jsx(c.Input,{id:b,label:n,labelPlacement:"outside",classNames:m?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:j=>w(j.target.value),onFocus:y,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:o?d:void 0,variant:"bordered",radius:"lg","aria-invalid":o||void 0,autoFocus:u,"data-testid":`${h}-field`})]})};Kn.displayName="PaymentSubAmountInput";const _u={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"}},Pu=e=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e,Jr=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:x=!1,icon:h,"data-testid":b="confirm-dialog"})=>{const w=i??l??null,y=_u[d],j=x?null:Pu(h??y.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:[j?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",y.tile),children:j}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),w!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof w=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:w}):w}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(H,{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(H,{color:y.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Jr.displayName="ConfirmDialog";const Ou=60,Ru=(e,n,s=Ou)=>n?e>s:e<-s,ei=(e,n)=>Math.max(0,Math.min(e,n)),zu=160,Bu=(e,n,s=zu)=>Math.min(e,Math.max(0,n-s)),Vu=(e,n,s)=>ei(e-n,s),Uu=(e,n,s)=>e!==null?ei(e,s):n?s:0,Hu=e=>e?"":"transition-[height] duration-300 ease-out",qu=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Vu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{Ru(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,n)=>pe(e.value,n,e.currency),Qn=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0})=>{const i=!!e.children&&e.children.length>0,l=!!s&&r;return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"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:[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:c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)}),l&&t.jsx(H,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{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:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((o,d)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${o.key??d}`,className:"flex items-center justify-between gap-2 text-sm text-default-500",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.icon,t.jsx("span",{className:"truncate",children:o.label})]}),(o.value!=null||o.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",o.valueTone==="primary"&&"font-medium text-primary"),children:o.value}),o.tooltip!=null&&t.jsx(c.Tooltip,{content:o.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${o.key??d}`,className:"flex shrink-0 items-center",children:t.jsx(R,{icon:"lucide:info",width:16,height:16,className:c.cn(o.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},o.key??d)),i&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(o=>t.jsx(Qn,{item:o,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},o.id))})]})};Qn.displayName="SummaryItemRow";const ti=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)})]});ti.displayName="SummaryServiceFeeRow";const Zn=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const l=!!a&&i&&!!e.id,o=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,n)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label}),l?t.jsxs("div",{className:"flex shrink-0 items-center",children:[o,t.jsx(H,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):o]})};Zn.displayName="SummaryTotalsLineRow";const ni=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,showRemoveButton:d,emptyState:u,classNames:f})=>{const m=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),m?t.jsx("div",{className:c.cn("flex flex-col gap-4",f.items),children:s.map(x=>t.jsx(Qn,{item:x,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:d},x.id))}):t.jsx("div",{"data-testid":"summary-empty",children:u}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(ti,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn("flex flex-col gap-4",f.totalsRows),children:r.map((x,h)=>t.jsx(Zn,{row:x,locale:i,emphasized:h===0},x.key))})]})};ni.displayName="SummaryBody";const si=({total:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-total",className:c.cn("flex items-center justify-between text-xl 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 text-xl font-semibold leading-7",children:Ye(e.amount,n)})]});si.displayName="SummaryGrandTotalRow";const ai=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,n)})]});ai.displayName="SummarySecondaryTotalRow";const St=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(H,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});St.displayName="SummaryPrimaryCta";const ri=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(R,{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:Ye(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:Ye(s.amount,a)})]})]})]})});ri.displayName="SummaryCollapseHeader";const ii=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(R,{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})]});ii.displayName="SummaryCartButton";const li=({open:e,progress:n,dragging:s,primaryAction:a,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",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(ii,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),a&&t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&t.jsx("div",{children:o})]});li.displayName="SummaryActionBar";const Wu="(max-width: 767px)",Yu=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Gu=(e=Wu)=>{const[n,s]=p.useState(()=>Yu(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},oi=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:m,isOpen:x,onToggleOpen:h,defaultOpen:b=!1,primaryAction:w,isLoading:y=!1,onRemoveItem:j,showRemoveButton:N,ctaCaption:C,variant:v,cart:k,emptyState:L,labels:$,classNames:M={},"data-testid":A="summary",className:I})=>{const F=$?.removeAriaLabel??"Remove item",D=$?.removePostTotalRowAriaLabel??"Remove applied code",T=$?.toggleAriaLabel??"Toggle summary",_=$?.cartAriaLabel??"View cart",G=Gu(),B=m??(v??(G?"mobile":"main"))==="mobile",[X,ee]=p.useState(b),ae=x!==void 0,q=!B||(ae?x:X),Q=p.useCallback(()=>{ae||ee(ge=>!ge),h?.()},[ae,h]),[W,J]=p.useState(0),[re,Z]=p.useState(null),he=p.useRef(null),de=p.useRef(null),$e=p.useCallback(()=>{const ge=he.current;ge&&J(Bu(ge.scrollHeight,window.innerHeight))},[]),Be=p.useCallback(ge=>{de.current?.disconnect(),de.current=null,he.current=ge,ge&&($e(),typeof ResizeObserver<"u"&&(de.current=new ResizeObserver($e),de.current.observe(ge)))},[$e]);p.useEffect(()=>(window.addEventListener("resize",$e),()=>window.removeEventListener("resize",$e)),[$e]);const Ie=qu({open:q,fullHeight:W,setDragHeight:Z,onToggleOpen:Q}),_e=re!==null,Pe=Uu(re,q,W),Ve=W>0?Math.min(1,Math.max(0,Pe/W)):q?1:0,Ee=t.jsx(si,{total:o,locale:a,className:M.total}),te=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(ge=>t.jsx(Zn,{row:ge,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:D,showRemoveButton:N},ge.key))}),xe=f&&t.jsx(ai,{secondaryTotal:f,locale:a,className:M.secondaryTotal}),Me=C!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:C}),mt=t.jsx(ni,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:l,locale:a,onRemoveItem:j,removeAriaLabel:F,showRemoveButton:N,emptyState:L,classNames:M});return B?t.jsxs(Ne.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Ie.onDrag,onDragEnd:Ie.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)]",I,M.base),children:[t.jsx(ri,{title:e,total:o,secondaryTotal:f,locale:a,open:q,progress:Ve,dragging:_e,toggleAriaLabel:T,onToggleOpen:Q,classNames:M}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!q,style:{height:Pe},className:c.cn("min-h-0",q&&!_e?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!q&&"pointer-events-none",Hu(_e)),children:t.jsxs("div",{ref:Be,className:"flex flex-col gap-4 pb-4",children:[mt,t.jsx(c.Divider,{className:"bg-default-200"}),Ee,te,xe]})}),t.jsx(li,{open:q,progress:Ve,dragging:_e,primaryAction:w,isLoading:y,cart:k,cartAriaLabel:_,ctaCaption:Me,onToggleOpen:Q,classNames:M})]}):t.jsxs("section",{"data-testid":A,className:c.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",I,M.base),children:[t.jsx("div",{className:c.cn("flex items-center justify-between",M.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),mt,t.jsx(c.Divider,{className:"bg-default-200"}),Ee,te,xe,f&&w&&t.jsx(c.Divider,{className:"bg-default-200"}),w&&t.jsx(St,{action:w,disabledByLoading:y,className:c.cn("w-full",M.cta)}),Me]})};oi.displayName="Summary";const Ku={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},Qu={backgroundColor:jn.destructive,color:"#fff"},Ws="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",tn="absolute top-0 h-5 w-5 opacity-0",ci=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":x="wizard-shell",children:h})=>{const b={...Ku,...f},w=n.filter(v=>v.state!=="skipped"),y=n.find(v=>v.id===s),j=Math.max(0,w.findIndex(v=>v.id===s)),N=r??e,C=r?b.back:b.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":x,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${x}-header`,children:[N&&t.jsx(H,{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":`${x}-header-back`,startContent:t.jsx(R,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:C}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${x}-header-title`,children:y?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${x}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${x}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(tn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(tn,"left-6"),"data-testid":`${x}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(tn,"left-12"),"data-testid":`${x}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${x}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:pe(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Ws,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Ws,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:b.owesBadge})]}),t.jsx(H,{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"?Qu:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${x}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${x}-stepper`,children:w.map((v,k)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",k<j&&"bg-pos-ok",k===j&&"bg-primary",k>j&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:h}),u]})};ci.displayName="WizardShell";const Zu=(e,n,s)=>Math.min(Math.max(e,n),s);function gn(e,n,s){const a=Math.max(1,Math.trunc(n)),r=Zu(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Ft(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/a),d=l-o*a;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Xu(e,n){return gn(e,n,1)}const Ju=e=>Number.isFinite(e)?e.toFixed(2):"",bn=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),x=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",x?"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??Ju(e),onChange:h=>{const b=h.target.value,w=Number.parseFloat(b.replace(",","."));s!==void 0&&Number.isFinite(w)&&w>s+.004||(f(b),Number.isFinite(w)&&w>=0?a(w):b.trim()===""&&a(0))},onFocus:h=>h.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};bn.displayName="AmountCell";const ef={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"},tf="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",Ys="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",nn="absolute h-5 w-5 opacity-0",nf=e=>{const n=pe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Xu(e.paidAmount,e.quantity);return`${e.quantity} × ${pe(s.value,void 0,s.currency)} · ${n}`},di=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...ef,...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 x=n[m.id],h=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,w=Math.max(1,Math.trunc(m.quantity)),y=x?.quantity,j=x?.selected?Math.min(y??w,w):y??0,N=gn(m.paidAmount,w,j).value,C=x?.amount??(x?.selected?N:0),v=j===0&&C>.004,k=$=>s(m.id,{selected:$.quantity>0||$.amount>.004,mode:"full",...$}),L=$=>{const M=Math.min(Math.max($,0),w);k({quantity:M,amount:gn(m.paidAmount,w,M).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",h&&"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(R,{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??nf(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:[h?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:pe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(bn,{value:C,expected:N,max:m.paidAmount.value,onChange:$=>k({quantity:j,amount:$}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),h?t.jsx("span",{className:tf,"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:Ys,"aria-label":u.decrease.replace("{name}",m.name),disabled:j===0,onClick:()=>L(j-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:j}),t.jsx("button",{type:"button",className:Ys,"aria-label":u.increase.replace("{name}",m.name),disabled:j===w,onClick:()=>L(j+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),j>=w&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(w))}),x?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(R,{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})]}),j>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(Fe,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:$=>{if($==="all")return;const M=[...$][0];M&&(r?.(m.id,M),a(m.id,M==="stock"))},"data-testid":`${b}-restock`,children:f.map($=>t.jsx(c.SelectItem,{children:$.label},$.key))})]})]}),!h&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(nn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:$=>s(m.id,{selected:$,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(nn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>k({quantity:j,amount:N}),className:c.cn(nn,"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(R,{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(R,{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}",pe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(bn,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(R,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};di.displayName="LineItemList";const ui=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});ui.displayName="MetaCard";const fi=({label:e,htmlFor:n,children:s,className:a,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",a),"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:s})]});fi.displayName="MetaCard.Row";const mi=({label:e,children:n,className:s,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});mi.displayName="MetaCard.Section";const sf=Object.assign(ui,{Row:fi,Section:mi}),hi=({heading:e,icon:n="lucide:rotate-ccw",action:s,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(R,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(R,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});hi.displayName="SectionPanel";const xi=({name:e,detail:n,icon:s="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});xi.displayName="CustomerCard";const af={label:"Reason for the return",placeholder:"Select a reason…"},pi=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...af,...r};return t.jsx(Fe,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:n?[n]:[],isInvalid:!!a,errorMessage:a,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&s(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};pi.displayName="ReasonSelect";const rf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},gi=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...rf,...i},[u,f]=p.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(H,{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})]})})};gi.displayName="NotesField";const lf={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"}},of={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Gs="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Xn=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=lf[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(R,{icon:of[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(H,{color:"primary",className:Gs,onPress:a,"data-testid":u,children:r}),t.jsx(H,{variant:"bordered",className:c.cn(Gs,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Xn.displayName="TenderBanner";const cf={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"},df={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},bi=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...cf,...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(Xn,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(R,{icon:df[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:pe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};bi.displayName="TenderMethods";const uf=e=>e.refunded!==null,ff={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"},mf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",hf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",yi=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":x="split-tender-panel"})=>{const h={...ff,...f},b=e.filter(uf),w=e.find(C=>C.tenderId===a.tenderId)?.label,y=!!(r?.length&&a.onTenderChange),j=p.useCallback(C=>{const v=Number.parseFloat(C.replace(",","."));a.onAmountChange(Number.isFinite(v)?v:0)},[a]),N=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:h.title}),l&&t.jsx(Xn,{tone:N?"danger":"warning",title:N?h.declinedTitle:h.networkTitle,body:N?h.partDeclinedBody:h.partNetworkBody,onRetry:l.onRetry,retryLabel:h.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:h.chooseDifferent,className:"mb-[18px]","data-testid":`${x}-part-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{"data-testid":`${x}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:h.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:pe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[h.refundedSoFar,": ",pe(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:mf,children:h.refundedSoFar}),b.map((C,v)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${x}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",v+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(R,{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:pe(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(hf,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?h.pending:h.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${x}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:h.partHeading.replace("{n}",String(b.length+1))}),w&&t.jsx("span",{className:"text-xs text-default-500",children:w})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:h.amountForPart}),t.jsx(Kn,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:j,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),y&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${x}-methods`,children:r?.map(C=>{const v=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":v,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",v?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${x}-method-${C.tenderId}`,children:[C.icon&&t.jsx(R,{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(H,{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":`${x}-back`,children:h.back}),t.jsx(H,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${x}-submit`,children:h.submit})]})]})};yi.displayName="SplitTenderPanel";const xf={label:"Supervisor authorization",placeholder:"••••"},vi=({pin:e,onChange:n,hint:s,error:a,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(R,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${l}-input`})]})};vi.displayName="PinField";const pf={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}"},gf={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},bf="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ks="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",yf="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)]",vf=["email","print"],ji=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const x={...pf,...u},h=n?pe(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:x.processing}),h&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:h})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&yf,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(R,{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:x.title}),h&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:h}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:x.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ks,children:x.destinationsTitle}),s.map((b,w)=>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-${w}-${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:pe(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(bf,gf[b.status]),children:b.status==="succeeded"?x.succeeded:x.pending})]})]},`${b.label}-${w}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ks,children:x.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:vf.map(b=>{const w=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":w,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:w,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:x[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:x.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(H,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:x.done})})]})};ji.displayName="OutcomeView";exports.AdminFieldLabel=_r;exports.AdminTable=$r;exports.AdminTextField=Pr;exports.AdminToolbar=Ar;exports.AppliedCodeCard=ca;exports.Button=H;exports.CashTenderForm=ju;exports.CatalogItemCard=mr;exports.CheckTenderForm=Ur;exports.CommitmentDetails=id;exports.ConfirmDialog=Jr;exports.ConfirmationModal=Rn;exports.ConfirmationPageTemplate=Eo;exports.CustomerCard=xi;exports.DatePicker=En;exports.DimensionChip=qn;exports.DonationAmounts=Ra;exports.EmptyState=Bn;exports.ErrorState=Vn;exports.EventDetails=fc;exports.EventDetailsTemplate=Mo;exports.ExpireCartTimer=za;exports.FeedbackState=et;exports.FilterPopover=gr;exports.Footer=Io;exports.HeroUIProvider=Ji;exports.HorizontalSteps=Ta;exports.InstallmentFundAssignment=td;exports.InstallmentFundAssignmentSkeleton=ad;exports.InstallmentSchedule=wd;exports.InstallmentScheduleSkeleton=Ad;exports.InstallmentTable=Md;exports.ItemCard=fr;exports.KeyValueChip=qn;exports.LineItemList=di;exports.ListPanel=Vr;exports.LoadingOverlay=Zr;exports.LoadingState=Un;exports.MembershipSelectCards=_d;exports.MetaCard=sf;exports.ModalShell=Wr;exports.ModalShellFooter=Gr;exports.ModalShellHeader=Yr;exports.Multiselect=_o;exports.Navbar=Do;exports.NotesField=gi;exports.OfferCard=wt;exports.OfferCardEmpty=Ba;exports.OfferCardError=Va;exports.OfferCardList=Wa;exports.OfferCardSkeleton=Ua;exports.OtherTenderForm=Hr;exports.OutcomeView=ji;exports.PageHeader=yr;exports.PaginationSummary=Br;exports.PaymentCashChangeBanner=Gn;exports.PaymentSubAmountInput=Kn;exports.PaymentSuccessView=Xr;exports.PaymentTotalBanner=Qr;exports.PickerRow=Rr;exports.PinField=vi;exports.RICH_TEXT_PRESETS=Pa;exports.ReasonSelect=pi;exports.RedeemCodeInput=ko;exports.RevenueDistributionCard=ar;exports.RevenueDistributionEmpty=rr;exports.RevenueDistributionError=ir;exports.RevenueDistributionSkeleton=lr;exports.RichTextArea=Oa;exports.RowActions=Or;exports.SectionPanel=hi;exports.Select=Fe;exports.SessionTimeline=br;exports.SplitPaymentSummary=qr;exports.SplitTenderPanel=yi;exports.StatusChip=vr;exports.Stepper=Ma;exports.SuccessState=hr;exports.Summary=oi;exports.TableSkeleton=jr;exports.TenderMethods=bi;exports.TicketSelection=au;exports.TileSelect=Kr;exports.Toggle=xr;exports.ToolbarButton=Dr;exports.UnderlineTabs=Er;exports.WizardShell=ci;exports.adminFieldErrorClass=Ir;exports.adminFieldHintClass=Tr;exports.adminFieldLabelClass=Wn;exports.adminFieldLabelSuffixClass=Yn;exports.adminInputClass=Mr;exports.adminInputReadOnlyClass=Lr;exports.adminInputWrapperClass=Fr;exports.adminRowClass=Cr;exports.adminSurfaceCss=Xi;exports.adminSurfaceTokens=vn;exports.adminTableClass=kr;exports.adminTableFooterClass=Sr;exports.adminTdClass=Nr;exports.adminThClass=wr;exports.calculateAllocationDifference=Hc;exports.computeChange=dn;exports.currencyFractionDigits=Ft;exports.formatMoney=pe;exports.formatOfferCurrency=fn;exports.formatRevenueAmount=zc;exports.formatRevenueCurrency=Bc;exports.generateAutomaticInstallments=dr;exports.generateDistributionId=On;exports.getCurrencySymbol=Vc;exports.offerCardVariants=qa;exports.offerListVariants=Ha;exports.pageRange=zr;exports.parseOfferCurrency=mc;exports.parseRevenueCurrency=Uc;exports.posSurfaceTokens=jn;exports.roundToCurrency=La;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)}})();