@veevarts/design-system 2.1.0-beta.4 → 2.1.0-beta.5

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"),vn=require("@tiptap/react"),ts=require("@tiptap/core"),Si=require("@tiptap/extension-bold"),$i=require("@tiptap/extension-italic"),Ai=require("@tiptap/extension-strike"),Di=require("@tiptap/extension-underline"),Ei=require("@tiptap/extension-code"),Fi=require("@tiptap/extension-color"),Mi=require("@tiptap/extension-highlight"),Li=require("@tiptap/extension-link"),Ti=require("@tiptap/extension-text-style"),Ii=require("@tiptap/extension-heading"),_i=require("@tiptap/extension-paragraph"),Pi=require("@tiptap/extension-bullet-list"),Oi=require("@tiptap/extension-ordered-list"),Ri=require("@tiptap/extension-task-list"),zi=require("@tiptap/extension-task-item"),Bi=require("@tiptap/extension-list-item"),Vi=require("@tiptap/extension-code-block"),Ui=require("@tiptap/extension-blockquote"),Hi=require("@tiptap/extension-horizontal-rule"),qi=require("@tiptap/extension-hard-break"),ns=require("@tiptap/extension-history"),Wi=require("@tiptap/extension-text-align"),Yi=require("@tiptap/extension-document"),Gi=require("@tiptap/extension-text"),Ki=require("@tiptap/extension-dropcursor"),Qi=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"},de={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,Zi=be.palettes.warning[700],Xi=be.palettes.warning[100],ze={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},jn={"--rust":be.brand.primary[500],"--rust-fill":ze.rustFill,"--rust-border":ze.rustBorder,"--page":ze.page,"--surface":be.neutral.white,"--border":ze.border,"--hair":ze.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":be.semantic.success,"--ok-fill":ze.okFill,"--warn":Zi,"--warn-fill":Xi,"--danger":be.semantic.danger,"--danger-fill":ze.dangerFill,"--info":be.semantic.info,"--info-fill":ze.infoFill};Object.fromEntries(Object.entries(jn).map(([e,n])=>[e.replace(/^--/,""),n]));function Ji({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(jn).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"),Y=require("lucide-react"),Ce=require("framer-motion"),jn=require("@tiptap/react"),ns=require("@tiptap/core"),Di=require("@tiptap/extension-bold"),Ei=require("@tiptap/extension-italic"),Fi=require("@tiptap/extension-strike"),Mi=require("@tiptap/extension-underline"),Li=require("@tiptap/extension-code"),Ti=require("@tiptap/extension-color"),Ii=require("@tiptap/extension-highlight"),_i=require("@tiptap/extension-link"),Pi=require("@tiptap/extension-text-style"),Ri=require("@tiptap/extension-heading"),Oi=require("@tiptap/extension-paragraph"),zi=require("@tiptap/extension-bullet-list"),Bi=require("@tiptap/extension-ordered-list"),Vi=require("@tiptap/extension-task-list"),Ui=require("@tiptap/extension-task-item"),Hi=require("@tiptap/extension-list-item"),qi=require("@tiptap/extension-code-block"),Wi=require("@tiptap/extension-blockquote"),Gi=require("@tiptap/extension-horizontal-rule"),Yi=require("@tiptap/extension-hard-break"),ss=require("@tiptap/extension-history"),Ki=require("@tiptap/extension-text-align"),Qi=require("@tiptap/extension-document"),Zi=require("@tiptap/extension-text"),Xi=require("@tiptap/extension-dropcursor"),Ji=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"},de={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,el=be.palettes.warning[700],tl=be.palettes.warning[100],ze={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},wn={"--rust":be.brand.primary[500],"--rust-fill":ze.rustFill,"--rust-border":ze.rustBorder,"--page":ze.page,"--surface":be.neutral.white,"--border":ze.border,"--hair":ze.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":be.semantic.success,"--ok-fill":ze.okFill,"--warn":el,"--warn-fill":tl,"--danger":be.semantic.danger,"--danger-fill":ze.dangerFill,"--info":be.semantic.info,"--info-fill":ze.infoFill};Object.fromEntries(Object.entries(wn).map(([e,n])=>[e.replace(/^--/,""),n]));function nl({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(wn).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 wn={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"};({...wn});function el({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function tl(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(s[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Zs=Object.freeze({left:0,top:0,width:16,height:16}),wt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Nn=Object.freeze({...Zs,...wt}),rn=Object.freeze({...Nn,body:"",hidden:!1});function nl(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=nl(e,n);for(const a in rn)a in wt?a in e&&!(a in s)&&(s[a]=wt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function sl(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=ss(a[l]||r[l],i)}return o(n),s.forEach(o),ss(e,i)}function Xs(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=tl(e);for(const r in a){const i=a[r];i&&(n(r,sl(e,r,i)),s.push(r))}return s}const al={provider:"",aliases:{},not_found:{},...Zs};function Rt(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Js(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Rt(e,al))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Rt(i,rn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!s[o]&&!a[o]||!Rt(i,rn))return null}return n}const as=Object.create(null);function rl(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]=rl(e,n))}function ea(e,n){return Js(n)?Xs(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function il(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const ta=/^[a-z0-9]+(-[a-z0-9]+)*$/,Et=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return n&&!bt(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return n&&!bt(l)?null:l}if(s&&a===""){const l={provider:a,prefix:"",name:i};return n&&!bt(l,s)?null:l}return null},bt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function na(e){return typeof e=="boolean"&&(ct=e),ct}function rs(e){const n=typeof e=="string"?Et(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 ll(e,n){const s=Et(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?il(a,s.name,n):(a.missing.add(s.name),!0)}function ol(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return Js(e)&&(e.prefix="",Xs(e,(i,o)=>{ll(i,o)&&(r=!0)})),r}const s=e.prefix;if(!bt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!ea(a,e)}const sa=Object.freeze({width:null,height:null}),aa=Object.freeze({...sa,...wt}),cl=/(-?[0-9.]*[0-9]+[0-9.]*)/g,dl=/^-?[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(cl);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=dl.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function ul(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:s,content:e}}function fl(e,n){return e?"<defs>"+e+"</defs>"+n:n}function ml(e,n,s){const a=ul(e);return fl(a.defs,n+a.content+s)}const hl=e=>e==="unset"||e==="undefined"||e==="none";function xl(e,n){const s={...Nn,...e},a={...aa,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(w=>{const b=[],j=w.hFlip,N=w.vFlip;let C=w.rotate;j?N?C+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let v;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:v=r.height/2+r.top,b.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,b.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}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)),b.length&&(i=ml(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let m,f;o===null?(f=l===null?"1em":l==="auto"?u:l,m=is(f,d/u)):(m=o==="auto"?d:o,f=l===null?is(m,u/d):l==="auto"?u:l);const x={},h=(w,b)=>{hl(b)||(x[w]=b.toString())};h("width",m),h("height",f);const y=[r.left,r.top,d,u];return x.viewBox=y.join(" "),{attributes:x,viewBox:y,body:i}}const pl=/\sid="(\S+)"/g,gl="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let bl=0;function yl(e,n=gl){const s=[];let a;for(;a=pl.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const o=typeof n=="function"?n(i):n+(bl++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const ln=Object.create(null);function vl(e,n){ln[e]=n}function on(e){return ln[e]||ln[""]}function Cn(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 kn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],yt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?yt.push(tt.shift()):yt.push(tt.pop());kn[""]=Cn({resources:["https://api.iconify.design"].concat(yt)});function jl(e,n){const s=Cn(n);return s===null?!1:(kn[e]=s,!0)}function Sn(e){return kn[e]}const wl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ls=wl();function Nl(e,n){const s=Sn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(o=>{r=Math.max(r,o.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function Cl(e){return e===404}const kl=(e,n,s)=>{const a=[],r=Nl(e,n),i="icons";let o={type:i,provider:e,prefix:n,icons:[]},l=0;return s.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:n,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Sl(e){if(typeof e=="string"){const n=Sn(e);if(n)return n.path}return"/"}const $l=(e,n,s)=>{if(!ls){s("abort",424);return}let a=Sl(n.provider);switch(n.type){case"icons":{const i=n.prefix,l=n.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;ls(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(Cl(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},Al={prepare:kl,send:$l};function ra(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Dl(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),o.pending.length!==l&&(s||ra([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let El=0;function Fl(e,n,s){const a=El++,r=ra.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Ml(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[o]||(d[o]=Xe(i,o));let m;l in u.icons?m=n.loaded:o===""||u.missing.has(l)?m=n.missing:m=n.pending;const f={provider:i,prefix:o,name:l};m.push(f)}),n}function Ll(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Et(r,n,s):r;i&&a.push(i)}),a}const Tl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Il(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let L=e.resources.slice(0);for(o=[];L.length>1;){const $=Math.floor(Math.random()*L.length);o.push(L[$]),L=L.slice(0,$).concat(L.slice($+1))}o=o.concat(L)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,m,f=null,x=[],h=[];typeof a=="function"&&h.push(a);function y(){f&&(clearTimeout(f),f=null)}function w(){d==="pending"&&(d="aborted"),y(),x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function b(L,$){$&&(h=[]),typeof L=="function"&&h.push(L)}function j(){return{startTime:l,payload:n,status:d,queriesSent:u,queriesPending:x.length,subscribe:b,abort:w}}function N(){d="failed",h.forEach(L=>{L(void 0,m)})}function C(){x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function v(L,$,M){const E=$!=="success";switch(x=x.filter(I=>I!==L),d){case"pending":break;case"failed":if(E||!e.dataAfterTimeout)return;break;default:return}if($==="abort"){m=M,N();return}if(E){m=M,x.length||(o.length?k():N());return}if(y(),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;y();const L=o.shift();if(L===void 0){if(x.length){f=setTimeout(()=>{y(),d==="pending"&&(C(),N())},e.timeout);return}N();return}const $={status:"pending",resource:L,callback:(M,E)=>{v($,M,E)}};x.push($),u++,f=setTimeout(k,e.rotate),s(L,n,$.callback)}return setTimeout(k),j}function ia(e){const n={...Tl,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,d,u){const m=Il(n,l,d,(f,x)=>{a(),u&&u(f,x)});return s.push(m),m}function i(l){return s.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{n.index=l},getIndex:()=>n.index,cleanup:a}}function os(){}const zt=Object.create(null);function _l(e){if(!zt[e]){const n=Sn(e);if(!n)return;const s=ia(n),a={config:n,redundancy:s};zt[e]=a}return zt[e]}function Pl(e,n,s){let a,r;if(typeof e=="string"){const i=on(e);if(!i)return s(void 0,424),os;r=i.send;const o=_l(e);o&&(a=o.redundancy)}else{const i=Cn(e);if(i){a=ia(i);const o=e.resources?e.resources[0]:"",l=on(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),os):a.query(n,r,s)().abort}function cs(){}function Ol(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Dl(e)}))}function Rl(e){const n=[],s=[];return e.forEach(a=>{(a.match(ta)?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(!ea(e,s).length){a();return}}catch(r){console.error(r)}a(),Ol(e)}function ds(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function zl(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),m=>{nt(e,r,m)});return}if(i){r.forEach(m=>{const f=i(m,a,s);ds(f,x=>{const h=x?{prefix:a,icons:{[m]:x}}:null;nt(e,[m],h)})});return}const{valid:o,invalid:l}=Rl(r);if(l.length&&nt(e,l,null),!o.length)return;const d=a.match(ta)?on(s):null;if(!d){nt(e,o,null);return}d.prepare(s,a,o).forEach(m=>{Pl(s,m,f=>{nt(e,m.icons,f)})})}))}const Bl=(e,n)=>{const s=Ll(e,!0,na()),a=Ml(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 o,l;return a.pending.forEach(d=>{const{provider:u,prefix:m}=d;if(m===l&&u===o)return;o=u,l=m,i.push(Xe(u,m));const f=r[u]||(r[u]=Object.create(null));f[m]||(f[m]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:m,name:f}=d,x=Xe(u,m),h=x.pendingIcons||(x.pendingIcons=new Set);h.has(f)||(h.add(f),r[u][m].push(f))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&zl(d,u)}),n?Fl(n,a,i):cs};function Vl(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in sa?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Ul=/[\s,]+/;function Hl(e,n){n.split(Ul).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function ql(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 Wl(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 Yl(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Gl(e){return"data:image/svg+xml,"+Yl(e)}function Kl(e){return'url("'+Gl(e)+'")'}let it;function Ql(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Zl(e){return it===void 0&&Ql(),it?it.createHTML(e):e}const la={...aa,inline:!1},Xl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Jl={display:"inline-block"},cn={backgroundColor:"currentColor"},oa={backgroundColor:"transparent"},us={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},fs={WebkitMask:cn,mask:cn,background:oa};for(const e in fs){const n=fs[e];for(const s in us)n[e+s]=us[s]}const eo={...la,inline:!0};function ms(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const to=(e,n,s)=>{const a=n.inline?eo:la,r=Vl(a,n),i=n.mode||"svg",o={},l=n.style||{},d={...i==="svg"?Xl:{}};if(s){const b=Et(s,!1,!0);if(b){const j=["iconify"],N=["provider","prefix"];for(const C of N)b[C]&&j.push("iconify--"+b[C]);d.className=j.join(" ")}}for(let b in n){const j=n[b];if(j!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=j;break;case"className":d[b]=(d[b]?d[b]+" ":"")+j;break;case"inline":case"hFlip":case"vFlip":r[b]=j===!0||j==="true"||j===1;break;case"flip":typeof j=="string"&&Hl(r,j);break;case"color":o.color=j;break;case"rotate":typeof j=="string"?r[b]=ql(j):typeof j=="number"&&(r[b]=j);break;case"ariaHidden":case"aria-hidden":j!==!0&&j!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=j)}}const u=xl(e,r),m=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,m);let b=0,j=n.id;return typeof j=="string"&&(j=j.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Zl(yl(u.body,j?()=>j+"ID"+b++:"iconifyReact"))},p.createElement("svg",d)}const{body:f,width:x,height:h}=e,y=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),w=Wl(f,{...m,width:x+"",height:h+""});return d.style={...o,"--svg":Kl(w),width:ms(m.width),height:ms(m.height),...Jl,...y?cn:oa,...l},p.createElement("span",d)};na(!0);vl("",Al);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"||!ol(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;jl(s,r)||console.error(a)}catch{console.error(a)}}}}function ca(e){const[n,s]=p.useState(!!e.ssr),[a,r]=p.useState({});function i(h){if(h){const y=e.icon;if(typeof y=="object")return{name:"",data:y};const w=rs(y);if(w)return{name:y,data:w}}return{name:""}}const[o,l]=p.useState(i(!!e.ssr));function d(){const h=a.callback;h&&(h(),r({}))}function u(h){if(JSON.stringify(o)!==JSON.stringify(h))return d(),l(h),!0}function m(){var h;const y=e.icon;if(typeof y=="object"){u({name:"",data:y});return}const w=rs(y);if(u({name:y,data:w}))if(w===void 0){const b=Bl([y],m);r({callback:b})}else w&&((h=e.onLoad)===null||h===void 0||h.call(e,y))}p.useEffect(()=>(s(!0),d),[]),p.useEffect(()=>{n&&m()},[e.icon,n]);const{name:f,data:x}=o;return x?to({...Nn,...x},e,f):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const R=p.forwardRef((e,n)=>ca({...e,_ref:n}));p.forwardRef((e,n)=>ca({inline:!0,...e,_ref:n}));const B=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}));B.displayName="Button";function da({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(B,{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 Bt(e,n){return e-n*Math.floor(e/n)}const ua=1721426;function xt(e,n,s,a){n=$n(e,n);let r=n-1,i=-2;return s<=2?i=0:vt(n)&&(i=-1),ua-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function vt(e){return e%4===0&&(e%100!==0||e%400===0)}function $n(e,n){return e==="BC"?1-n:n}function no(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const so={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 Ft{fromJulianDay(n){let s=n,a=s-ua,r=Math.floor(a/146097),i=Bt(a,146097),o=Math.floor(i/36524),l=Bt(i,36524),d=Math.floor(l/1461),u=Bt(l,1461),m=Math.floor(u/365),f=r*400+o*100+d*4+m+(o!==4&&m!==4?1:0),[x,h]=no(f),y=s-xt(x,h,1,1),w=2;s<xt(x,h,3,1)?w=0:vt(h)&&(w=1);let b=Math.floor(((y+w)*12+373)/367),j=s-xt(x,h,b,1)+1;return new dt(x,h,b,j)}toJulianDay(n){return xt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return so[vt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return vt(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 ao(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 fa(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function ma(e,n){return hs(e)-hs(n)}function hs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Vt=null;function ha(){return Vt==null&&(Vt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Vt}function xs(e){e=An(e,new Ft);let n=$n(e.era,e.year);return xa(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function xa(e,n,s,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,n-1,s),l.getTime()}function ps(e,n){if(n==="UTC")return 0;if(e>0&&n===ha())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=pa(e,n);return xa(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const gs=new Map;function pa(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 ro(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>io(e,n,i))}function io(e,n,s){let a=pa(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 lo(e,n,s="compatible"){let a=ba(e);if(n==="UTC")return xs(a);if(n===ha()&&s==="compatible"){a=An(a,new Ft);let d=new Date,u=$n(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),o=ps(r+bs,n),l=ro(a,n,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(s){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function ga(e,n,s="compatible"){return new Date(lo(e,n,s))}function ba(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 Nt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function An(e,n){if(ao(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 Dn(e,n){let s=e.copy(),a="hour"in s?ka(s,n):0;dn(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,un(s),ya(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,oo(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,o;let d=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let l=s.calendar.getMonthsInYear(s);return s.month>l&&(s.month=l,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function dn(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function un(e){for(;e.month<1;)dn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,dn(e,1)}function oo(e){for(;e.day<1;)e.month--,un(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,un(e)}function ya(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)),ya(e)}function va(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function ja(e,n){return Dn(e,va(n))}function wa(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 Na(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),Ca(s),s}function co(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 Ca(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 ka(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,co(e)}function Sa(e,n){let s=e.copy();return ka(s,n),s}function uo(e,n){return Sa(e,va(n))}function $a(e,n,s,a){let r=e.copy();switch(n){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=Be(d,s,0,l.length-1,a?.round),r.era=l[d],Je(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,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 Aa(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=Be(i,s,o,l,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 fo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,mo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function ho(e){let n=e.match(fo);if(!n)throw mo.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(Ut(n[1],0,9999),Ut(n[2],1,12),1);return s.day=Ut(n[3],1,s.calendar.getDaysInMonth(s)),s}function Ut(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 Da(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 Ea(e){let n=An(e,new Ft),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 xo(e){return`${Ea(e)}T${Da(e)}`}function po(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function En(e,n,s){po(e,n),n.set(e,s)}function Fa(e){let n=typeof e[0]=="object"?e.shift():new Ft,s;if(typeof e[0]=="string")s=e.shift();else{let o=n.getEras();s=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var go=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 Dn(this,n)}subtract(n){return ja(this,n)}set(n){return wa(this,n)}cycle(n,s,a){return $a(this,n,s,a)}toDate(n){return ga(this,n)}toString(){return Ea(this)}compare(n){return fa(this,n)}constructor(...n){En(this,go,{writable:!0,value:void 0});let[s,a,r,i,o]=Fa(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Je(this)}}var bo=new WeakMap;class Mt{copy(){return new Mt(this.hour,this.minute,this.second,this.millisecond)}add(n){return Sa(this,n)}subtract(n){return uo(this,n)}set(n){return Na(this,n)}cycle(n,s,a){return Aa(this,n,s,a)}toString(){return Da(this)}compare(n){return ma(this,n)}constructor(n=0,s=0,a=0,r=0){En(this,bo,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,Ca(this)}}var yo=new WeakMap;class Nt{copy(){return this.era?new Nt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Nt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return Dn(this,n)}subtract(n){return ja(this,n)}set(n){return wa(Na(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return $a(this,n,s,a);default:return Aa(this,n,s,a)}}toDate(n,s){return ga(this,n,s)}toString(){return xo(this)}compare(n){let s=fa(this,n);return s===0?ma(this,ba(n)):s}constructor(...n){En(this,yo,{writable:!0,value:void 0});let[s,a,r,i,o]=Fa(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Je(this)}}const vo="Open time options",jo=320;function ys(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Ht(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 Mt(n,s,a)}function wo(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 No(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new Mt(s,a));return n}function Co(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=vo,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...m}=e,f=l!==void 0,[x,h]=p.useState(()=>Ht(d)),y=f?Ht(l):x,w=p.useMemo(()=>No(n),[n]),b=N=>{f||h(N),o?.(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(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:w.map(N=>{const C=y?.hour===N.hour&&y?.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:()=>b(N),children:wo(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...m,value:f?y:void 0,defaultValue:f?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,j]}),onChange:N=>b(Ht(N))})}function Fn(e){if(e.mode==="time")return t.jsx(Co,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=jo,disableAnimation:d=!0,classNames:u,...m}=e;return t.jsx(c.DatePicker,{...m,calendarWidth:l,classNames:{...u,popoverContent:ys("min-w-[20rem]",u?.popoverContent),calendarContent:ys("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function ko(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Le=p.forwardRef(({popoverProps:e,...n},s)=>{const a=p.useRef(null),[r,i]=p.useState(void 0),o={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(ko(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:o})})});Le.displayName="Select";function So({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[m,f]=p.useState(""),x=p.useId(),[h,y]=p.useState(e);e!==h&&(y(e),e==="applied"&&f(""));const w=()=>{const N=m.trim();N&&n(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),w())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(da,{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:o,value:m,onValueChange:f,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":j?x:void 0}),t.jsx(B,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!m.trim(),onPress:w,children:l})]}),j&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const $o={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Ao({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(Le,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(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(Le,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||n;s?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(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 Do({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(B,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress: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(B,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Eo({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:m}){const f={...$o,...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",m),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||n.length>0)&&t.jsx(Ao,{languages:n,selectedLanguage:s,onLanguageChange:a,label:f.selectLanguage}),d&&t.jsx(Do,{isLoggedIn:r,onLogin:i,onLogout:o,labels:f})]})]})}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, 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 qt;const Mo=typeof document<"u"?(qt=p.useInsertionEffect)!==null&&qt!==void 0?qt:p.useLayoutEffect:()=>{};function Lt(e,n,s){let[a,r]=p.useState(e||n),i=p.useRef(a),o=p.useRef(e!==void 0),l=e!==void 0;p.useEffect(()=>{let f=o.current;f!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;Mo(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),m=p.useCallback((f,...x)=>{let h=typeof f=="function"?f(i.current):f;Object.is(i.current,h)||(i.current=h,r(h),u(),s?.(h,...x))},[s]);return[d,m]}function Ma(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 La=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:m="compact",stepCounterFormat:f,onStepChange:x,currentStep:h,hideProgressBars:y=!1,stepClassName:w,className:b,isDisabled:j=!1,...N},C)=>{const[v,k]=Lt(h,a,x),L=p.useMemo(()=>{let $,M;const E=["[--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 E.unshift(M),E.unshift($),E},[e]);return t.jsxs("nav",{ref:C,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",m==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:f?f(v+1,s):`Step ${v+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",L,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map(($,M)=>{const E=v===M?"active":v<M?"inactive":"complete",I=n==="activeLabel"&&E==="active"&&!!i?.[M],A=o&&E!=="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:A?i?.[M]:void 0,isDisabled:!A,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":E==="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(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:E,className:"relative z-10",children:t.jsx(Ce.m.div,{animate:E,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)":E==="complete","shadow-lg":E==="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:E==="complete"&&n==="default"?t.jsx(Ma,{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&&!y&&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:f?f(v+1,s):`Step ${v+1} of ${s}`}):null]})});La.displayName="Stepper";function Lo(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 Tt(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 Ta(e,n,s="en-US"){const a=Tt(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function fn(e,n,s,a){return Ta(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))"}},To="rgb(156 163 175)",Io="rgb(107 114 128)",Ia=p.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=To,inactiveLabelColor:m=Io,activeStepVariant:f="bordered",stepClassName:x,circleClassName:h,progressBarClassName:y,labelsClassName:w,labelSlotClassName:b,activeLabelClassName:j,inactiveLabelClassName:N,className:C,ariaLabel:v="Progress",invalidLabelSuffix:k=", has errors",testId:L,isStepReachable:$,...M},E){const[I,A]=Lt(i,a,r),D=vs[n]??vs.primary,T=l??D.active,_=d??D.fg,Y=(V,U)=>{const J=V.ariaLabel??(typeof V.title=="string"?V.title:null)??`${U+1}`;return V.invalid?`${J}${k}`:J};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((V,U)=>{const Z=U===I?"active":U<I?"complete":"inactive",J=$?$(U):!0;return t.jsxs(p.Fragment,{children:[t.jsx(B,{ref:E,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${L??"horizontal-steps"}-step-${U}`,"aria-current":Z==="active"?"step":void 0,"aria-describedby":V.describedBy,"aria-label":Y(V,U),"data-invalid":V.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",V.className,x),onPress:()=>{if(i===void 0){A(U);return}r?.(U)},children:t.jsx(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:Z,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:f==="solid"?T:"transparent",borderColor:T,borderWidth:"1.5px",color:f==="solid"?_:T},complete:{backgroundColor:T,borderColor:T,borderWidth:"1.5px",color:T}},children:Z==="complete"?t.jsx(Ma,{className:"size-4",style:{color:_}}):t.jsx("span",{children:U+1})})})}),U<s.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",y),style:{backgroundColor:U<I?T:u}})]},U)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",w),children:s?.map((V,U)=>{const Z=U<=I;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",Z?j:N),style:{color:Z?T:m},children:V.title})}),U<s.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",y)})]},U)})})]})});Ia.displayName="HorizontalSteps";function _o(){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 Po=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Oo,{...e},n)},Oo=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,o]=p.useState([]),[l,d]=p.useState([]),[u,m]=p.useState(null),[f,x]=p.useState(null),h=p.useMemo(()=>new Set(n),[n]),y=p.useMemo(()=>new Set(e),[e]),w=p.useMemo(()=>e.filter(A=>!h.has(A)),[e,h]),b=A=>{if(A.length===0)return;const D=Array.from(new Set([...n,...A]));s(D)},j=A=>{if(A.length===0)return;const D=new Set(A);s(n.filter(T=>!D.has(T)))},N=()=>{i.length!==0&&(b(i),o([]))},C=()=>{l.length!==0&&(j(l),d([]))},v=()=>{w.length!==0&&(b(w),o([]))},k=()=>{n.length!==0&&(s([]),d([]))},L=(A,D,T)=>{const _=Math.min(D,T),Y=Math.max(D,T);return A.slice(_,Y+1)},$=(A,D,T)=>{if(T&&u!==null){o(L(w,u,D)),d([]),m(D);return}const _=i.includes(A);o(_?i.filter(Y=>Y!==A):[...i,A]),d([]),m(D)},M=(A,D,T)=>{if(T&&f!==null){d(L(n,f,D)),o([]),x(D);return}const _=l.includes(A);d(_?l.filter(Y=>Y!==A):[...l,A]),o([]),x(D)},E=(A,D,T)=>{const _=T==="available"?i.includes(D)?i:[D]:l.includes(D)?l:[D];A.dataTransfer.setData("text/plain",JSON.stringify({source:T,items:_})),A.dataTransfer.effectAllowed="move"},I=(A,D)=>{A.preventDefault();const T=A.dataTransfer.getData("text/plain");if(T)try{const _=JSON.parse(T),Y=(_.items||[]).filter(V=>y.has(V));if(Y.length===0||_.source===D)return;D==="selected"?(b(Y),o([])):(j(Y),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:A=>A.preventDefault(),onDrop:A=>I(A,"available"),children:w.map((A,D)=>{const T=i.includes(A);return t.jsx("button",{type:"button",onClick:_=>{$(A,D,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>E(_,A,"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:A},A)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:C,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:v,isDisabled:w.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(B,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress: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:A=>A.preventDefault(),onDrop:A=>I(A,"selected"),children:n.map((A,D)=>{const T=l.includes(A);return t.jsx("button",{type:"button",onClick:_=>{M(A,D,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>E(_,A,"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:A},A)})})})]})]})};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:o=16,className:l}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:l,children:t.jsx(e,{size:o})})})}const _e={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"}},Ro={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function zo({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=_e.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{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(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(G.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Ro[o]},o))})]})}const Wt={bulletList:{label:"Bullet List",icon:G.List},orderedList:{label:"Numbered List",icon:G.ListOrdered},taskList:{label:"Task List",icon:G.ListTodo}};function Bo({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive(l)),i=r?Wt[r].icon:G.List,o=l=>{const u=_e[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:n.map(l=>{const d=Wt[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Wt[l].label},l)})})]})}function Vo({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 Nn={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"};({...Nn});function sl({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function al(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 ea=Object.freeze({left:0,top:0,width:16,height:16}),wt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Cn=Object.freeze({...ea,...wt}),ln=Object.freeze({...Cn,body:"",hidden:!1});function rl(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 as(e,n){const s=rl(e,n);for(const a in ln)a in wt?a in e&&!(a in s)&&(s[a]=wt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function il(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=as(a[o]||r[o],i)}return l(n),s.forEach(l),as(e,i)}function ta(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=al(e);for(const r in a){const i=a[r];i&&(n(r,il(e,r,i)),s.push(r))}return s}const ll={provider:"",aliases:{},not_found:{},...ea};function Ot(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function na(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Ot(e,ll))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Ot(i,ln))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]||!Ot(i,ln))return null}return n}const rs=Object.create(null);function ol(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Xe(e,n){const s=rs[e]||(rs[e]=Object.create(null));return s[n]||(s[n]=ol(e,n))}function sa(e,n){return na(n)?ta(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function cl(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const aa=/^[a-z0-9]+(-[a-z0-9]+)*$/,Et=(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&&!bt(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&&!bt(o)?null:o}if(s&&a===""){const o={provider:a,prefix:"",name:i};return n&&!bt(o,s)?null:o}return null},bt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function ra(e){return typeof e=="boolean"&&(ct=e),ct}function is(e){const n=typeof e=="string"?Et(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 dl(e,n){const s=Et(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?cl(a,s.name,n):(a.missing.add(s.name),!0)}function ul(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return na(e)&&(e.prefix="",ta(e,(i,l)=>{dl(i,l)&&(r=!0)})),r}const s=e.prefix;if(!bt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!sa(a,e)}const ia=Object.freeze({width:null,height:null}),la=Object.freeze({...ia,...wt}),fl=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ml=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ls(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(fl);if(a===null||!a.length)return e;const r=[];let i=a.shift(),l=ml.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 hl(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 xl(e,n){return e?"<defs>"+e+"</defs>"+n:n}function pl(e,n,s){const a=hl(e);return xl(a.defs,n+a.content+s)}const gl=e=>e==="unset"||e==="undefined"||e==="none";function bl(e,n){const s={...Cn,...e},a={...la,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(j=>{const b=[],w=j.hFlip,N=j.vFlip;let C=j.rotate;w?N?C+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let v;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:v=r.height/2+r.top,b.unshift("rotate(90 "+v.toString()+" "+v.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:v=r.width/2+r.left,b.unshift("rotate(-90 "+v.toString()+" "+v.toString()+")");break}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)),b.length&&(i=pl(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const l=a.width,o=a.height,d=r.width,u=r.height;let h,f;l===null?(f=o===null?"1em":o==="auto"?u:o,h=ls(f,d/u)):(h=l==="auto"?d:l,f=o===null?ls(h,u/d):o==="auto"?u:o);const x={},m=(j,b)=>{gl(b)||(x[j]=b.toString())};m("width",h),m("height",f);const g=[r.left,r.top,d,u];return x.viewBox=g.join(" "),{attributes:x,viewBox:g,body:i}}const yl=/\sid="(\S+)"/g,vl="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let jl=0;function wl(e,n=vl){const s=[];let a;for(;a=yl.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+(jl++).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 on=Object.create(null);function Nl(e,n){on[e]=n}function cn(e){return on[e]||on[""]}function kn(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 Sn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],yt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?yt.push(tt.shift()):yt.push(tt.pop());Sn[""]=kn({resources:["https://api.iconify.design"].concat(yt)});function Cl(e,n){const s=kn(n);return s===null?!1:(Sn[e]=s,!0)}function $n(e){return Sn[e]}const kl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let os=kl();function Sl(e,n){const s=$n(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 $l(e){return e===404}const Al=(e,n,s)=>{const a=[],r=Sl(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 Dl(e){if(typeof e=="string"){const n=$n(e);if(n)return n.path}return"/"}const El=(e,n,s)=>{if(!os){s("abort",424);return}let a=Dl(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;os(e+a).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{s($l(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)})},Fl={prepare:Al,send:El};function oa(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Ml(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||oa([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Ll=0;function Tl(e,n,s){const a=Ll++,r=oa.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 Il(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 h;o in u.icons?h=n.loaded:l===""||u.missing.has(o)?h=n.missing:h=n.pending;const f={provider:i,prefix:l,name:o};h.push(f)}),n}function _l(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Et(r,n,s):r;i&&a.push(i)}),a}const Pl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Rl(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 A=Math.floor(Math.random()*L.length);l.push(L[A]),L=L.slice(0,A).concat(L.slice(A+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,h,f=null,x=[],m=[];typeof a=="function"&&m.push(a);function g(){f&&(clearTimeout(f),f=null)}function j(){d==="pending"&&(d="aborted"),g(),x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function b(L,A){A&&(m=[]),typeof L=="function"&&m.push(L)}function w(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:x.length,subscribe:b,abort:j}}function N(){d="failed",m.forEach(L=>{L(void 0,h)})}function C(){x.forEach(L=>{L.status==="pending"&&(L.status="aborted")}),x=[]}function v(L,A,k){const E=A!=="success";switch(x=x.filter(I=>I!==L),d){case"pending":break;case"failed":if(E||!e.dataAfterTimeout)return;break;default:return}if(A==="abort"){h=k,N();return}if(E){h=k,x.length||(l.length?S():N());return}if(g(),C(),!e.random){const I=e.resources.indexOf(L.resource);I!==-1&&I!==e.index&&(e.index=I)}d="completed",m.forEach(I=>{I(k)})}function S(){if(d!=="pending")return;g();const L=l.shift();if(L===void 0){if(x.length){f=setTimeout(()=>{g(),d==="pending"&&(C(),N())},e.timeout);return}N();return}const A={status:"pending",resource:L,callback:(k,E)=>{v(A,k,E)}};x.push(A),u++,f=setTimeout(S,e.rotate),s(L,n,A.callback)}return setTimeout(S),w}function ca(e){const n={...Pl,...e};let s=[];function a(){s=s.filter(o=>o().status==="pending")}function r(o,d,u){const h=Rl(n,o,d,(f,x)=>{a(),u&&u(f,x)});return s.push(h),h}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 cs(){}const zt=Object.create(null);function Ol(e){if(!zt[e]){const n=$n(e);if(!n)return;const s=ca(n),a={config:n,redundancy:s};zt[e]=a}return zt[e]}function zl(e,n,s){let a,r;if(typeof e=="string"){const i=cn(e);if(!i)return s(void 0,424),cs;r=i.send;const l=Ol(e);l&&(a=l.redundancy)}else{const i=kn(e);if(i){a=ca(i);const l=e.resources?e.resources[0]:"",o=cn(l);o&&(r=o.send)}}return!a||!r?(s(void 0,424),cs):a.query(n,r,s)().abort}function ds(){}function Bl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ml(e)}))}function Vl(e){const n=[],s=[];return e.forEach(a=>{(a.match(aa)?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(!sa(e,s).length){a();return}}catch(r){console.error(r)}a(),Bl(e)}function us(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Ul(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)){us(e.loadIcons(r,a,s),h=>{nt(e,r,h)});return}if(i){r.forEach(h=>{const f=i(h,a,s);us(f,x=>{const m=x?{prefix:a,icons:{[h]:x}}:null;nt(e,[h],m)})});return}const{valid:l,invalid:o}=Vl(r);if(o.length&&nt(e,o,null),!l.length)return;const d=a.match(aa)?cn(s):null;if(!d){nt(e,l,null);return}d.prepare(s,a,l).forEach(h=>{zl(s,h,f=>{nt(e,h.icons,f)})})}))}const Hl=(e,n)=>{const s=_l(e,!0,ra()),a=Il(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ds)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return a.pending.forEach(d=>{const{provider:u,prefix:h}=d;if(h===o&&u===l)return;l=u,o=h,i.push(Xe(u,h));const f=r[u]||(r[u]=Object.create(null));f[h]||(f[h]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:h,name:f}=d,x=Xe(u,h),m=x.pendingIcons||(x.pendingIcons=new Set);m.has(f)||(m.add(f),r[u][h].push(f))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Ul(d,u)}),n?Tl(n,a,i):ds};function ql(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in ia?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Wl=/[\s,]+/;function Gl(e,n){n.split(Wl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Yl(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 Kl(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 Zl(e){return"data:image/svg+xml,"+Ql(e)}function Xl(e){return'url("'+Zl(e)+'")'}let it;function Jl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function eo(e){return it===void 0&&Jl(),it?it.createHTML(e):e}const da={...la,inline:!1},to={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},no={display:"inline-block"},dn={backgroundColor:"currentColor"},ua={backgroundColor:"transparent"},fs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ms={WebkitMask:dn,mask:dn,background:ua};for(const e in ms){const n=ms[e];for(const s in fs)n[e+s]=fs[s]}const so={...da,inline:!0};function hs(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const ao=(e,n,s)=>{const a=n.inline?so:da,r=ql(a,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?to:{}};if(s){const b=Et(s,!1,!0);if(b){const w=["iconify"],N=["provider","prefix"];for(const C of N)b[C]&&w.push("iconify--"+b[C]);d.className=w.join(" ")}}for(let b in n){const w=n[b];if(w!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=w;break;case"className":d[b]=(d[b]?d[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&Gl(r,w);break;case"color":l.color=w;break;case"rotate":typeof w=="string"?r[b]=Yl(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=w)}}const u=bl(e,r),h=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,h);let b=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:eo(wl(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},p.createElement("svg",d)}const{body:f,width:x,height:m}=e,g=i==="mask"||(i==="bg"?!1:f.indexOf("currentColor")!==-1),j=Kl(f,{...h,width:x+"",height:m+""});return d.style={...l,"--svg":Xl(j),width:hs(h.width),height:hs(h.height),...no,...g?dn:ua,...o},p.createElement("span",d)};ra(!0);Nl("",Fl);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"||!ul(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;Cl(s,r)||console.error(a)}catch{console.error(a)}}}}function fa(e){const[n,s]=p.useState(!!e.ssr),[a,r]=p.useState({});function i(m){if(m){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const j=is(g);if(j)return{name:g,data:j}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const m=a.callback;m&&(m(),r({}))}function u(m){if(JSON.stringify(l)!==JSON.stringify(m))return d(),o(m),!0}function h(){var m;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const j=is(g);if(u({name:g,data:j}))if(j===void 0){const b=Hl([g],h);r({callback:b})}else j&&((m=e.onLoad)===null||m===void 0||m.call(e,g))}p.useEffect(()=>(s(!0),d),[]),p.useEffect(()=>{n&&h()},[e.icon,n]);const{name:f,data:x}=l;return x?ao({...Cn,...x},e,f):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const O=p.forwardRef((e,n)=>fa({...e,_ref:n}));p.forwardRef((e,n)=>fa({inline:!0,...e,_ref:n}));const z=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}));z.displayName="Button";function ma({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(z,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(O,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Bt(e,n){return e-n*Math.floor(e/n)}const ha=1721426;function xt(e,n,s,a){n=An(e,n);let r=n-1,i=-2;return s<=2?i=0:vt(n)&&(i=-1),ha-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function vt(e){return e%4===0&&(e%100!==0||e%400===0)}function An(e,n){return e==="BC"?1-n:n}function ro(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const io={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 Ft{fromJulianDay(n){let s=n,a=s-ha,r=Math.floor(a/146097),i=Bt(a,146097),l=Math.floor(i/36524),o=Bt(i,36524),d=Math.floor(o/1461),u=Bt(o,1461),h=Math.floor(u/365),f=r*400+l*100+d*4+h+(l!==4&&h!==4?1:0),[x,m]=ro(f),g=s-xt(x,m,1,1),j=2;s<xt(x,m,3,1)?j=0:vt(m)&&(j=1);let b=Math.floor(((g+j)*12+373)/367),w=s-xt(x,m,b,1)+1;return new dt(x,m,b,w)}toJulianDay(n){return xt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return io[vt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return vt(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 lo(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 xa(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function pa(e,n){return xs(e)-xs(n)}function xs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Vt=null;function ga(){return Vt==null&&(Vt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Vt}function ps(e){e=Dn(e,new Ft);let n=An(e.era,e.year);return ba(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ba(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 gs(e,n){if(n==="UTC")return 0;if(e>0&&n===ga())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:l,second:o}=ya(e,n);return ba(s,a,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const bs=new Map;function ya(e,n){let s=bs.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"}),bs.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 ys=864e5;function oo(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>co(e,n,i))}function co(e,n,s){let a=ya(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 uo(e,n,s="compatible"){let a=ja(e);if(n==="UTC")return ps(a);if(n===ga()&&s==="compatible"){a=Dn(a,new Ft);let d=new Date,u=An(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=ps(a),i=gs(r-ys,n),l=gs(r+ys,n),o=oo(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 va(e,n,s="compatible"){return new Date(uo(e,n,s))}function ja(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 Nt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function Dn(e,n){if(lo(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 En(e,n){let s=e.copy(),a="hour"in s?Aa(s,n):0;un(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,fn(s),wa(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,fo(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 un(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function fn(e){for(;e.month<1;)un(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,un(e,1)}function fo(e){for(;e.day<1;)e.month--,fn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,fn(e)}function wa(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)),wa(e)}function Na(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function Ca(e,n){return En(e,Na(n))}function ka(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 Sa(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),$a(s),s}function mo(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 $a(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 Aa(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,mo(e)}function Da(e,n){let s=e.copy();return Aa(s,n),s}function ho(e,n){return Da(e,Na(n))}function Ea(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 Fa(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 xo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,po=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function go(e){let n=e.match(xo);if(!n)throw po.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(Ut(n[1],0,9999),Ut(n[2],1,12),1);return s.day=Ut(n[3],1,s.calendar.getDaysInMonth(s)),s}function Ut(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 Ma(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 La(e){let n=Dn(e,new Ft),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 bo(e){return`${La(e)}T${Ma(e)}`}function yo(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fn(e,n,s){yo(e,n),n.set(e,s)}function Ta(e){let n=typeof e[0]=="object"?e.shift():new Ft,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 vo=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 En(this,n)}subtract(n){return Ca(this,n)}set(n){return ka(this,n)}cycle(n,s,a){return Ea(this,n,s,a)}toDate(n){return va(this,n)}toString(){return La(this)}compare(n){return xa(this,n)}constructor(...n){Fn(this,vo,{writable:!0,value:void 0});let[s,a,r,i,l]=Ta(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,Je(this)}}var jo=new WeakMap;class Mt{copy(){return new Mt(this.hour,this.minute,this.second,this.millisecond)}add(n){return Da(this,n)}subtract(n){return ho(this,n)}set(n){return Sa(this,n)}cycle(n,s,a){return Fa(this,n,s,a)}toString(){return Ma(this)}compare(n){return pa(this,n)}constructor(n=0,s=0,a=0,r=0){Fn(this,jo,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,$a(this)}}var wo=new WeakMap;class Nt{copy(){return this.era?new Nt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Nt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return En(this,n)}subtract(n){return Ca(this,n)}set(n){return ka(Sa(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Ea(this,n,s,a);default:return Fa(this,n,s,a)}}toDate(n,s){return va(this,n,s)}toString(){return bo(this)}compare(n){let s=xa(this,n);return s===0?pa(this,ja(n)):s}constructor(...n){Fn(this,wo,{writable:!0,value:void 0});let[s,a,r,i,l]=Ta(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 No="Open time options",Co=320;function vs(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Ht(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 Mt(n,s,a)}function ko(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 So(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new Mt(s,a));return n}function $o(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=No,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...h}=e,f=o!==void 0,[x,m]=p.useState(()=>Ht(d)),g=f?Ht(o):x,j=p.useMemo(()=>So(n),[n]),b=N=>{f||m(N),l?.(N)},w=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(Y.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:j.map(N=>{const C=g?.hour===N.hour&&g?.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:()=>b(N),children:ko(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...h,value:f?g:void 0,defaultValue:f?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:N=>b(Ht(N))})}function Mn(e){if(e.mode==="time")return t.jsx($o,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=Co,disableAnimation:d=!0,classNames:u,...h}=e;return t.jsx(c.DatePicker,{...h,calendarWidth:o,classNames:{...u,popoverContent:vs("min-w-[20rem]",u?.popoverContent),calendarContent:vs("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 Ao(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Le=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(Ao(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:l})})});Le.displayName="Select";function Do({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[h,f]=p.useState(""),x=p.useId(),[m,g]=p.useState(e);e!==m&&(g(e),e==="applied"&&f(""));const j=()=>{const N=h.trim();N&&n(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),j())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(ma,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const w=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:h,onValueChange:f,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?x:void 0}),t.jsx(z,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!h.trim(),onPress:j,children:o})]}),w&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Eo={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Fo({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(Le,{"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(Y.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(Le,{"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(Y.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 Mo({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(z,{"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(Y.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(z,{"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(Y.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Lo({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:h}){const f={...Eo,...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",h),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(Fo,{languages:n,selectedLanguage:s,onLanguageChange:a,label:f.selectLanguage}),d&&t.jsx(Mo,{isLoggedIn:r,onLogin:i,onLogout:l,labels:f})]})]})}function To(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 qt;const Io=typeof document<"u"?(qt=p.useInsertionEffect)!==null&&qt!==void 0?qt:p.useLayoutEffect:()=>{};function Lt(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 f=l.current;f!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${f?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:a;Io(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),h=p.useCallback((f,...x)=>{let m=typeof f=="function"?f(i.current):f;Object.is(i.current,m)||(i.current=m,r(m),u(),s?.(m,...x))},[s]);return[d,h]}function Ia(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 _a=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:h="compact",stepCounterFormat:f,onStepChange:x,currentStep:m,hideProgressBars:g=!1,stepClassName:j,className:b,isDisabled:w=!1,...N},C)=>{const[v,S]=Lt(m,a,x),L=p.useMemo(()=>{let A,k;const E=["[--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)]",k="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":A="[--step-color:var(--heroui-secondary)]",k="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":A="[--step-color:var(--heroui-success)]",k="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":A="[--step-color:var(--heroui-warning)]",k="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":A="[--step-color:var(--heroui-danger)]",k="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":A="[--step-color:var(--heroui-default)]",k="[--step-fg-color:var(--heroui-default-foreground)]";break;default:A="[--step-color:var(--heroui-primary)]",k="[--step-fg-color:var(--heroui-primary-foreground)]";break}return E.unshift(k),E.unshift(A),E},[e]);return t.jsxs("nav",{ref:C,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",h==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:f?f(v+1,s):`Step ${v+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",L,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((A,k)=>{const E=v===k?"active":v<k?"inactive":"complete",I=n==="activeLabel"&&E==="active"&&!!i?.[k],D=l&&E!=="active"&&!!i?.[k];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${k}`,children:[t.jsx(c.Tooltip,{content:D?i?.[k]: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":E==="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":w},j),onClick:()=>!w&&S(k),disabled:w,"data-testid":`stepper-step-btn-${k}`,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:E,className:"relative z-10",children:t.jsx(Ce.m.div,{animate:E,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)":E==="complete","shadow-lg":E==="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:E==="complete"&&n==="default"?t.jsx(Ia,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${k}`}):t.jsx("span",{children:k+1})})})})})}),I?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${k}`,children:i[k]}):null]},k)}),k<s-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":k},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":k<v})})})]},k)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:f?f(v+1,s):`Step ${v+1} of ${s}`}):null]})});_a.displayName="Stepper";function _o(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 Tt(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 Pa(e,n,s="en-US"){const a=Tt(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function mn(e,n,s,a){return Pa(e-n,s,a)}const js={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))"}},Po="rgb(156 163 175)",Ro="rgb(107 114 128)",Ra=p.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Po,inactiveLabelColor:h=Ro,activeStepVariant:f="bordered",stepClassName:x,circleClassName:m,progressBarClassName:g,labelsClassName:j,labelSlotClassName:b,activeLabelClassName:w,inactiveLabelClassName:N,className:C,ariaLabel:v="Progress",invalidLabelSuffix:S=", has errors",testId:L,isStepReachable:A,...k},E){const[I,D]=Lt(i,a,r),F=js[n]??js.primary,T=o??F.active,_=d??F.fg,W=(U,B)=>{const Q=U.ariaLabel??(typeof U.title=="string"?U.title:null)??`${B+1}`;return U.invalid?`${Q}${S}`:Q};return t.jsxs("nav",{...k,"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",Q=A?A(B):!0;return t.jsxs(p.Fragment,{children:[t.jsx(z,{ref:E,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":W(U,B),"data-invalid":U.invalid?"true":void 0,isDisabled:!Q,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",Q?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",U.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",m),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:f==="solid"?T:"transparent",borderColor:T,borderWidth:"1.5px",color:f==="solid"?_:T},complete:{backgroundColor:T,borderColor:T,borderWidth:"1.5px",color:T}},children:X==="complete"?t.jsx(Ia,{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",g),style:{backgroundColor:B<I?T:u}})]},B)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",j),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",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",X?w:N),style:{color:X?T:h},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",g)})]},B)})})]})});Ra.displayName="HorizontalSteps";function Oo(){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 zo=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Bo,{...e},n)},Bo=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,h]=p.useState(null),[f,x]=p.useState(null),m=p.useMemo(()=>new Set(n),[n]),g=p.useMemo(()=>new Set(e),[e]),j=p.useMemo(()=>e.filter(D=>!m.has(D)),[e,m]),b=D=>{if(D.length===0)return;const F=Array.from(new Set([...n,...D]));s(F)},w=D=>{if(D.length===0)return;const F=new Set(D);s(n.filter(T=>!F.has(T)))},N=()=>{i.length!==0&&(b(i),l([]))},C=()=>{o.length!==0&&(w(o),d([]))},v=()=>{j.length!==0&&(b(j),l([]))},S=()=>{n.length!==0&&(s([]),d([]))},L=(D,F,T)=>{const _=Math.min(F,T),W=Math.max(F,T);return D.slice(_,W+1)},A=(D,F,T)=>{if(T&&u!==null){l(L(j,u,F)),d([]),h(F);return}const _=i.includes(D);l(_?i.filter(W=>W!==D):[...i,D]),d([]),h(F)},k=(D,F,T)=>{if(T&&f!==null){d(L(n,f,F)),l([]),x(F);return}const _=o.includes(D);d(_?o.filter(W=>W!==D):[...o,D]),l([]),x(F)},E=(D,F,T)=>{const _=T==="available"?i.includes(F)?i:[F]:o.includes(F)?o:[F];D.dataTransfer.setData("text/plain",JSON.stringify({source:T,items:_})),D.dataTransfer.effectAllowed="move"},I=(D,F)=>{D.preventDefault();const T=D.dataTransfer.getData("text/plain");if(T)try{const _=JSON.parse(T),W=(_.items||[]).filter(U=>g.has(U));if(W.length===0||_.source===F)return;F==="selected"?(b(W),l([])):(w(W),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:D=>D.preventDefault(),onDrop:D=>I(D,"available"),children:j.map((D,F)=>{const T=i.includes(D);return t.jsx("button",{type:"button",onClick:_=>{A(D,F,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>E(_,D,"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:D},D)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(z,{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(z,{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(z,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:v,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(z,{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=>I(D,"selected"),children:n.map((D,F)=>{const T=o.includes(D);return t.jsx("button",{type:"button",onClick:_=>{k(D,F,_.shiftKey)},onMouseDown:_=>{_.shiftKey&&_.preventDefault()},draggable:!0,onDragStart:_=>E(_,D,"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: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(z,{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 _e={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"}},Vo={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Uo({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=_e.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(z,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(Y.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(Y.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Vo[l]},l))})]})}const Wt={bulletList:{label:"Bullet List",icon:Y.List},orderedList:{label:"Numbered List",icon:Y.ListOrdered},taskList:{label:"Task List",icon:Y.ListTodo}};function Ho({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?Wt[r].icon:Y.List,l=o=>{const u=_e[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(z,{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=Wt[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Wt[o].label},o)})})]})}function qo({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 Uo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Ho=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Yt(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ve={min:50,max:200,step:10,default:100},js={lineHeight:24,toolbarHeight:60},qo={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},Wo={left:G.AlignLeft,center:G.AlignCenter,right:G.AlignRight,justify:G.AlignJustify};function Qe(e){return qo[e]}function Yo({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=p.useState(""),o=u=>{const m=u.target.value;n(m),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Yt(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Yt(e)?e:"transparent"}})}),t.jsx(B,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Yt(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 ws({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=p.useState(!1),[l,d]=p.useState(""),u=n==="textColor"?Uo:Ho,m=w=>{const b=_e[n];b&&b.execute({editor:e,config:{type:n,color:w}}),o(!1),d("")},f=w=>{m(w)},x=()=>{const w=_e[n];w&&w.execute({editor:e,config:{type:n,color:""}}),o(!1)},h=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),y=n==="textColor"?G.Palette:G.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(y,{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(B,{size:"sm",variant:"light",isIconOnly:!0,onPress:x,"aria-label":"Clear color",children:t.jsx(G.X,{size:16})})]}),t.jsx(Vo,{colors:u,onColorSelect:m}),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(Yo,{value:l,onChange:d,onApply:f})]})]})]})})]})}function Go({zoom:e,onZoomChange:n,min:s=ve.min,max:a=ve.max,step:r=ve.step}){const i=()=>{const f=Math.max(s,e-r);n(f)},o=()=>{const f=Math.min(a,e+r);n(f)},l=()=>{n(ve.default)},d=e<=s,u=e>=a,m=e===ve.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(G.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:m?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:m,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Wo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Go=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Gt(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ve={min:50,max:200,step:10,default:100},ws={lineHeight:24,toolbarHeight:60},Yo={bold:Y.Bold,italic:Y.Italic,strike:Y.Strikethrough,underline:Y.Underline,code:Y.Code,textColor:Y.Palette,highlight:Y.Highlighter,link:Y.Link2,paragraph:Y.FileText,heading:Y.Heading,bulletList:Y.List,orderedList:Y.ListOrdered,taskList:Y.ListTodo,codeBlock:Y.CodeSquare,blockquote:Y.Quote,horizontalRule:Y.Minus,clearMarks:Y.Eraser,clearNodes:Y.Eraser,undo:Y.Undo2,redo:Y.Redo2,hardBreak:Y.CornerDownLeft,textAlign:Y.AlignLeft},Ko={left:Y.AlignLeft,center:Y.AlignCenter,right:Y.AlignRight,justify:Y.AlignJustify};function Qe(e){return Yo[e]}function Qo({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=p.useState(""),l=u=>{const h=u.target.value;n(h),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Gt(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:Gt(e)?e:"transparent"}})}),t.jsx(z,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Gt(e),children:t.jsx(Y.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Ns({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"?Wo:Go,h=j=>{const b=_e[n];b&&b.execute({editor:e,config:{type:n,color:j}}),l(!1),d("")},f=j=>{h(j)},x=()=>{const j=_e[n];j&&j.execute({editor:e,config:{type:n,color:""}}),l(!1)},m=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=n==="textColor"?Y.Palette:Y.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(z,{size:"sm",radius:"sm",variant:m?"solid":"bordered",color:m?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(g,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(z,{size:"sm",variant:"light",isIconOnly:!0,onPress:x,"aria-label":"Clear color",children:t.jsx(Y.X,{size:16})})]}),t.jsx(qo,{colors:u,onColorSelect:h}),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:f})]})]})]})})]})}function Zo({zoom:e,onZoomChange:n,min:s=ve.min,max:a=ve.max,step:r=ve.step}){const i=()=>{const f=Math.max(s,e-r);n(f)},l=()=>{const f=Math.min(a,e+r);n(f)},o=()=>{n(ve.default)},d=e<=s,u=e>=a,h=e===ve.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(z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(Y.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:h?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:h,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
- ${m?"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(B,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(G.ZoomIn,{size:16})})})]})}function Ko({editor:e,isDisabled:n=!1}){const[s,a]=p.useState(!1),[r,i]=p.useState(""),[o,l]=p.useState(""),[d,u]=p.useState(!1),m=e.isActive("link"),f=h=>{if(h){const{from:y,to:w}=e.state.selection,b=e.isActive("link");let j="";if(b){const C=e.schema.marks.link,v=e.state.doc.resolve(y),k=ts.getMarkRange(v,C);k&&(j=e.state.doc.textBetween(k.from,k.to,""))}else j=e.state.doc.textBetween(y,w,"");const N=e.getAttributes("link").href||"";i(j),l(N),u(b)}a(h)},x=()=>{if(o.trim()){const{from:h,to:y}=e.state.selection,w=e.schema.marks.link,b=e.state.doc.resolve(h),j=ts.getMarkRange(b,w),N=j?.from??h,C=j?.to??y,v=e.state.doc.textBetween(N,C,"");r.trim()&&r!==v?e.chain().focus().setTextSelection({from:N,to:C}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:f,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(B,{size:"sm",radius:"sm",variant:m?"solid":"bordered",color:m?"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:o,onChange:h=>l(h.target.value),onKeyDown:h=>h.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(B,{size:"sm",color:"primary",onPress:x,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function Qo({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 _a(e,n){const s=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(l=>ut(l)))).forEach(l=>{const d=_e[l];if(d)try{const u=d.canExecute?.(e)??!0,m=d.isActive?.(e)??!1;i[l]={isActive:m,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=p.useState(s);return p.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(n.map(d=>ut(d)))).forEach(d=>{const u=_e[d];if(u)try{const m=u.canExecute?.(e)??!0,f=u.isActive?.(e)??!1;o[d]={isActive:f,isDisabled:!m,canExecute:m}}catch(m){console.warn(`Extension not available for modifier: ${d}`,m),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function Pa(e,n){const s=p.useCallback((o,l)=>{if(!e)return;const d=_e[o];if(d)try{d.execute({editor:e,config:l}),n?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,n]),a=p.useCallback(o=>{s(o)},[s]),r=p.useCallback((o,l)=>{if(!e)return!1;const d=_e[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=p.useCallback((o,l)=>{if(!e)return!1;const d=_e[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Zo(e=ve.default){const[n,s]=p.useState(e),a=p.useCallback((l=ve.step)=>{s(d=>Math.min(ve.max,d+l))},[]),r=p.useCallback((l=ve.step)=>{s(d=>Math.max(ve.min,d-l))},[]),i=p.useCallback(()=>{s(ve.default)},[]),o=p.useCallback(l=>{const d=Math.max(ve.min,Math.min(ve.max,l));s(d)},[]);return{zoom:n,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ve.min,isMaxZoom:n>=ve.max,isDefaultZoom:n===ve.default}}const Xo=["bold","italic","strike","underline","code"];function Jo({editor:e,modifiers:n,onToolbarAction:s}){const a=_a(e,n),{toggleModifier:r}=Pa(e,s);if(!e)return null;const i=n.map(o=>ut(o)).filter(o=>Xo.includes(o));return i.length===0?null:t.jsx(Qo,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Qe(o);return t.jsx(qe,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function ec({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=_a(e,n),{toggleModifier:d,executeCommand:u}=Pa(e,o);if(!e)return null;const m=n.map($=>ut($)),f=m.some($=>["bold","italic","strike","underline","code"].includes($)),x=m.some($=>["textColor","highlight"].includes($)),h=m.includes("heading"),y=m.includes("textAlign"),w=m.some($=>["bulletList","orderedList","taskList"].includes($)),b=m.includes("blockquote"),j=m.includes("codeBlock"),N=m.includes("link"),C=m.includes("horizontalRule"),v=m.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:[f&&t.jsxs(t.Fragment,{children:[t.jsx(Jo,{editor:e,modifiers:n,onToolbarAction:o}),(x||h||y||w||b||j||N||C||v||k)&&t.jsx(He,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[m.includes("textColor")&&t.jsx(ws,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),m.includes("highlight")&&t.jsx(ws,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(h||y||w||b||j||N||C||v||k)&&t.jsx(He,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx(zo,{editor:e}),(y||w||b||j||N||C||v||k)&&t.jsx(He,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map($=>{const M=Wo[$],E=e.isActive({textAlign:$});return t.jsx(qe,{icon:M,label:`Align ${$}`,isActive:E,onClick:()=>u("textAlign",{type:"textAlign",alignment:$})},$)})}),(w||b||j||N||C||v||k)&&t.jsx(He,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsx(Bo,{editor:e,types:m.filter($=>["bulletList","orderedList","taskList"].includes($))}),(b||j||N||C||v||k)&&t.jsx(He,{})]}),(b||j||N||C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),j&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(Ko,{editor:e,isDisabled:l.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:[m.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),m.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),k&&t.jsx(He,{})]}),k&&t.jsx(Go,{zoom:s,onZoomChange:$=>{a?.($),o?.({type:"zoom",modifier:`${$}%`})}})]})})}const st={bold:{category:"mark",extension:Si.Bold,priority:100},italic:{category:"mark",extension:$i.Italic,priority:100},strike:{category:"mark",extension:Ai.Strike,priority:100},underline:{category:"mark",extension:Di.Underline,priority:100},code:{category:"mark",extension:Ei.Code,priority:100},textColor:{category:"mark",extension:Fi.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Mi.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Li.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ii.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Pi.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Oi.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Ri.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Vi.CodeBlock,priority:100},blockquote:{category:"node",extension:Ui.Blockquote,priority:100},horizontalRule:{category:"node",extension:Hi.HorizontalRule,priority:100},hardBreak:{category:"node",extension:qi.HardBreak,priority:100},undo:{category:"extension",extension:ns.History,priority:50},redo:{category:"extension",extension:ns.History,priority:50},textAlign:{category:"extension",extension:Wi.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}},tc=[Yi.Document,Gi.Text,_i.Paragraph,Ti.TextStyle.configure({HTMLAttributes:{}}),Bi.ListItem.configure({HTMLAttributes:{}}),zi.TaskItem.configure({nested:!0}),Ki.Dropcursor,Qi.Gapcursor];function nc(e){const n=[],s=new Set,a=new Set;tc.forEach(l=>{l&&(n.push(l),a.add(l.name))});const r=e.map(l=>ut(l)),i=new Set;return r.forEach(l=>{const d=st[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const d=st[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(l);return}const m=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(m),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const d=st[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){s.add(l);return}const u=d.extension.name;if(a.has(u)){s.add(l);return}const m=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(m),s.add(l),a.add(u)}),n.sort((l,d)=>{const u=Object.values(st).find(h=>h?.extension?.name===l.name),m=Object.values(st).find(h=>h?.extension?.name===d.name),f=u?.priority??100;return(m?.priority??100)-f})}const Oa={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"]},sc={h1:`font-size: ${de.fontSize["4xl"]}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${de.fontSize["2xl"]}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${de.fontSize.xl}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${de.fontSize.lg}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${de.fontSize.base}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${de.fontSize.sm}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${de.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: ${de.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: ${de.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${de.fontFamily.mono};`,pre:`background: ${be.neutral.gray[800]}; border-radius: ${le.sm}; color: ${be.neutral.gray[100]}; font-family: ${de.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;"},ac={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 rc(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(ac)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[s,a]of Object.entries(sc)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return n}const ic=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=vn.useCurrentEditor();return t.jsx(ec,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},lc=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=vn.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},mn=p.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Oa.full,variant:u="bordered",initialContent:m,content:f,onContentChange:x,onUpdate:h,onToolbarAction:y,isReadOnly:w=!1,isDisabled:b=!1,includeInlineStyles:j=!0,...N}=e,{zoom:C,setZoom:v}=Zo(),k=js.lineHeight,L=s*k,$=r?void 0:a*k,M=p.useMemo(()=>nc(d),[d]),{Component:E,label:I,shouldLabelBeOutside:A,getBaseProps:D,getLabelProps:T,getInputWrapperProps:_}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),Y=I?t.jsx("label",{...T(),children:I}):null,V=p.useCallback(({editor:U})=>{const Z=U.getHTML(),J=j?rc(Z):Z,re=U.getJSON(),q=U.getText(),Q=q.length,K=q.split(/\s+/).filter(oe=>oe.length>0).length,ee={html:J,json:re,text:q,characters:Q,words:K};if(x?.(ee),h?.(ee),"onChange"in N&&typeof N.onChange=="function"){const oe={target:{value:J},currentTarget:{value:J}};N.onChange(oe)}},[x,h,N,j]);return t.jsxs(E,{...D(),children:[A?Y: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(vn.EditorProvider,{editable:!w&&!b,slotBefore:l?t.jsx(ic,{modifiers:d,zoom:C,onZoomChange:v,onToolbarAction:y}):void 0,slotAfter:t.jsx(lc,{showCharacterCount:i,showWordCount:o}),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:f||m||e.defaultValue||"",onUpdate:V})})]})});mn.displayName="TipTapEditor";const Ra=p.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(mn,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(mn,{...r,variant:a,ref:n}))});Ra.displayName="RichTextArea";function oc(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}],cc={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},za=({presetAmounts:e=Ns,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:m,mobileColumns:f=2,desktopColumns:x=3,isDisabled:h=!1,buttonVariant:y="bordered",buttonColor:w="default",inputVariant:b="bordered",size:j="md",className:N="",showCard:C=!0})=>{const v={...cc,...m},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[f]} ${$[x]}`,[E,I]=Lt(n,s,a),[A,D]=p.useState(""),[T,_]=p.useState(!1),[Y,V]=p.useState(0),U=p.useCallback(Q=>{if(h)return;const K={amount:Q.amount,isCustom:!1,presetId:Q.id};I(K),D(""),_(!1),V(ee=>ee+1),r?.(K)},[h,I,r]),Z=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]),J=p.useCallback(()=>{if(h)return;const Q=A!==""?parseFloat(A):void 0;Q===void 0||isNaN(Q)||r?.({amount:Q,isCustom:!0})},[h,A,r]),re=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 K=E!==null&&!E.isCustom&&E.presetId===Q.id;return t.jsx(B,{color:K?"primary":w,variant:K?"solid":y,className:"w-full",onPress:()=>U(Q),isDisabled:h,"data-testid":`donation-amounts-preset-${Q.id}`,children:Q.label||oc(Q.amount,o,i)},Q.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:v.customAmountPlaceholder,"aria-label":v.customAmountAriaLabel,onInput:r?()=>{I(null),_(!0)}:void 0,variant:b,radius:"full",size:j,minValue:d,maxValue:u,step:.01,formatOptions:re,value:A!==""?parseFloat(A):void 0,onValueChange:Z,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-${Y}`:E?.isCustom===!1?E.presetId:"custom"),r&&t.jsx(B,{color:"primary",variant:"solid",radius:"full",size:j,className:"shrink-0",onPress:J,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})};za.displayName="DonationAmounts";const dc=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`},uc=e=>{switch(e){case"warning":return G.Clock;case"error":return G.AlertCircle;case"success":return G.CheckCircle;default:return G.Clock}},fc=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"}},Ba=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:m=!0,formatTime:f=dc,className:x,...h},y)=>{const[w,b]=Lt(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(!m||w<=0){j.current&&(clearInterval(j.current),j.current=null);return}return j.current=setInterval(()=>{b(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)}},[m,w,b,a]),p.useEffect(()=>{w>0&&(N.current=!1)},[w]);const C=d||uc(r),v=fc(i),k={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:y,role:"banner","aria-live":"polite","aria-label":`${o} ${f(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:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(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:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${f(w)}`,"data-testid":"expire-cart-timer-value",children:f(w)})})]})})})});Ba.displayName="ExpireCartTimer";const Gt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(R,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),mc=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:m,labels:f})=>{const[x,h]=p.useState(!1),[y,w]=p.useState(!1),b=p.useRef(null);return p.useEffect(()=>{const j=()=>{if(b.current){const N=b.current.scrollHeight>b.current.clientHeight;w(N)}};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[o]),t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading: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:f.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Gt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Gt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Gt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:b,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!x&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(B,{onPress:()=>h(!x),variant:"light",className:c.cn("text-primary",m),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?f.showLess||"Hide":f.showMore||"Show"})})]})]})]})};function hn(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 hc(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 xc={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),Ct=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:m="default",showCard:f=!0,showDescription:x=!0,showPeopleCount:h=!0,showPrice:y=!0,priceDisplay:w,classNames:b={},"data-testid":j,selectedColor:N="default",compact:C=!1,isSoldOut:v,isMaxReached:k,isRuleBlocked:L,statusTone:$="default",statusLabel:M,disabledReason:E,disabled:I})=>{const A=p.useMemo(()=>({...xc,...o}),[o]),[D,T]=p.useState(s),_=n!==void 0?n:D,Y=!!(d||I),V=C||!!e.compact,U=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]),Z=p.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:U||!Ge(e.ticketsAllowed)?!1:_>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,U,e.ticketsAllowed,e.totalTicketsSold,_]),J=p.useMemo(()=>typeof L=="boolean"?L:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[L,e.isRuleBlocked]),re=E||e.disabledReason,q=Y||U||J,Q=ne=>{if(q||ne>0&&Z)return;const xe=Math.max(0,_+ne);n===void 0&&T(xe),a?.(e.id,xe)},K=p.useMemo(()=>{if(U)return"soldOut";if(J)return"ruleBlocked";if(Y)return"disabled"},[U,J,Y]),ee=p.useMemo(()=>$||(U||J?"danger":Z?"warning":"default"),[$,U,J,Z]),oe=p.useMemo(()=>{if(K)return K==="ruleBlocked"?M||re||A.ruleBlocked:K==="soldOut"?M||re||A.soldOut:K==="disabled"?M||re||A.disabled:M||A.maxReached},[K,M,re,A]),X={soldOut:"danger",ruleBlocked:ee,disabled:"default",maxReached:"warning"},ue={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},te=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",V&&"text-sm",b.name),children:e.name}),ye=()=>{if(!y)return null;const ne=w?.price??e.price,xe=w?.originalPrice,Te=hn(ne,i,r);if(l?.renderPrice)return l.renderPrice(ne,Te,e);if(Ge(xe)&&Ge(ne)&&xe>ne){const ge=hn(xe,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",V&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",ge,", discounted price ",Te]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",V&&"text-xs",b.originalPrice),children:ge}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",V&&"text-sm",b.discountedPrice),children:Te})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",V&&"text-sm mt-0.5",b.price),children:Te})},De=()=>!x||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",V&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),ke=()=>{if(!h||!Ge(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ne=e.numberOfPeople===1?A.person:A.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,ne,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",V&&"mt-1 text-xs",b.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," ",ne]})},Pe=()=>{const ne=_===0||q,xe=Z||q;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:_,onIncrement:()=>Q(1),onDecrement:()=>Q(-1),isDecrementDisabled:ne,isIncrementDisabled:xe,isDisabled:q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(B,{"data-testid":"offer-card-decrement-button",onPress:()=>Q(-1),isDisabled:ne,variant:u,color:_>0?N:m,radius:"full",isIconOnly:!0,size:V?"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",V&&"text-sm"),children:_}),t.jsx(B,{"data-testid":"offer-card-increment-button",onPress:()=>Q(1),isDisabled:xe,variant:u,color:_>0?N:m,radius:"full",isIconOnly:!0,size:V?"md":"sm","aria-label":"Increase quantity",children:t.jsx(R,{icon:"gravity-ui:plus",width:16})})]})},Oe=(ne,xe)=>l?.renderDisabledState?l.renderDisabledState(ne,xe):ne==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(xe):ne==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(xe):t.jsx(c.Chip,{"data-testid":ue[ne],color:X[ne],variant:ne==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ne==="maxReached"?"h-8":"h-10",ne==="soldOut"&&b.soldOut,ne==="maxReached"&&b.maxReachedAlert,V&&"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",V?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",q||Z?"opacity-50 pointer-events-none select-none":""),children:[te(),ye(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",V?"mb-1":"mb-2"),children:[ke(),De()]})]}),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",V&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:K&&oe?Oe(K,oe):Pe()})]}),Me=Z&&!U&&!J&&!Y?t.jsx(Ce.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Oe("maxReached",oe||A.maxReached)}):null;return f?t.jsxs(c.Card,{className:c.cn("w-full",V&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",V?"pb-0.5":"",b.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Me&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",V?"pt-1":"",b.footer),children:Me})})]}):t.jsxs("div",{className:c.cn("w-full",V&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",V?"pb-0.5":"",b.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Me&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",V?"pt-1":"",b.footer),children:Me})})]})};Ct.displayName="OfferCard";const Va=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(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:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};Va.displayName="OfferCardEmpty";const pc={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Ua=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...pc,...n},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};Ua.displayName="OfferCardError";const gc={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ha=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=gc[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))})};Ha.displayName="OfferCardSkeleton";const qa={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Wa={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"}}},bc={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ya=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:m=!1,buttonVariant:f="bordered",buttonColor:x="default",showCard:h=!0,animated:y=!0,gap:w=2,compact:b=!1,classNames:j={}})=>{const[N,C]=p.useState(a),v=s!==void 0?s:N,k=p.useCallback((A,D)=>{const T={...v,[A]:Math.max(0,D)};s===void 0&&C(T),r?.(T),i?.(A,T[A])},[v,s,r,i]),L=[...e].sort((A,D)=>(A.position??0)-(D.position??0)),$=A=>{const D=n?n(A):A,T=(v??{})[D.id]||0;return{offer:D,quantity:T,onQuantityChange:k,currency:o,locale:l,labels:d,slots:u,isDisabled:m,buttonVariant:f,buttonColor:x,showCard:h,compact:b}},M=bc[w],E=c.cn("grid mx-auto pt-2",M,j.base),I=A=>{const D=$(A);return t.jsx(Ct,{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 y?t.jsx(Ce.motion.div,{"data-testid":"offer-card-list",className:E,variants:qa,initial:"hidden",animate:"show",children:t.jsx(Ce.AnimatePresence,{children:L.map(A=>{const D=$(A);return t.jsx(Ce.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:j.cardWrapper,variants:Wa,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Ct,{offer:D.offer,quantity:D.quantity,onQuantityChange:k,currency:o,locale:l,labels:d,slots:u,isDisabled:m,buttonVariant:f,buttonColor:x,showCard:h,compact:b||D.offer.compact,classNames:j.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:E,children:L.map(I)})};Ya.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Se=e=>e==null;const Ga=e=>typeof e=="object";var he=e=>!Se(e)&&!Array.isArray(e)&&Ga(e)&&!We(e),Ka=e=>he(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,yc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Qa=(e,n)=>e.has(yc(n)),vc=e=>{const n=e.constructor&&e.constructor.prototype;return he(n)&&n.hasOwnProperty("isPrototypeOf")},Mn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fe(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Mn&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(he(e)&&vc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=fe(e[r]));return a}var It=e=>/^\w*$/.test(e),ce=e=>e===void 0,Ln=e=>Array.isArray(e)?e.filter(Boolean):[],Tn=e=>Ln(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,n,s)=>{if(!n||!he(e))return s;const a=(It(n)?[n]:Tn(n)).reduce((r,i)=>Se(r)?r:r[i],e);return ce(a)||a===e?ce(e[n])?s:e[n]:a},$e=e=>typeof e=="boolean",Ne=e=>typeof e=="function",ie=(e,n,s)=>{let a=-1;const r=It(n)?[n]:Tn(n),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=s;if(a!==o){const u=e[l];d=he(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const kt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ee={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"},Za=p.createContext(null);Za.displayName="HookFormControlContext";const In=()=>p.useContext(Za);var Xa=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return n._proxyFormState[o]!==Ee.all&&(n._proxyFormState[o]=!a||Ee.all),s&&(s[o]=!0),e[o]}});return r};const _n=typeof window<"u"?p.useLayoutEffect:p.useEffect;function jc(e){const n=In(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[o,l]=p.useState(s._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return _n(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),p.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),p.useMemo(()=>Xa(o,s,d.current,!1),[o,s])}var Ae=e=>typeof e=="string",xn=(e,n,s,a,r)=>Ae(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),pn=e=>Se(e)||!Ga(e);function Fe(e,n,s=new WeakSet){if(pn(e)||pn(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 o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=n[i];if(We(o)&&We(l)||he(o)&&he(l)||Array.isArray(o)&&Array.isArray(l)?!Fe(o,l,s):!Object.is(o,l))return!1}}return!0}function wc(e){const n=In(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=p.useRef(r),u=p.useRef(l),m=p.useRef(void 0),f=p.useRef(s),x=p.useRef(a);u.current=l;const[h,y]=p.useState(()=>{const v=s._getWatch(a,d.current);return u.current?u.current(v):v}),w=p.useCallback(v=>{const k=xn(a,s._names,v||s._formValues,!1,d.current);return u.current?u.current(k):k},[s._formValues,s._names,a]),b=p.useCallback(v=>{if(!i){const k=xn(a,s._names,v||s._formValues,!1,d.current);if(u.current){const L=u.current(k);Fe(L,m.current)||(y(L),m.current=L)}else y(k)}},[s._formValues,s._names,i,a]);_n(()=>((f.current!==s||!Fe(x.current,a))&&(f.current=s,x.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:v=>{b(v.values)}})),[s,o,a,b]),p.useEffect(()=>s._removeUnmounted());const j=f.current!==s,N=x.current,C=p.useMemo(()=>{if(i)return null;const v=!j&&!Fe(N,a);return j||v?w():null},[i,j,a,N,w]);return C!==null?C:h}function Nc(e){const n=In(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=Qa(r._names.array,s),u=p.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,o)),[r,s,o]),m=wc({control:r,name:s,defaultValue:u,exact:l}),f=jc({control:r,name:s,exact:l}),x=p.useRef(e),h=p.useRef(void 0),y=p.useRef(r.register(s,{...e.rules,value:m,...$e(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const w=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(f.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(f.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(f.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(f.validatingFields,s)},error:{enumerable:!0,get:()=>z(f.errors,s)}}),[f,s]),b=p.useCallback(v=>y.current.onChange({target:{value:Ka(v),name:s},type:kt.CHANGE}),[s]),j=p.useCallback(()=>y.current.onBlur({target:{value:z(r._formValues,s),name:s},type:kt.BLUR}),[s,r._formValues]),N=p.useCallback(v=>{const k=z(r._fields,s);k&&k._f&&v&&(k._f.ref={focus:()=>Ne(v.focus)&&v.focus(),select:()=>Ne(v.select)&&v.select(),setCustomValidity:L=>Ne(v.setCustomValidity)&&v.setCustomValidity(L),reportValidity:()=>Ne(v.reportValidity)&&v.reportValidity()})},[r._fields,s]),C=p.useMemo(()=>({name:s,value:m,...$e(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:j,ref:N}),[s,a,f.disabled,b,j,N,m]);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,...$e(x.current.disabled)?{disabled:x.current.disabled}:{}});const L=($,M)=>{const E=z(r._fields,$);E&&E._f&&(E._f.mount=M)};if(L(s,!0),v){const $=fe(z(r._options.defaultValues,s,x.current.defaultValue));ie(r._defaultValues,s,$),ce(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:f,fieldState:w}),[C,f,w])}const Cc=p.createContext(null);Cc.displayName="HookFormContext";var kc=(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 Ja(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&he(r)&&i){const o=Ja(r,i);he(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var we=e=>he(e)&&!Object.keys(e).length,Pn=e=>e.type==="file",St=e=>{if(!Mn)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},er=e=>e.type==="select-multiple",On=e=>e.type==="radio",Sc=e=>On(e)||ft(e),Kt=e=>St(e)&&e.isConnected;function $c(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=ce(e)?a++:e[n[a++]];return e}function Ac(e){for(const n in e)if(e.hasOwnProperty(n)&&!ce(e[n]))return!1;return!0}function me(e,n){const s=Array.isArray(n)?n:It(n)?[n]:Tn(n),a=s.length===1?e:$c(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(he(a)&&we(a)||Array.isArray(a)&&Ac(a))&&me(e,s.slice(0,-1)),e}var Dc=e=>{for(const n in e)if(Ne(e[n]))return!0;return!1};function tr(e){return Array.isArray(e)||he(e)&&!Dc(e)}function gn(e,n={}){for(const s in e){const a=e[s];tr(a)?(n[s]=Array.isArray(a)?[]:{},gn(a,n[s])):ce(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=gn(n));for(const a in e){const r=e[a];if(tr(r))ce(n)||pn(s[a])?s[a]=gn(r,Array.isArray(r)?[]:{}):Ze(r,Se(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Fe(r,i)}}return s}const ks={value:!1,isValid:!1},Ss={value:!0,isValid:!0};var nr=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&&!ce(e[0].attributes.value)?ce(e[0].value)||e[0].value===""?Ss:{value:e[0].value,isValid:!0}:Ss:ks}return ks},sr=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>ce(e)?e:n?e===""?NaN:e&&+e:s&&Ae(e)?new Date(e):a?a(e):e;const $s={isValid:!1,value:null};var ar=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 Pn(n)?n.files:On(n)?ar(e.refs).value:er(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?nr(e.refs).value:sr(ce(n.value)?e.ref.value:n.value,e)}var Ec=(e,n,s,a)=>{const r={};for(const i of e){const o=z(n,i);o&&ie(r,i,o._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},$t=e=>e instanceof RegExp,at=e=>ce(e)?e:$t(e)?e.source:he(e)?$t(e.value)?e.value.source:e.value:e,Ds=e=>({isOnSubmit:!e||e===Ee.onSubmit,isOnBlur:e===Ee.onBlur,isOnChange:e===Ee.onChange,isOnAll:e===Ee.all,isOnTouch:e===Ee.onTouched});const Es="AsyncFunction";var Fc=e=>!!e&&!!e.validate&&!!(Ne(e.validate)&&e.validate.constructor.name===Es||he(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===Es)),Mc=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:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&n(o.refs[0],r)&&!a)return!0;if(o.ref&&n(o.ref,o.name)&&!a)return!0;if(ot(l,n))break}else if(he(l)&&ot(l,n))break}}};function Ms(e,n,s){const a=z(e,s);if(a||It(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),o=z(n,i),l=z(e,i);if(o&&!Array.isArray(o)&&s!==i)return{name:s};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:s}}var Lc=(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(o=>n[o]===(!a||Ee.all))},Tc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Ic=(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,_c=(e,n)=>!Ln(z(e,n)).length&&me(e,n),Pc=(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(Ae(e)||Array.isArray(e)&&e.every(Ae)||$e(e)&&!e)return{type:s,message:Ae(e)?e:"",ref:n}}var Ke=e=>he(e)&&!$t(e)?e:{value:e,message:""},Ts=async(e,n,s,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:m,min:f,max:x,pattern:h,validate:y,name:w,valueAsNumber:b,mount:j}=e._f,N=z(s,w);if(!j||n.has(w))return{};const C=l?l[0]:o,v=D=>{r&&C.reportValidity&&(C.setCustomValidity($e(D)?"":D||""),C.reportValidity())},k={},L=On(o),$=ft(o),M=L||$,E=(b||Pn(o))&&ce(o.value)&&ce(N)||St(o)&&o.value===""||N===""||Array.isArray(N)&&!N.length,I=kc.bind(null,w,a,k),A=(D,T,_,Y=Ie.maxLength,V=Ie.minLength)=>{const U=D?T:_;k[w]={type:D?Y:V,message:U,ref:o,...I(D?Y:V,U)}};if(i?!Array.isArray(N)||!N.length:d&&(!M&&(E||Se(N))||$e(N)&&!N||$&&!nr(l).isValid||L&&!ar(l).isValid)){const{value:D,message:T}=Ae(d)?{value:!!d,message:d}:Ke(d);if(D&&(k[w]={type:Ie.required,message:T,ref:C,...I(Ie.required,T)},!a))return v(T),k}if(!E&&(!Se(f)||!Se(x))){let D,T;const _=Ke(x),Y=Ke(f);if(!Se(N)&&!isNaN(N)){const V=o.valueAsNumber||N&&+N;Se(_.value)||(D=V>_.value),Se(Y.value)||(T=V<Y.value)}else{const V=o.valueAsDate||new Date(N),U=re=>new Date(new Date().toDateString()+" "+re),Z=o.type=="time",J=o.type=="week";Ae(_.value)&&N&&(D=Z?U(N)>U(_.value):J?N>_.value:V>new Date(_.value)),Ae(Y.value)&&N&&(T=Z?U(N)<U(Y.value):J?N<Y.value:V<new Date(Y.value))}if((D||T)&&(A(!!D,_.message,Y.message,Ie.max,Ie.min),!a))return v(k[w].message),k}if((u||m)&&!E&&(Ae(N)||i&&Array.isArray(N))){const D=Ke(u),T=Ke(m),_=!Se(D.value)&&N.length>+D.value,Y=!Se(T.value)&&N.length<+T.value;if((_||Y)&&(A(_,D.message,T.message),!a))return v(k[w].message),k}if(h&&!E&&Ae(N)){const{value:D,message:T}=Ke(h);if($t(D)&&!N.match(D)&&(k[w]={type:Ie.pattern,message:T,ref:o,...I(Ie.pattern,T)},!a))return v(T),k}if(y){if(Ne(y)){const D=await y(N,s),T=Ls(D,C);if(T&&(k[w]={...T,...I(Ie.validate,T.message)},!a))return v(T.message),k}else if(he(y)){let D={};for(const T in y){if(!we(D)&&!a)break;const _=Ls(await y[T](N,s),C,T);_&&(D={..._,...I(T,_.message)},v(_.message),a&&(k[w]=D))}if(!we(D)&&(k[w]={ref:C,...D},!a))return k}}return v(!0),k};const Oc={mode:Ee.onSubmit,reValidateMode:Ee.onChange,shouldFocusError:!0};function Rc(e={}){let n={...Oc,...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=he(n.defaultValues)||he(n.values)?fe(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:fe(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...m};let x={...f};const h={array:Cs(),state:Cs()},y=n.criteriaMode===Ee.all,w=g=>S=>{clearTimeout(u),u=setTimeout(g,S)},b=async g=>{if(!o.keepIsValid&&!n.disabled&&(f.isValid||x.isValid||g)){let S;n.resolver?(S=we((await M()).errors),j()):S=await I(a,!0),S!==s.isValid&&h.state.next({isValid:S})}},j=(g,S)=>{!n.disabled&&(f.isValidating||f.validatingFields||x.isValidating||x.validatingFields)&&((g||Array.from(l.mount)).forEach(F=>{F&&(S?ie(s.validatingFields,F,S):me(s.validatingFields,F))}),h.state.next({validatingFields:s.validatingFields,isValidating:!we(s.validatingFields)}))},N=(g,S=[],F,H,O=!0,P=!0)=>{if(H&&F&&!n.disabled){if(o.action=!0,P&&Array.isArray(z(a,g))){const W=F(z(a,g),H.argA,H.argB);O&&ie(a,g,W)}if(P&&Array.isArray(z(s.errors,g))){const W=F(z(s.errors,g),H.argA,H.argB);O&&ie(s.errors,g,W),_c(s.errors,g)}if((f.touchedFields||x.touchedFields)&&P&&Array.isArray(z(s.touchedFields,g))){const W=F(z(s.touchedFields,g),H.argA,H.argB);O&&ie(s.touchedFields,g,W)}(f.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,F,H)=>{const O=z(a,g);if(O){const P=z(i,g,ce(F)?z(r,g):F);ce(P)||H&&H.defaultChecked||S?ie(i,g,S?P:As(O._f)):Y(g,P),o.mount&&!o.action&&b()}},L=(g,S,F,H,O)=>{let P=!1,W=!1;const se={name:g};if(!n.disabled){if(!F||H){(f.isDirty||x.isDirty)&&(W=s.isDirty,s.isDirty=se.isDirty=D(),P=W!==se.isDirty);const ae=Fe(z(r,g),S);W=!!z(s.dirtyFields,g),ae?me(s.dirtyFields,g):ie(s.dirtyFields,g,!0),se.dirtyFields=s.dirtyFields,P=P||(f.dirtyFields||x.dirtyFields)&&W!==!ae}if(F){const ae=z(s.touchedFields,g);ae||(ie(s.touchedFields,g,F),se.touchedFields=s.touchedFields,P=P||(f.touchedFields||x.touchedFields)&&ae!==F)}P&&O&&h.state.next(se)}return P?se:{}},$=(g,S,F,H)=>{const O=z(s.errors,g),P=(f.isValid||x.isValid)&&$e(S)&&s.isValid!==S;if(n.delayError&&F?(d=w(()=>C(g,F)),d(n.delayError)):(clearTimeout(u),d=null,F?ie(s.errors,g,F):me(s.errors,g)),(F?!Fe(O,F):O)||!we(H)||P){const W={...H,...P&&$e(S)?{isValid:S}:{},errors:s.errors,name:g};s={...s,...W},h.state.next(W)}},M=async g=>(j(g,!0),await n.resolver(i,n.context,Ec(g||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),E=async g=>{const{errors:S}=await M(g);if(j(g),g)for(const F of g){const H=z(S,F);H?ie(s.errors,F,H):me(s.errors,F)}else s.errors=S;return S},I=async(g,S,F={valid:!0})=>{for(const H in g){const O=g[H];if(O){const{_f:P,...W}=O;if(P){const se=l.array.has(P.name),ae=O._f&&Fc(O._f);ae&&f.validatingFields&&j([P.name],!0);const je=await Ts(O,l.disabled,i,y,n.shouldUseNativeValidation&&!S,se);if(ae&&f.validatingFields&&j([P.name]),je[P.name]&&(F.valid=!1,S||e.shouldUseNativeValidation))break;!S&&(z(je,P.name)?se?Pc(s.errors,je,P.name):ie(s.errors,P.name,je[P.name]):me(s.errors,P.name))}!we(W)&&await I(W,S,F)}}return F.valid},A=()=>{for(const g of l.unMount){const S=z(a,g);S&&(S._f.refs?S._f.refs.every(F=>!Kt(F)):!Kt(S._f.ref))&&te(g)}l.unMount=new Set},D=(g,S)=>!n.disabled&&(g&&S&&ie(i,g,S),!Fe(q(),r)),T=(g,S,F)=>xn(g,l,{...o.mount?i:ce(S)?r:Ae(g)?{[g]:S}:S},F,S),_=g=>Ln(z(o.mount?i:r,g,n.shouldUnregister?z(r,g,[]):[])),Y=(g,S,F={})=>{const H=z(a,g);let O=S;if(H){const P=H._f;P&&(!P.disabled&&ie(i,g,sr(S,P)),O=St(P.ref)&&Se(S)?"":S,er(P.ref)?[...P.ref.options].forEach(W=>W.selected=O.includes(W.value)):P.refs?ft(P.ref)?P.refs.forEach(W=>{(!W.defaultChecked||!W.disabled)&&(Array.isArray(O)?W.checked=!!O.find(se=>se===W.value):W.checked=O===W.value||!!O)}):P.refs.forEach(W=>W.checked=W.value===O):Pn(P.ref)?P.ref.value="":(P.ref.value=O,P.ref.type||h.state.next({name:g,values:fe(i)})))}(F.shouldDirty||F.shouldTouch)&&L(g,O,F.shouldTouch,F.shouldDirty,!0),F.shouldValidate&&re(g)},V=(g,S,F)=>{for(const H in S){if(!S.hasOwnProperty(H))return;const O=S[H],P=g+"."+H,W=z(a,P);(l.array.has(g)||he(O)||W&&!W._f)&&!We(O)?V(P,O,F):Y(P,O,F)}},U=(g,S,F={})=>{const H=z(a,g),O=l.array.has(g),P=fe(S);ie(i,g,P),O?(h.array.next({name:g,values:fe(i)}),(f.isDirty||f.dirtyFields||x.isDirty||x.dirtyFields)&&F.shouldDirty&&h.state.next({name:g,dirtyFields:Ze(r,i),isDirty:D(g,P)})):H&&!H._f&&!Se(P)?V(g,P,F):Y(g,P,F),Fs(g,l)?h.state.next({...s,name:g,values:fe(i)}):h.state.next({name:o.mount?g:void 0,values:fe(i)})},Z=async g=>{o.mount=!0;const S=g.target;let F=S.name,H=!0;const O=z(a,F),P=ae=>{H=Number.isNaN(ae)||We(ae)&&isNaN(ae.getTime())||Fe(ae,z(i,F,ae))},W=Ds(n.mode),se=Ds(n.reValidateMode);if(O){let ae,je;const Ue=S.type?As(O._f):Ka(g),Re=g.type===kt.BLUR||g.type===kt.FOCUS_OUT,Ni=!Mc(O._f)&&!n.resolver&&!z(s.errors,F)&&!O._f.deps||Ic(Re,z(s.touchedFields,F),s.isSubmitted,se,W),Pt=Fs(F,l,Re);ie(i,F,Ue),Re?(!S||!S.readOnly)&&(O._f.onBlur&&O._f.onBlur(g),d&&d(0)):O._f.onChange&&O._f.onChange(g);const Ot=L(F,Ue,Re),Ci=!we(Ot)||Pt;if(!Re&&h.state.next({name:F,type:g.type,values:fe(i)}),Ni)return(f.isValid||x.isValid)&&(n.mode==="onBlur"?Re&&b():Re||b()),Ci&&h.state.next({name:F,...Pt?{}:Ot});if(!Re&&Pt&&h.state.next({...s}),n.resolver){const{errors:Jn}=await M([F]);if(j([F]),P(Ue),H){const ki=Ms(s.errors,a,F),es=Ms(Jn,a,ki.name||F);ae=es.error,F=es.name,je=we(Jn)}}else j([F],!0),ae=(await Ts(O,l.disabled,i,y,n.shouldUseNativeValidation))[F],j([F]),P(Ue),H&&(ae?je=!1:(f.isValid||x.isValid)&&(je=await I(a,!0)));H&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&re(O._f.deps),$(F,je,ae,Ot))}},J=(g,S)=>{if(z(s.errors,S)&&g.focus)return g.focus(),1},re=async(g,S={})=>{let F,H;const O=lt(g);if(n.resolver){const P=await E(ce(g)?g:O);F=we(P),H=g?!O.some(W=>z(P,W)):F}else g?(H=(await Promise.all(O.map(async P=>{const W=z(a,P);return await I(W&&W._f?{[P]:W}:W)}))).every(Boolean),!(!H&&!s.isValid)&&b()):H=F=await I(a);return h.state.next({...!Ae(g)||(f.isValid||x.isValid)&&F!==s.isValid?{}:{name:g},...n.resolver||!g?{isValid:F}:{},errors:s.errors}),S.shouldFocus&&!H&&ot(a,J,g?O:l.mount),H},q=(g,S)=>{let F={...o.mount?i:r};return S&&(F=Ja(S.dirtyFields?s.dirtyFields:s.touchedFields,F)),ce(g)?F:Ae(g)?z(F,g):g.map(H=>z(F,H))},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)}),K=g=>{g&&lt(g).forEach(S=>me(s.errors,S)),h.state.next({errors:g?s.errors:{}})},ee=(g,S,F)=>{const H=(z(a,g,{_f:{}})._f||{}).ref,O=z(s.errors,g)||{},{ref:P,message:W,type:se,...ae}=O;ie(s.errors,g,{...ae,...S,ref:H}),h.state.next({name:g,errors:s.errors,isValid:!1}),F&&F.shouldFocus&&H&&H.focus&&H.focus()},oe=(g,S)=>Ne(g)?h.state.subscribe({next:F=>"values"in F&&g(T(void 0,S),F)}):T(g,S,!0),X=g=>h.state.subscribe({next:S=>{Tc(g.name,S.name,g.exact)&&Lc(S,g.formState||f,Te,g.reRenderRoot)&&g.callback({values:{...i},...s,...S,defaultValues:r})}}).unsubscribe,ue=g=>(o.mount=!0,x={...x,...g.formState},X({...g,formState:{...m,...g.formState}})),te=(g,S={})=>{for(const F of g?lt(g):l.mount)l.mount.delete(F),l.array.delete(F),S.keepValue||(me(a,F),me(i,F)),!S.keepError&&me(s.errors,F),!S.keepDirty&&me(s.dirtyFields,F),!S.keepTouched&&me(s.touchedFields,F),!S.keepIsValidating&&me(s.validatingFields,F),!n.shouldUnregister&&!S.keepDefaultValue&&me(r,F);h.state.next({values:fe(i)}),h.state.next({...s,...S.keepDirty?{isDirty:D()}:{}}),!S.keepIsValid&&b()},ye=({disabled:g,name:S})=>{if($e(g)&&o.mount||g||l.disabled.has(S)){const O=l.disabled.has(S)!==!!g;g?l.disabled.add(S):l.disabled.delete(S),O&&o.mount&&!o.action&&b()}},De=(g,S={})=>{let F=z(a,g);const H=$e(S.disabled)||$e(n.disabled);return ie(a,g,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:g}},name:g,mount:!0,...S}}),l.mount.add(g),F?ye({disabled:$e(S.disabled)?S.disabled:n.disabled,name:g}):k(g,!0,S.value),{...H?{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:Z,onBlur:Z,ref:O=>{if(O){De(g,S),F=z(a,g);const P=ce(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,W=Sc(P),se=F._f.refs||[];if(W?se.find(ae=>ae===P):P===F._f.ref)return;ie(a,g,{_f:{...F._f,...W?{refs:[...se.filter(Kt),P,...Array.isArray(z(r,g))?[{}]:[]],ref:{type:P.type,name:g}}:{ref:P}}}),k(g,!1,void 0,P)}else F=z(a,g,{}),F._f&&(F._f.mount=!1),(n.shouldUnregister||S.shouldUnregister)&&!(Qa(l.array,g)&&o.action)&&l.unMount.add(g)}}},ke=()=>n.shouldFocusError&&ot(a,J,l.mount),Pe=g=>{$e(g)&&(h.state.next({disabled:g}),ot(a,(S,F)=>{const H=z(a,F);H&&(S.disabled=H._f.disabled||g,Array.isArray(H._f.refs)&&H._f.refs.forEach(O=>{O.disabled=H._f.disabled||g}))},0,!1))},Oe=(g,S)=>async F=>{let H;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let O=fe(i);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:W}=await M();j(),s.errors=P,O=fe(W)}else await I(a);if(l.disabled.size)for(const P of l.disabled)me(O,P);if(me(s.errors,"root"),we(s.errors)){h.state.next({errors:{}});try{await g(O,F)}catch(P){H=P}}else S&&await S({...s.errors},F),ke(),setTimeout(ke);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(s.errors)&&!H,submitCount:s.submitCount+1,errors:s.errors}),H)throw H},Ve=(g,S={})=>{z(a,g)&&(ce(S.defaultValue)?U(g,fe(z(r,g))):(U(g,S.defaultValue),ie(r,g,fe(S.defaultValue))),S.keepTouched||me(s.touchedFields,g),S.keepDirty||(me(s.dirtyFields,g),s.isDirty=S.defaultValue?D(g,fe(z(r,g))):D()),S.keepError||(me(s.errors,g),f.isValid&&b()),h.state.next({...s}))},Me=(g,S={})=>{const F=g?fe(g):r,H=fe(F),O=we(g),P=O?r:H;if(S.keepDefaultValues||(r=F),!S.keepValues){if(S.keepDirtyValues){const W=new Set([...l.mount,...Object.keys(Ze(r,i))]);for(const se of Array.from(W)){const ae=z(s.dirtyFields,se),je=z(i,se),Ue=z(P,se);ae&&!ce(je)?ie(P,se,je):!ae&&!ce(Ue)&&U(se,Ue)}}else{if(Mn&&ce(g))for(const W of l.mount){const se=z(a,W);if(se&&se._f){const ae=Array.isArray(se._f.refs)?se._f.refs[0]:se._f.ref;if(St(ae)){const je=ae.closest("form");if(je){je.reset();break}}}}if(S.keepFieldsRef)for(const W of l.mount)U(W,z(P,W));else a={}}i=n.shouldUnregister?S.keepDefaultValues?fe(r):{}:fe(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}l={mount:S.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!S.keepIsValid||!!S.keepDirtyValues||!n.shouldUnregister&&!we(P),o.watch=!!n.shouldUnregister,o.keepIsValid=!!S.keepIsValid,o.action=!1,S.keepErrors||(s.errors={}),h.state.next({submitCount:S.keepSubmitCount?s.submitCount:0,isDirty:O?!1:S.keepDirty?s.isDirty:!!(S.keepDefaultValues&&!Fe(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})},ne=(g,S)=>Me(Ne(g)?g(i):g,{...n.resetOptions,...S}),xe=(g,S={})=>{const F=z(a,g),H=F&&F._f;if(H){const O=H.refs?H.refs[0]:H.ref;O.focus&&setTimeout(()=>{O.focus(),S.shouldSelect&&Ne(O.select)&&O.select()})}},Te=g=>{s={...s,...g}},ge={control:{register:De,unregister:te,getFieldState:Q,handleSubmit:Oe,setError:ee,_subscribe:X,_runSchema:M,_updateIsValidating:j,_focusError:ke,_getWatch:T,_getDirty:D,_setValid:b,_setFieldArray:N,_setDisabledField:ye,_setErrors:v,_getFieldArray:_,_reset:Me,_resetDefaultValues:()=>Ne(n.defaultValues)&&n.defaultValues().then(g=>{ne(g,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:A,_disableForm:Pe,_subjects:h,_proxyFormState:f,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(g){o=g},get _defaultValues(){return r},get _names(){return l},set _names(g){l=g},get _formState(){return s},get _options(){return n},set _options(g){n={...n,...g}}},subscribe:ue,trigger:re,register:De,handleSubmit:Oe,watch:oe,setValue:U,getValues:q,reset:ne,resetField:Ve,clearErrors:K,unregister:te,setError:ee,setFocus:xe,getFieldState:Q};return{...ge,formControl:ge}}function zc(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:o,...l}=Rc(e);n.current={...l,formState:a}}const i=n.current.control;return i._options=e,_n(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),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 o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),p.useEffect(()=>{var o;e.values&&!Fe(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),s.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),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(()=>Xa(a,i),[i,a]),n.current}function Bc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function Vc(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 Uc(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 Hc(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 qc(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 Rn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Rn();const Wc={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:"$"},Qt=()=>({id:Rn(),amount:0,glAccount:null,isTaxDeductible:!1}),rr=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:m=!0,canEditTaxDeductible:f=!0,isDisabled:x=!1,labels:h,classNames:y={},"data-testid":w,control:b,name:j,rules:N})=>{const C={...Wc,...h},v=b!==void 0&&j!==void 0,k=zc({defaultValues:{_internal:n||Qt()}}),L=Nc({control:v?b:k.control,name:v?j:"_internal",rules:v?N:void 0}),[$,M]=p.useState(n||Qt()),E=v?L.field.value??Qt():e??$,I=v&&!!L.fieldState?.error,A=v&&(L.fieldState?.isTouched??!1),D=I||A,T=D&&(!E.amount||E.amount<=0),_=D&&!E.glAccount,[Y,V]=p.useState(E.glAccount?.name||""),U=p.useCallback(ee=>{const oe={...E,...ee};v&&L.field.onChange(oe),!v&&e===void 0&&M(oe),i?.(oe)},[E,e,i,v,L]),Z=p.useCallback(ee=>{const oe=ee||0;U({amount:oe}),o?.(oe)},[U,o]),J=p.useCallback(ee=>{V(ee),r?.(ee)},[r]),re=p.useCallback(ee=>{if(ee===null){U({glAccount:null}),l?.(null);return}const X=s.find(ue=>String(ue.id)===String(ee))||null;U({glAccount:X}),l?.(X)},[s,U,l]),q=p.useCallback(()=>{V(""),U({glAccount:null}),l?.(null)},[U,l]),Q=p.useCallback(ee=>{U({isTaxDeductible:ee}),d?.(ee)},[U,d]),K=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":w||"revenue-distribution-card",className:c.cn(y.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",y.body),children:[t.jsx("div",{className:c.cn("shrink-0",y.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:E.amount||void 0,onValueChange:Z,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:y.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",y.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:E.glAccount?.name??Y,selectedKey:E.glAccount?.id??null,isDisabled:x,isInvalid:_,errorMessage:_?"GL Account is required":void 0,listboxProps:{emptyContent:a?C.searching:C.noGlAccountsFound},placeholder:C.glAccountPlaceholder,onInputChange:J,onSelectionChange:re,onClear:q,className:y.glAccountInput,children:ee=>t.jsx(c.AutocompleteItem,{textValue:ee.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:ee.name}),ee.code&&t.jsx("span",{className:"text-xs text-default-400",children:ee.code})]})},ee.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",y.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${w||"revenue-distribution-card"}-tax-deductible`,isSelected:E.isTaxDeductible,onValueChange:Q,isDisabled:x||!f,className:y.taxDeductibleCheckbox,children:C.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",y.deleteContainer),children:t.jsx(B,{"data-testid":`${w||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!m,onPress:K,startContent:t.jsx(R,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",y.deleteButton),children:C.deleteButton})})]})})};rr.displayName="RevenueDistributionCard";const ir=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(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:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};ir.displayName="RevenueDistributionEmpty";const Yc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},lr=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Yc,...n},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};lr.displayName="RevenueDistributionError";const or=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};or.displayName="RevenueDistributionSkeleton";function zn({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:m}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:f=>!f&&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(B,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(B,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:m,children:n.confirm})]})]})})}const Gc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function Is(e){return!e.fund&&Number(e.percentage||0)<=0}function Kc({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,o)=>i+Number(o.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const Qc={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"},cr={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={...cr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Zc={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"},Xc={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function Jc(){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 ed=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,td=e=>e.fund!==null;function nd({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:m,footer:f,onAssignmentsChange:x,onOpenFundPicker:h,onCloseFundPicker:y,onCollapseChange:w,onSave:b}){const[j,N]=p.useState(null),C=m??j??void 0,v={...Qc,...s},k=e.filter(X=>!Is(X)),$=k.filter(td).length>0,M=p.useMemo(()=>e.filter(X=>!Is(X)).reduce((X,ue)=>X+Number(ue.percentage||0),0),[e]),E=Math.round(M*100)/100,I=k.some(X=>!X.fund||Number(X.percentage||0)<=0),A=$&&(E!==100||I),D=`${v.totalError} (${v.total} ${Number(M.toFixed(2))}%)`,T=Kc({mode:"split",assignments:e}),_=$&&E>=100,[Y,V]=p.useState(!1),[U,Z]=p.useState(!1),J=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Jc,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:v.saved}):null]}),re=(X,ue)=>{x(e.map(te=>te.id===X?{...te,...ue}:te))},q=()=>{_||x([...e,Gc()])},Q=X=>{e.length<=1||x(e.filter(ue=>ue.id!==X))},K=()=>{if(!r){if(!T){Z(!0);return}if(!i){b();return}V(!0)}},ee=()=>{V(!1),b()},oe=X=>{const ue=u??e.find(te=>!te.fund)?.id??e[0]?.id;ue&&(x(e.map(te=>te.id===ue?{...te,fund:X}:te)),y())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!m&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:X=>w?.(!(X==="all"||Array.from(X).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:J,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:cr,color:"default",variant:"flat",title:v.emptySplit}),$&&t.jsx(sd,{assignments:e,labels:v,total:M,hasTotalError:U&&!T||A,validationMessage:D,onSelectFund:X=>h(X),onRemoveFund:Q,onPercentageChange:(X,ue)=>re(X,{percentage:ed(ue)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(B,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:_,onPress:()=>$?q():h(),children:v.assignSpecificFund}),t.jsx(B,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!T||r,onPress:K,children:v.saveAssignment})]})]}),f]})},"installment-fund-assignment")}),d&&t.jsx(ad,{funds:n,labels:v,selectedFundIds:e.map(X=>X.fund?.id).filter(Boolean),portalContainer:C,onSelect:oe,onClose:y}),t.jsx(zn,{isOpen:Y,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:Xc,onClose:()=>V(!1),onConfirm:ee})]})}function sd({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(B,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(B,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:m=>l(d.id,Number(m.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Zc})}),e.length>1&&t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(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 ad({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=p.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const m=o.trim().toLowerCase();return m?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(m):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:o,placeholder:n.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(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 [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(B,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function rd(){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 id={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function ld({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...id,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Zt,{label:l.totalAmount,value:d.format(e)}),t.jsx(Zt,{label:l.remainingBalance,value:d.format(n)}),t.jsx(Zt,{label:l.amountReceived,value:d.format(s)})]})})}function Zt({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 od={monthly:1,quarterly:3,annual:12},dr=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},cd=(e,n)=>new Date(e,n+1,0).getDate(),dd=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},ud=(e,n)=>{const{year:s,month:a,day:r}=dr(e),i=a-1+n,o=s+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,cd(o,l));return new Date(o,l,d)},fd=(e,n)=>{const{year:s,month:a,day:r}=dr(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function ur(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,o=od[n.frequency];return Array.from({length:s},(l,d)=>{const u=n.frequency==="weekly"?fd(n.firstInstallmentDate,d*7):ud(n.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:dd(u),amount:(r+(d===0?i:0))/100}})}function md(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 hd(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:md(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function xd(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function pd(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const gd={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},bd=["weekly","monthly","quarterly","annual"],yd=Array.from({length:31},(e,n)=>n+1),vd=["numberOfInstallments","frequency","firstInstallmentDate"],_s=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),At=e=>Math.round(e*100)/100,jd=(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)},_t=e=>{if(!e)return null;try{return ho(e)}catch{return null}},wd=e=>_t(e)?.day??1,Nd=(e,n)=>new Date(e,n,0).getDate(),Cd=(e,n)=>{const s=_t(e);if(!s)return e;const a=Math.min(n,Nd(s.year,s.month));return s.set({day:a}).toString()},Ps=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 kd({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:m=!0,inputs:f=vd,startDate:x,firstInstallmentDateOverride:h,labels:y,classNames:w,isSaving:b=!1,showSavedIndicator:j=!1,isModeSwitchDisabled:N=!1,onModeChange:C,onAutomaticSettingsChange:v,onInstallmentsChange:k,onSave:L,onCancel:$}){const[M,E]=p.useState(o),I={...gd,...y},A=e??M,D=p.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),T=p.useMemo(()=>({...i,firstInstallmentDate:f.includes("firstInstallmentDate")?i.firstInstallmentDate:f.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,f,x]),_=A==="automatic"?pd(ur(n,T),f.includes("firstInstallmentDate")?void 0:h):r,Y=p.useMemo(()=>At(_.reduce((te,ye)=>te+Number(ye.amount||0),0)),[_]),V=Math.abs(Y-n)>.009,U=At(n-Y)<=0,Z=p.useMemo(()=>hd(r),[r]),J=A==="manual"&&xd(Z),re=V||J,q=l?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:I.title}),j?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:I.saved}):null]}):void 0,Q=te=>{te!==A&&(e||E(te),C?.(te),te==="manual"&&r.length===0&&k([_s()]))},K=(te,ye)=>{r.find(ke=>ke.id===te)?.status!=="paid"&&k(r.map(ke=>ke.id===te?{...ke,...ye}:ke))},ee=()=>{k([...r,_s()])},oe=te=>{r.find(De=>De.id===te)?.status!=="paid"&&k(r.filter(De=>De.id!==te))},X=()=>{b||re||L?.()},ue=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",w?.content),children:[m||u||$?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[m?t.jsx(Sd,{mode:A,labels:I,onModeChange:Q,isDisabled:N,className:w?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[$?t.jsx(B,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:$,children:I.cancelEdit}):null,u?t.jsx(B,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||re,onPress:X,children:I.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",w?.preview),children:[A==="automatic"&&t.jsx($d,{settings:T,inputs:f,labels:I,className:w?.controls,onSettingsChange:v}),_.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:A==="automatic"?I.emptyAutomatic:I.emptyManual}),_.length>0&&t.jsx(Ad,{mode:A,installments:_,rowErrors:Z,labels:I,formatter:D,locale:a,onUpdateInstallment:K,onRemoveInstallment:oe}),A==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(B,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:U,onPress:ee,children:I.addInstallment})}),t.jsx(Md,{total:Y,donationAmount:n,hasTotalMismatch:V,mode:A,installments:_,formatter:D,labels:I,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":I.title,title:q,children:ue},"installment-schedule")}):ue})}function Sd({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 $d({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Le,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:bd.map(l=>t.jsx(c.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(wd(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Le,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Cd(e.firstInstallmentDate,u)})},children:yd.map(d=>t.jsx(c.SelectItem,{textValue:Ps(d),children:Ps(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Fn,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:_t(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(R,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function Ad({mode:e,installments:n,rowErrors:s,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:jd(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const m=s.missingDateRows.has(d.id),f=s.invalidDateRows.has(d.id),x=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Fn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:d.status==="paid",isInvalid:m||f,errorMessage:m?a.dueDateRequiredError:f?a.dateOrderError:void 0,value:_t(d.dueDate),onChange:h=>o(d.id,{dueDate:h?h.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Ed,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:d.status==="paid",isInvalid:x,errorMessage:a.amountGreaterThanZeroError,onAmountChange:h=>o(d.id,{amount:h})})}),t.jsx(Fd,{isDisabled:n.length<=1,isPaid:d.status==="paid",label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Dd=/^\d*(?:[.,]\d{0,2})?$/;function Ed({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Dd.test(u))return;l(u);const m=Number(u.replace(",","."));i(At(Number.isFinite(m)?m:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Fd({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(B,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress: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 Md({total:e,donationAmount:n,hasTotalMismatch:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,m=r[1]?.amount??u,f=d>1&&Math.round(u*100)!==Math.round(m*100),x=At(n-e),h=Math.max(x,0),y=Math.max(-x,0),w=s?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}):a==="automatic"?f?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(m)})," 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)}`:y>0?`Exceeds by: ${i.format(y)}`:`${o.remaining}: ${i.format(h)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:w})}function Ld(){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 Os={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"},fr={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"},Td={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",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."},Id={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},_d=[];function Pd({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=_d,showSavedIndicator:d=!1,labels:u,isSaving:m=!1,onEditInstallments:f,onPayInstallment:x,onDeleteInstallment:h}){const[y,w]=p.useState(null),b={...Td,...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(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:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,k=p.useMemo(()=>{const $=j.trim().toLowerCase();return $?e.filter(M=>{const E=M.status??"scheduled";return[Xt(M),M.id,M.amount,M.dueDate,jt(M.dueDate,s),Jt(M,b.paidOn,s),E,fr[E]??E].join(" ").toLowerCase().includes($)}):e},[s,e,j,b.paidOn]),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:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:j,placeholder:b.searchPlaceholder,onChange:$=>N($.target.value),startContent:t.jsx(R,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(B,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(R,{icon:"solar:pen-outline",className:"size-4"}),isLoading:m,onPress:f,children:b.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 E=$.status??"scheduled",I=Xt($),A=Jt($,b.paidOn,s);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:I||`PMT-${M+1}`})]}),t.jsx(Rs,{status:E})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:C.format($.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:jt($.dueDate,s)}),A?t.jsx("p",{className:"text-xs text-default-500",children:A}):null]})]}),t.jsx(zs,{status:E,installment:$,labels:b,portalContainer:y??void 0,showDelete:o,payNowHiddenStatuses:l,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:b.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:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[k.map(($,M)=>{const E=$.status??"scheduled",I=Xt($),A=Jt($,b.paidOn,s);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:I||`PMT-${M+1}`})}),t.jsx("td",{className:"px-2 py-3",children:C.format($.amount)}),t.jsxs("td",{className:"px-2 py-3",children:[jt($.dueDate,s),A?t.jsx("span",{className:"block text-xs",children:A}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Rs,{status:E})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(zs,{status:E,installment:$,labels:b,portalContainer:y??void 0,showDelete:o,payNowHiddenStatuses:l,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:b.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":b.title,title:v,children:L},"installment-table")}):L})}function Xt(e){return e.name?.trim()||e.id}function Jt(e,n,s){return e.status!=="paid"||!e.fulfilledAt?null:`${n} ${jt(e.fulfilledAt,s)}`}function Rs({status:e}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Os[e]??Os.scheduled),startContent:t.jsx(Rd,{status:e}),children:fr[e]??e})}function zs({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(B,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(R,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(n),children:s.payNow}):null,t.jsx(Od,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(n.id)})]})}function Od({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,o]=p.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(B,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(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:l=>{l==="delete"&&n&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(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(zn,{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:Id,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function Rd({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"})}const zd=/^\d{4}-\d{2}-\d{2}$/;function jt(e,n){const s=zd.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Bd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},Vd=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:m,className:f=""})=>{const x=Array.isArray(e)?e:[],[h,y]=p.useState(l),[w,b]=p.useState(o),j={...Bd,...r};p.useEffect(()=>{y(l)},[l]);const N=v=>{if(v===h){d&&m?.(v);return}y(v),m?.(v)},C=v=>{b(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",f),"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(pr,{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(mr,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:s,isSelected:h===v.id,onSelect:N},v.id))})]})},mr=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:m=!1,disabledReason:f,statusLabel:x,statusTone:h="default",className:y=""})=>{const w=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!m,j=f||x,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",m?"opacity-60":"",u?"rounded-2xl":"",y),"data-testid":"item-card","data-selected":l,isDisabled:m,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})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:w})]})})},Bs="w-full bg-gray-100",Vs={variant:"light",color:"default"},hr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:m,onPress:f,isPressable:x=!1,isDisabled:h=!1,compact:y=!1,className:w="",bodyClassName:b="",footerClassName:j="",dataTestId:N})=>{const C=!!(d&&d.value),v=!!u?.label,k=x&&!!f&&!v,L=!k,$=v?{variant:u?.variant??Vs.variant,color:u?.color??Vs.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",o,Bs,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,Bs,"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:f,isDisabled:h,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:M}),t.jsxs(c.CardBody,{className:c.cn("gap-3",y?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",y?"text-sm":""),children:n}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((E,I)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(R,{icon:E.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:E.label})]},`${E.label}-${I}`))}):null,(C||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",y?"pt-0.5":"",j),children:[C?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",y?"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(B,{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]}),m?t.jsx("div",{className:"pt-1",children:m}):null]})]})};hr.displayName="CatalogItemCard";const Ud={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Hd={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},qd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Wd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Yd={card:"mt-1",panel:"mt-[22px]"},Gd="bg-acct-page border-acct-border text-acct-muted",Kd={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Qd={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"},Zd={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"},Xd={empty:"status",error:"alert",success:"status",loading:"status"},Jd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function eu(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:Kd[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:o,role:l=Xd[e],ariaLive:d=Jd[e],iconSize:u=24,className:m,classNames:f={},"data-testid":x="feedback-state"}){const h=eu(e,i,u,f);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Ud[n],n==="card"?Qd[e]:"bg-transparent",m,f.base),children:[h?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",Hd[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Gd:Zd[e],f.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(qd[n],f.title),children:s}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(Wd[n],f.description),children:r}):null]}),o?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Yd[n],f.actions),children:o}):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 xr(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Bn.displayName="EmptyState";Vn.displayName="ErrorState";Un.displayName="LoadingState";xr.displayName="SuccessState";const pr=({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"})]})},tu={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"},nu=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),gr=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),su=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Hn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),Us=(e,n,s)=>{const a={};let r=s?n??su(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Hn(e)){a[i.id]??={},a[i.id][o.id]??={};const d=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},Hs=(e,n,s)=>`${e}::${n}::${s}`,au=(e,n,s)=>{const a=gr(n);for(const{exhibition:r,dateGroup:i,ticket:o}of Hn(e)){const l=n[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=s===void 0?o.max:Math.min(o.max,s-(a-l));if(d>0&&l<d)return!1}return!0},ru=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[o,l]=p.useState(()=>String(i)),[d,u]=p.useState(!1),m=d?o:String(i),f=()=>{r||i>=s||a?.(i+1)},x=()=>{r||i<=n||a?.(i-1)},h=v=>{if(r)return;l(v.target.value);const k=parseInt(v.target.value,10);isNaN(k)||a?.(Math.max(n,Math.min(s,k)))},y=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):l(String(L))},w=i<=n,b=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:m,onChange:h,onFocus:()=>u(!0),onBlur:y,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:f,disabled:r||b,className:c.cn(j,r||b?C:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},iu=({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})]})},lu=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const f=a();return Math.min(e.max,r-(f-n))},d=i?.locale??"en-US",u=i?.currency??"USD",m=nu(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:m.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:m.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(ru,{initialQuantity:n,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},ou=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,m)=>t.jsxs("div",{children:[t.jsx(lu,{item:u,quantity:r(e,n.id,u.id),onChange:f=>a(e,n.id,u.id,f),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),m<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),cu=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,m]=p.useState(d),f=n.dates.reduce((h,y)=>h+y.tickets.reduce((w,b)=>w+a(n.id,y.id,b.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:()=>m(!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:[f," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(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,y)=>t.jsx(ou,{exhibitionId:n.id,dateGroup:h,isLast:y===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},h.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},du=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=p.useMemo(()=>r??[],[r]),d={...tu,...s},[u,m]=p.useState(()=>Us(l,n,!0)),f=p.useRef(!1),x=p.useMemo(()=>{const N=Hn(l).map(({exhibition:C,dateGroup:v,ticket:k})=>[Hs(C.id,v.id,k.id),k]);return new Map(N)},[l]),h=au(l,u,n),y=(N,C,v)=>u[N]?.[C]?.[v]?.selectedQuantity??0,w=()=>gr(u),b=(N,C,v,k)=>{const L=y(N,C,v),$=w()-L;if(n!==void 0&&$+k>n)return;const M=x.get(Hs(N,C,v));if(!M)return;const E={...u,[N]:{...u[N],[C]:{...u[N]?.[C],[v]:{id:v,selectedQuantity:k,originalPrice:M.originalPrice,discountedPrice:M.price}}}};m(E),o?.(E)},j=N=>{const C=Us(l,n,N);m(C),o?.(C)};return p.useEffect(()=>{!f.current&&h&&(o?.(u),f.current=!0)},[h,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(iu,{label:d.selectAllButtonLabel,checked:h,onChange:j})]}),l.map(N=>t.jsx(cu,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:y,getTotalSelectedTickets:w,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},N.id))]})},en={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},tn=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},uu=(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},fu=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,br=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:m,onClear:f,appliedCount:x,countAriaLabel:h,countDisplay:y="badge",confirmLabel:w=en.confirm,clearLabel:b=en.clear,isOpen:j,defaultOpen:N=!1,onOpenChange:C,isDisabled:v=!1,closeOnConfirm:k=!0,keepOpenAfterClear:L=!1})=>{const[$,M]=p.useState(N),[E,I]=p.useState(()=>tn(u)),A=j??$,D=x??u.filter(q=>fu(q)).length,T=q=>{q&&I(tn(u)),j||M(q),C?.(q)},_=(q,Q)=>{I(K=>({...K,[q.id]:Q}))},Y=(q,Q)=>{I(K=>({...K,[q.id]:Q?[Q]:[]}))},V=async()=>{I(tn(u.map(q=>q.type==="checkbox"?{...q,selectedValues:[]}:{...q,selectedValue:null}))),await f(),L||T(!1)},U=async()=>{const q=uu(E,u);await m(q),k&&T(!1)},Z=q=>{if(q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:q.label,value:E[q.id]??[],onValueChange:K=>_(q,K),children:q.options.map(K=>t.jsx(c.Checkbox,{value:K.value,isDisabled:K.isDisabled,children:K.label},K.value))},q.id);const Q=E[q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:q.label,value:Q,onValueChange:K=>Y(q,K||null),children:q.options.map(K=>t.jsx(c.Radio,{value:K.value,isDisabled:K.isDisabled,children:K.label},K.value))},q.id)},J=p.useMemo(()=>D>0?h?.(D)||`${D} filters applied`:void 0,[h,D]),re=p.useMemo(()=>D===0?e||en.noLabel:h?h(D):`${e} (${D})`,[D,e,h]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:A,onOpenChange:T,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(B,{isDisabled:v,variant:a,color:r,size:i,className:o,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":A,children:[t.jsx(R,{icon:s,width:16}),t.jsx("span",{children:e}),y==="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":J,children:D}):y==="summary"&&re!==e?t.jsx("span",{className:"text-xs",children:re}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(q=>Z(q)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(B,{variant:"light",color:"default",size:"sm",onPress:V,children:b}),t.jsx(B,{color:"primary",size:"sm",onPress:U,children:w})]})]})})]})})};br.displayName="FilterPopover";const mu="No sessions available for this date",hu=e=>e==="sold-out"||e==="closed"?"danger":"success",xu=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"},qs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",pu=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,yr=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=mu,statusLabel:u,statusTone:m,sessionAriaLabel:f,dayButtonClassName:x,calendarSlot:h,dayGroupAriaLabel:y,sessionGridAriaLabel:w,className:b,headingClassName:j,subheadingClassName:N})=>{const C=pu(s,a),v=s.find(E=>E.date===C),k=i??s.map(E=>({date:E.date,label:E.label})),L=v?.sessions??[],$=E=>E===C?"solid":"bordered",M=E=>{if(!qs(E)){if(E.id===o){l(null);return}l(E.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",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":y||"Session days",children:[k.map(E=>t.jsx(B,{size:"sm",variant:$(E.date),color:"default",className:c.cn("rounded-full",x),isDisabled:E.isDisabled,onPress:()=>{r(E.date)},children:t.jsx("span",{children:E.label})},E.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(E=>{const I=qs(E),A=E.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!I,onPress:()=>{M(E)},"aria-disabled":I,"aria-pressed":I?void 0:A,className:c.cn("w-full",I?"bg-gray-100 opacity-70":"",A?"w-full ring-2 ring-gray-900":""),"aria-label":f?f(E,{isSelected:A,isUnavailable:I}):I?`${E.startTime} ${E.endTime} sold out`:`${E.startTime} ${E.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:[E.startTime," – ",E.endTime]}),t.jsx(c.Chip,{size:"sm",color:m?m(E):hu(E.status),variant:"flat",children:u?u(E):xu(E)})]})})},E.id)})]})]})};yr.displayName="SessionTimeline";const gu=(e,n)=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,vr=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header"})=>{const m=gu(a,r);return t.jsxs("header",{"data-testid":u,className:c.cn("flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:"flex items-center gap-4",children:[m?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:m}):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(o,{"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]})};vr.displayName="PageHeader";const bu={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},yu={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"}},jr=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(s==="dot"){const d=yu[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color: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??bu[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),children:n})};jr.displayName="StatusChip";const vu={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",vu[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 wr=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:o={},"data-testid":l="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":l,className:c.cn("w-full",i,o.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":`${l}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((m,f)=>{const x=f===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:a,width:m==="fill"?"60%":m}})},f)})},u))})]});wr.displayName="TableSkeleton";const Nr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Cr="px-4 text-[13.5px] text-acct-ink2 align-middle",kr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Sr="w-full",$r="border-t border-acct-border px-5 py-3.5",Ar=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:o={},"data-testid":l="admin-table"})=>t.jsxs("div",{className:c.cn(i,o.base),"data-testid":l,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Sr,o.table),th:c.cn(Nr,o.th),tr:c.cn(kr,o.tr),td:c.cn(Cr,o.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":`${l}-footer`,className:c.cn($r,o.footer),children:a}):null]});Ar.displayName="AdminTable";const ju={md:"w-[280px]",lg:"w-[360px]"},Dr=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:o,searchWidth:l="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:ju[l],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,o?t.jsx("div",{className:"ml-auto",children:o}):null]});Dr.displayName="AdminToolbar";const wu="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",Nu="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",Er=p.forwardRef(function({icon:n,children:s,count:a,className:r,testId:i,...o},l){return t.jsxs(B,{ref:l,"data-testid":i,variant:"light",size:"sm",className:c.cn(Nu,r),...o,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:wu,children:a})]})});Er.displayName="ToolbarButton";function Fr({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:o=>s(String(o)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(o=>t.jsx(c.Tab,{title:o.label,"data-testid":`${i}-${o.key}`,children:o.content},o.key))})}Fr.displayName="UnderlineTabs";const Wn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Yn="font-normal normal-case tracking-normal",Mr=["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(" "),Lr="text-[13.5px] text-acct-ink",Tr="bg-acct-page text-acct-muted cursor-default",Ir="mt-[5px] text-xs text-acct-sub",_r="mt-[5px] text-xs text-acct-danger",Pr=({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]});Pr.displayName="AdminFieldLabel";const Or=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:m=!1,className:f,"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:o,autoFocus:d,isInvalid:m,description:!m&&u?u:void 0,errorMessage:m?u:void 0,onValueChange:a,"data-testid":x,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",f),label:Wn,inputWrapper:Mr,input:c.cn(Lr,(l||o)&&"font-mono",o&&Tr),description:Ir,errorMessage:_r}});Or.displayName="AdminTextField";const Cu={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Rr=({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(B,{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",Cu[n]),children:r.icon},r.key))});Rr.displayName="RowActions";const zr=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":m="picker-row"})=>{const f=e!=null;return t.jsxs("div",{"data-testid":m,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(B,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${m}-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,f?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),f&&a?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${m}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};zr.displayName="PickerRow";function Br(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 Vr=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,className:i,classNames:o={},"data-testid":l="pagination-summary"})=>{const{from:d,to:u}=Br(e,n,s),m=c.cn("font-semibold text-default-700",o.emphasis);return t.jsxs("p",{"data-testid":l,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,o.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${l}-range`,className:m,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${l}-total`,className:m,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};Vr.displayName="PaginationSummary";const Ur=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:m,emptyTitle:f="Nothing here yet",emptyDescription:x,emptyIcon:h,emptyActions:y,emptyContent:w,children:b,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=m??t.jsx(Vn,{title:i,description:o,classNames:v,"data-testid":`${C}-error`,actions:u??(d?t.jsx(B,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):s?k=w??t.jsx(Bn,{title:f,description:x,icon:h,actions:y,classNames:v,"data-testid":`${C}-empty`}):k=b,t.jsx("section",{"data-testid":C,className:c.cn("rounded-xl bg-white p-2 shadow-sm",j,N.base),children:k})};Ur.displayName="ListPanel";const ku=350,Su={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}"},nn=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),$u=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,autoFocus:d=!1,className:u,"data-testid":m="cash-tender-form"})=>{const f={...Su,...i},x=Tt(e.currency,r),h=n!==void 0,[y,w]=p.useState(s??null),b=h?n:y,j=p.useMemo(()=>{const T=typeof b=="number"&&Number.isFinite(b)?b:0,_=fn(T,e.value,e.currency,r);return{received:T,change:_>0?_:0,isValid:T>=e.value&&T>0}},[b,e.value,e.currency,r]),N=p.useCallback(T=>{const _=T.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]),C=p.useCallback(T=>{if(o)return;const _=T.replace(/[^\d.,]/g,"").replace(",","."),Y=_===""?null:Number.parseFloat(_),V=Y===null||Number.isNaN(Y)?null:Y;if(V!==null&&l!==void 0&&V>l)return;h||w(V);const U=typeof V=="number"&&Number.isFinite(V)?V:0,Z=fn(U,e.value,e.currency,r);a?.({received:U,change:Z>0?Z:0,isValid:U>=e.value&&U>0})},[h,o,e.value,e.currency,r,a,l]),v=b==null?"":String(b),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),[E,I]=p.useState(""),A=p.useRef(null);p.useEffect(()=>{A.current&&clearTimeout(A.current);const T=k?nn(f.changeMessageTemplate,{change:$}):"",_=k?ku:0;return A.current=setTimeout(()=>I(T),_),()=>{A.current&&clearTimeout(A.current)}},[k,$,f.changeMessageTemplate]);const D=`${m}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":m,children:[t.jsx(c.Input,{id:D,label:f.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:f.receivedPlaceholder,isDisabled:o,isInvalid:L,errorMessage:L?nn(f.insufficientMessageTemplate,{due:M}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${m}-received-input`}),k&&t.jsx(c.Alert,{"data-testid":`${m}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:nn(f.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:E})]})},Au={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Ws=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Hr=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:m=!1,className:f,"data-testid":x="check-tender-form"})=>{const h={...Au,...r},y=n!==void 0,[w,b]=p.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Ws()}),[j,N]=p.useState(!!s?.checkNumber),C=p.useMemo(()=>y?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Ws()}:w,[y,n,w]),v=p.useCallback(A=>{y||b(A);const D=A.checkNumber.trim(),T={amount:e.value,checkNumber:D,bankName:A.bankName.trim()||void 0,date:i?void 0:A.date,isValid:D.length>0&&e.value>0};a?.(T)},[y,e.value,i,a]),k=p.useCallback(A=>D=>{l||(A==="checkNumber"&&D.length>0&&N(!0),v({...C,[A]:D}))},[C,v,l]),L=p.useCallback(()=>{l||N(!0)},[l]),$=j&&C.checkNumber.trim()==="",M=`${x}-check-number`,E=`${x}-bank-name`,I=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",f),"data-testid":x,children:[t.jsx(c.Input,{id:M,label:h.checkNumberLabel,labelPlacement:"outside",type:"text",value:C.checkNumber,onChange:A=>k("checkNumber")(A.target.value),onBlur:L,placeholder:h.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:$,errorMessage:$?h.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:m,"data-testid":`${x}-check-number-input`}),!o&&t.jsx(c.Input,{id:E,label:h.bankNameLabel,labelPlacement:"outside",type:"text",value:C.bankName,onChange:A=>k("bankName")(A.target.value),placeholder:h.bankNamePlaceholder,maxLength:u,isDisabled:l,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:A=>k("date")(A.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};Hr.displayName="CheckTenderForm";const Du={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Eu=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],qr=({dueAmount:e,methodOptions:n=Eu,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const m={...Du,...i},f=s!==void 0,[x,h]=p.useState({method:a?.method??"",reference:a?.reference??""}),y=p.useMemo(()=>f?{method:s?.method??"",reference:s?.reference??""}:x,[f,s,x]),w=p.useCallback(k=>n.find(L=>L.value===k)?.label??"",[n]),b=p.useCallback(k=>{f||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?.($)},[f,e.value,r,w]),j=p.useCallback(k=>{if(l)return;const L=typeof k=="string"?k:Array.from(k)[0]?.toString()??"";b({...y,method:L})},[y,b,l]),N=p.useCallback(k=>{l||b({...y,reference:k})},[y,b,l]),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(Le,{id:C,label:m.methodLabel,labelPlacement:"outside",placeholder:m.methodPlaceholder,selectedKeys:y.method?[y.method]:[],onSelectionChange:j,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(k=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${k.value}`,children:k.label},k.value))}),o&&t.jsx(c.Input,{id:v,label:m.referenceLabel,labelPlacement:"outside",type:"text",value:y.reference,onChange:k=>N(k.target.value),placeholder:m.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};qr.displayName="OtherTenderForm";const Fu={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Mu={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Lu={pending:"warning",recorded:"success",failed:"danger"},Tu=e=>e==="pending"||e==="recorded",Iu=e=>`#${e+1}`,Wr=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:o,"data-testid":l="split-payment-summary"})=>{const d={...Fu,...r},{collected:u,remaining:m,isComplete:f}=p.useMemo(()=>{const h=n.reduce((w,b)=>Tu(b.status)?w+b.amount:w,0),y=Math.max(e.value-h,0);return{collected:h,remaining:y,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",o),"data-testid":l,children:[t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${l}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:f?d.completeLabel:d.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${l}-remaining-amount`,children:pe(f?u:m,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${l}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:d.collectedHeading}),n.map((h,y)=>t.jsx(_u,{index:y,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:`${l}-row-${y}`},h.id))]})]})};Wr.displayName="SplitPaymentSummary";const _u=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const m=i?t.jsx(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(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:Iu(e)}),t.jsx(R,{icon:Mu[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:Lu[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:o}),m&&(r?m:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:m})}))]})},Pu=`
15
+ ${h?"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(z,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(Y.ZoomIn,{size:16})})})]})}function Xo({editor:e,isDisabled:n=!1}){const[s,a]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),h=e.isActive("link"),f=m=>{if(m){const{from:g,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const C=e.schema.marks.link,v=e.state.doc.resolve(g),S=ns.getMarkRange(v,C);S&&(w=e.state.doc.textBetween(S.from,S.to,""))}else w=e.state.doc.textBetween(g,j,"");const N=e.getAttributes("link").href||"";i(w),o(N),u(b)}a(m)},x=()=>{if(l.trim()){const{from:m,to:g}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(m),w=ns.getMarkRange(b,j),N=w?.from??m,C=w?.to??g,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:f,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(z,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(Y.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:m=>i(m.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:m=>o(m.target.value),onKeyDown:m=>m.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(z,{size:"sm",color:"primary",onPress:x,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function Jo({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 Oa(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=_e[o];if(d)try{const u=d.canExecute?.(e)??!0,h=d.isActive?.(e)??!1;i[o]={isActive:h,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=_e[d];if(u)try{const h=u.canExecute?.(e)??!0,f=u.isActive?.(e)??!1;l[d]={isActive:f,isDisabled:!h,canExecute:h}}catch(h){console.warn(`Extension not available for modifier: ${d}`,h),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 za(e,n){const s=p.useCallback((l,o)=>{if(!e)return;const d=_e[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=_e[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=_e[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 ec(e=ve.default){const[n,s]=p.useState(e),a=p.useCallback((o=ve.step)=>{s(d=>Math.min(ve.max,d+o))},[]),r=p.useCallback((o=ve.step)=>{s(d=>Math.max(ve.min,d-o))},[]),i=p.useCallback(()=>{s(ve.default)},[]),l=p.useCallback(o=>{const d=Math.max(ve.min,Math.min(ve.max,o));s(d)},[]);return{zoom:n,setZoom:l,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ve.min,isMaxZoom:n>=ve.max,isDefaultZoom:n===ve.default}}const tc=["bold","italic","strike","underline","code"];function nc({editor:e,modifiers:n,onToolbarAction:s}){const a=Oa(e,n),{toggleModifier:r}=za(e,s);if(!e)return null;const i=n.map(l=>ut(l)).filter(l=>tc.includes(l));return i.length===0?null:t.jsx(Jo,{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 sc({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:l}){const o=Oa(e,n),{toggleModifier:d,executeCommand:u}=za(e,l);if(!e)return null;const h=n.map(A=>ut(A)),f=h.some(A=>["bold","italic","strike","underline","code"].includes(A)),x=h.some(A=>["textColor","highlight"].includes(A)),m=h.includes("heading"),g=h.includes("textAlign"),j=h.some(A=>["bulletList","orderedList","taskList"].includes(A)),b=h.includes("blockquote"),w=h.includes("codeBlock"),N=h.includes("link"),C=h.includes("horizontalRule"),v=h.some(A=>["undo","redo"].includes(A)),S=s!==void 0&&a!==void 0,L=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${L} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[f&&t.jsxs(t.Fragment,{children:[t.jsx(nc,{editor:e,modifiers:n,onToolbarAction:l}),(x||m||g||j||b||w||N||C||v||S)&&t.jsx(He,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[h.includes("textColor")&&t.jsx(Ns,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),h.includes("highlight")&&t.jsx(Ns,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(m||g||j||b||w||N||C||v||S)&&t.jsx(He,{})]}),m&&t.jsxs(t.Fragment,{children:[t.jsx(Uo,{editor:e}),(g||j||b||w||N||C||v||S)&&t.jsx(He,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const k=Ko[A],E=e.isActive({textAlign:A});return t.jsx(qe,{icon:k,label:`Align ${A}`,isActive:E,onClick:()=>u("textAlign",{type:"textAlign",alignment:A})},A)})}),(j||b||w||N||C||v||S)&&t.jsx(He,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(Ho,{editor:e,types:h.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(b||w||N||C||v||S)&&t.jsx(He,{})]}),(b||w||N||C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),w&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(Xo,{editor:e,isDisabled:o.link?.isDisabled}),C&&t.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(v||S)&&t.jsx(He,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[h.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),h.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(He,{})]}),S&&t.jsx(Zo,{zoom:s,onZoomChange:A=>{a?.(A),l?.({type:"zoom",modifier:`${A}%`})}})]})})}const st={bold:{category:"mark",extension:Di.Bold,priority:100},italic:{category:"mark",extension:Ei.Italic,priority:100},strike:{category:"mark",extension:Fi.Strike,priority:100},underline:{category:"mark",extension:Mi.Underline,priority:100},code:{category:"mark",extension:Li.Code,priority:100},textColor:{category:"mark",extension:Ti.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Ii.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:_i.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ri.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:zi.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Bi.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Vi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:qi.CodeBlock,priority:100},blockquote:{category:"node",extension:Wi.Blockquote,priority:100},horizontalRule:{category:"node",extension:Gi.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Yi.HardBreak,priority:100},undo:{category:"extension",extension:ss.History,priority:50},redo:{category:"extension",extension:ss.History,priority:50},textAlign:{category:"extension",extension:Ki.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}},ac=[Qi.Document,Zi.Text,Oi.Paragraph,Pi.TextStyle.configure({HTMLAttributes:{}}),Hi.ListItem.configure({HTMLAttributes:{}}),Ui.TaskItem.configure({nested:!0}),Xi.Dropcursor,Ji.Gapcursor];function rc(e){const n=[],s=new Set,a=new Set;ac.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 h=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(h),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 h=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(h),s.add(o),a.add(u)}),n.sort((o,d)=>{const u=Object.values(st).find(m=>m?.extension?.name===o.name),h=Object.values(st).find(m=>m?.extension?.name===d.name),f=u?.priority??100;return(h?.priority??100)-f})}const Ba={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"]},ic={h1:`font-size: ${de.fontSize["4xl"]}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${de.fontSize["2xl"]}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${de.fontSize.xl}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${de.fontSize.lg}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${de.fontSize.base}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${de.fontSize.sm}; font-weight: ${de.fontWeight.semibold}; line-height: ${de.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${de.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: ${de.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: ${de.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${de.fontFamily.mono};`,pre:`background: ${be.neutral.gray[800]}; border-radius: ${le.sm}; color: ${be.neutral.gray[100]}; font-family: ${de.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;"},lc={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 oc(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(lc)){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(ic)){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 cc=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=jn.useCurrentEditor();return t.jsx(sc,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},dc=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=jn.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"]})]})},hn=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=Ba.full,variant:u="bordered",initialContent:h,content:f,onContentChange:x,onUpdate:m,onToolbarAction:g,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...N}=e,{zoom:C,setZoom:v}=ec(),S=ws.lineHeight,L=s*S,A=r?void 0:a*S,k=p.useMemo(()=>rc(d),[d]),{Component:E,label:I,shouldLabelBeOutside:D,getBaseProps:F,getLabelProps:T,getInputWrapperProps:_}=c.useInput({...N,variant:u,ref:n,isMultiline:!0}),W=I?t.jsx("label",{...T(),children:I}):null,U=p.useCallback(({editor:B})=>{const X=B.getHTML(),Q=w?oc(X):X,ne=B.getJSON(),q=B.getText(),Z=q.length,K=q.split(/\s+/).filter(oe=>oe.length>0).length,J={html:Q,json:ne,text:q,characters:Z,words:K};if(x?.(J),m?.(J),"onChange"in N&&typeof N.onChange=="function"){const oe={target:{value:Q},currentTarget:{value:Q}};N.onChange(oe)}},[x,m,N,w]);return t.jsxs(E,{...F(),children:[D?W:null,t.jsx("div",{..._(),className:c.cn(_().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:A?`${A+ws.toolbarHeight}px`:void 0,overflow:A?"auto":void 0},children:t.jsx(jn.EditorProvider,{editable:!j&&!b,slotBefore:o?t.jsx(cc,{modifiers:d,zoom:C,onZoomChange:v,onToolbarAction:g}):void 0,slotAfter:t.jsx(dc,{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:k,content:f||h||e.defaultValue||"",onUpdate:U})})]})});hn.displayName="TipTapEditor";const Va=p.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(hn,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(hn,{...r,variant:a,ref:n}))});Va.displayName="RichTextArea";function uc(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 Cs=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],fc={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Ua=({presetAmounts:e=Cs,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:h,mobileColumns:f=2,desktopColumns:x=3,isDisabled:m=!1,buttonVariant:g="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:N="",showCard:C=!0})=>{const v={...fc,...h},S=Array.isArray(e)?e:Cs,L={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"},k=`${L[f]} ${A[x]}`,[E,I]=Lt(n,s,a),[D,F]=p.useState(""),[T,_]=p.useState(!1),[W,U]=p.useState(0),B=p.useCallback(Z=>{if(m)return;const K={amount:Z.amount,isCustom:!1,presetId:Z.id};I(K),F(""),_(!1),U(J=>J+1),r?.(K)},[m,I,r]),X=p.useCallback(Z=>{if(m)return;if(F(Z!==void 0?String(Z):""),r){I(null);return}if(Z===void 0||isNaN(Z)){I(null);return}I({amount:Z,isCustom:!0})},[m,I,r]),Q=p.useCallback(()=>{if(m)return;const Z=D!==""?parseFloat(D):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[m,D,r]),ne=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}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",k),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const K=E!==null&&!E.isCustom&&E.presetId===Z.id;return t.jsx(z,{color:K?"primary":j,variant:K?"solid":g,className:"w-full",onPress:()=>B(Z),isDisabled:m,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||uc(Z.amount,l,i)},Z.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:b,radius:"full",size:w,minValue:d,maxValue:u,step:.01,formatOptions:ne,value:D!==""?parseFloat(D):void 0,onValueChange:X,isDisabled:m,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${W}`:E?.isCustom===!1?E.presetId:"custom"),r&&t.jsx(z,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:Q,isDisabled:m||!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})};Ua.displayName="DonationAmounts";const mc=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`},hc=e=>{switch(e){case"warning":return Y.Clock;case"error":return Y.AlertCircle;case"success":return Y.CheckCircle;default:return Y.Clock}},xc=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"}},Ha=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:h=!0,formatTime:f=mc,className:x,...m},g)=>{const[j,b]=Lt(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),w=p.useRef(null),N=p.useRef(!1);p.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),p.useEffect(()=>{if(!h||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(L=>L<=1?(w.current&&(clearInterval(w.current),w.current=null),N.current||(N.current=!0,a?.()),0):L-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[h,j,b,a]),p.useEffect(()=>{j>0&&(N.current=!1)},[j]);const C=d||hc(r),v=xc(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${l} ${f(j)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",v,S[u],x),...m,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: ${f(j)}`,"data-testid":"expire-cart-timer-value",children:f(j)})})]})})})});Ha.displayName="ExpireCartTimer";const Yt=({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(O,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),pc=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:h,labels:f})=>{const[x,m]=p.useState(!1),[g,j]=p.useState(!1),b=p.useRef(null);return p.useEffect(()=>{const w=()=>{if(b.current){const N=b.current.scrollHeight>b.current.clientHeight;j(N)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[l]),t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&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:f.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Yt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Yt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Yt,{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:b,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&&g&&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"})]}),(g||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(z,{onPress:()=>m(!x),variant:"light",className:c.cn("text-primary",h),size:d?"sm":"md",startContent:t.jsx(O,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?f.showLess||"Hide":f.showMore||"Show"})})]})]})]})};function xn(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 gc(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 bc={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"},Ye=e=>typeof e=="number"&&!isNaN(e),Ct=({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:h="default",showCard:f=!0,showDescription:x=!0,showPeopleCount:m=!0,showPrice:g=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:N="default",compact:C=!1,isSoldOut:v,isMaxReached:S,isRuleBlocked:L,statusTone:A="default",statusLabel:k,disabledReason:E,disabled:I})=>{const D=p.useMemo(()=>({...bc,...l}),[l]),[F,T]=p.useState(s),_=n!==void 0?n:F,W=!!(d||I),U=C||!!e.compact,B=p.useMemo(()=>typeof v=="boolean"?v:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ye(e.totalTicketsSold)||!Ye(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[v,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),X=p.useMemo(()=>typeof S=="boolean"?S:typeof e.isMaxReached=="boolean"?e.isMaxReached:B||!Ye(e.ticketsAllowed)?!1:_>=e.ticketsAllowed-(e.totalTicketsSold??0),[S,e.isMaxReached,B,e.ticketsAllowed,e.totalTicketsSold,_]),Q=p.useMemo(()=>typeof L=="boolean"?L:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[L,e.isRuleBlocked]),ne=E||e.disabledReason,q=W||B||Q,Z=se=>{if(q||se>0&&X)return;const xe=Math.max(0,_+se);n===void 0&&T(xe),a?.(e.id,xe)},K=p.useMemo(()=>{if(B)return"soldOut";if(Q)return"ruleBlocked";if(W)return"disabled"},[B,Q,W]),J=p.useMemo(()=>A||(B||Q?"danger":X?"warning":"default"),[A,B,Q,X]),oe=p.useMemo(()=>{if(K)return K==="ruleBlocked"?k||ne||D.ruleBlocked:K==="soldOut"?k||ne||D.soldOut:K==="disabled"?k||ne||D.disabled:k||D.maxReached},[K,k,ne,D]),ee={soldOut:"danger",ruleBlocked:J,disabled:"default",maxReached:"warning"},ue={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},te=()=>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",b.name),children:e.name}),ye=()=>{if(!g)return null;const se=j?.price??e.price,xe=j?.originalPrice,Te=xn(se,i,r);if(o?.renderPrice)return o.renderPrice(se,Te,e);if(Ye(xe)&&Ye(se)&&xe>se){const ge=xn(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",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",ge,", discounted price ",Te]}),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",b.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",b.discountedPrice),children:Te})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",U&&"text-sm mt-0.5",b.price),children:Te})},De=()=>!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",b.description),children:e.description}),ke=()=>{if(!m||!Ye(e.numberOfPeople)||e.numberOfPeople<=0)return null;const se=e.numberOfPeople===1?D.person:D.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,se,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",U&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(O,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",se]})},Pe=()=>{const se=_===0||q,xe=X||q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:_,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:se,isIncrementDisabled:xe,isDisabled:q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(z,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:se,variant:u,color:_>0?N:h,radius:"full",isIconOnly:!0,size:U?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(O,{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(z,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:xe,variant:u,color:_>0?N:h,radius:"full",isIconOnly:!0,size:U?"md":"sm","aria-label":"Increase quantity",children:t.jsx(O,{icon:"gravity-ui:plus",width:16})})]})},Re=(se,xe)=>o?.renderDisabledState?o.renderDisabledState(se,xe):se==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(xe):se==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(xe):t.jsx(c.Chip,{"data-testid":ue[se],color:ee[se],variant:se==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",se==="maxReached"?"h-8":"h-10",se==="soldOut"&&b.soldOut,se==="maxReached"&&b.maxReachedAlert,U&&"h-8"),startContent:t.jsx(O,{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:[te(),ye(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",U?"mb-1":"mb-2"),children:[ke(),De()]})]}),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",b.compactFooter),children:K&&oe?Re(K,oe):Pe()})]}),Me=X&&!B&&!Q&&!W?t.jsx(Ce.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Re("maxReached",oe||D.maxReached)}):null;return f?t.jsxs(c.Card,{className:c.cn("w-full",U&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",U?"pb-0.5":"",b.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Me&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",U?"pt-1":"",b.footer),children:Me})})]}):t.jsxs("div",{className:c.cn("w-full",U&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",U?"pb-0.5":"",b.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Me&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",U?"pt-1":"",b.footer),children:Me})})]})};Ct.displayName="OfferCard";const qa=({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(O,{"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})};qa.displayName="OfferCardEmpty";const yc={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Wa=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...yc,...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})};Wa.displayName="OfferCardError";const vc={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ga=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=vc[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))})};Ga.displayName="OfferCardSkeleton";const Ya={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ka={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"}}},jc={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Qa=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:h=!1,buttonVariant:f="bordered",buttonColor:x="default",showCard:m=!0,animated:g=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[N,C]=p.useState(a),v=s!==void 0?s:N,S=p.useCallback((D,F)=>{const T={...v,[D]:Math.max(0,F)};s===void 0&&C(T),r?.(T),i?.(D,T[D])},[v,s,r,i]),L=[...e].sort((D,F)=>(D.position??0)-(F.position??0)),A=D=>{const F=n?n(D):D,T=(v??{})[F.id]||0;return{offer:F,quantity:T,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:h,buttonVariant:f,buttonColor:x,showCard:m,compact:b}},k=jc[j],E=c.cn("grid mx-auto pt-2",k,w.base),I=D=>{const F=A(D);return t.jsx(Ct,{offer:F.offer,quantity:F.quantity,onQuantityChange:F.onQuantityChange,currency:F.currency,locale:F.locale,labels:F.labels,slots:F.slots,isDisabled:F.isDisabled,buttonVariant:F.buttonVariant,buttonColor:F.buttonColor,showCard:F.showCard,compact:F.compact,classNames:w.card},F.offer.id)};return g?t.jsx(Ce.motion.div,{"data-testid":"offer-card-list",className:E,variants:Ya,initial:"hidden",animate:"show",children:t.jsx(Ce.AnimatePresence,{children:L.map(D=>{const F=A(D);return t.jsx(Ce.motion.div,{"data-testid":`offer-card-list-item-${F.offer.id}`,className:w.cardWrapper,variants:Ka,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Ct,{offer:F.offer,quantity:F.quantity,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:h,buttonVariant:f,buttonColor:x,showCard:m,compact:b||F.offer.compact,classNames:w.card})},F.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:E,children:L.map(I)})};Qa.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Se=e=>e==null;const Za=e=>typeof e=="object";var he=e=>!Se(e)&&!Array.isArray(e)&&Za(e)&&!We(e),Xa=e=>he(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,wc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ja=(e,n)=>e.has(wc(n)),Nc=e=>{const n=e.constructor&&e.constructor.prototype;return he(n)&&n.hasOwnProperty("isPrototypeOf")},Ln=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fe(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Ln&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(he(e)&&Nc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=fe(e[r]));return a}var It=e=>/^\w*$/.test(e),ce=e=>e===void 0,Tn=e=>Array.isArray(e)?e.filter(Boolean):[],In=e=>Tn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),V=(e,n,s)=>{if(!n||!he(e))return s;const a=(It(n)?[n]:In(n)).reduce((r,i)=>Se(r)?r:r[i],e);return ce(a)||a===e?ce(e[n])?s:e[n]:a},$e=e=>typeof e=="boolean",Ne=e=>typeof e=="function",ie=(e,n,s)=>{let a=-1;const r=It(n)?[n]:In(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=he(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const kt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ee={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"},er=p.createContext(null);er.displayName="HookFormControlContext";const _n=()=>p.useContext(er);var tr=(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]!==Ee.all&&(n._proxyFormState[l]=!a||Ee.all),s&&(s[l]=!0),e[l]}});return r};const Pn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Cc(e){const n=_n(),{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 Pn(()=>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(()=>tr(l,s,d.current,!1),[l,s])}var Ae=e=>typeof e=="string",pn=(e,n,s,a,r)=>Ae(e)?(a&&n.watch.add(e),V(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),V(s,i))):(a&&(n.watchAll=!0),s),gn=e=>Se(e)||!Za(e);function Fe(e,n,s=new WeakSet){if(gn(e)||gn(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)||he(l)&&he(o)||Array.isArray(l)&&Array.isArray(o)?!Fe(l,o,s):!Object.is(l,o))return!1}}return!0}function kc(e){const n=_n(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),h=p.useRef(void 0),f=p.useRef(s),x=p.useRef(a);u.current=o;const[m,g]=p.useState(()=>{const v=s._getWatch(a,d.current);return u.current?u.current(v):v}),j=p.useCallback(v=>{const S=pn(a,s._names,v||s._formValues,!1,d.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),b=p.useCallback(v=>{if(!i){const S=pn(a,s._names,v||s._formValues,!1,d.current);if(u.current){const L=u.current(S);Fe(L,h.current)||(g(L),h.current=L)}else g(S)}},[s._formValues,s._names,i,a]);Pn(()=>((f.current!==s||!Fe(x.current,a))&&(f.current=s,x.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:l,callback:v=>{b(v.values)}})),[s,l,a,b]),p.useEffect(()=>s._removeUnmounted());const w=f.current!==s,N=x.current,C=p.useMemo(()=>{if(i)return null;const v=!w&&!Fe(N,a);return w||v?j():null},[i,w,a,N,j]);return C!==null?C:m}function Sc(e){const n=_n(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Ja(r._names.array,s),u=p.useMemo(()=>V(r._formValues,s,V(r._defaultValues,s,l)),[r,s,l]),h=kc({control:r,name:s,defaultValue:u,exact:o}),f=Cc({control:r,name:s,exact:o}),x=p.useRef(e),m=p.useRef(void 0),g=p.useRef(r.register(s,{...e.rules,value:h,...$e(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const j=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!V(f.errors,s)},isDirty:{enumerable:!0,get:()=>!!V(f.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!V(f.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!V(f.validatingFields,s)},error:{enumerable:!0,get:()=>V(f.errors,s)}}),[f,s]),b=p.useCallback(v=>g.current.onChange({target:{value:Xa(v),name:s},type:kt.CHANGE}),[s]),w=p.useCallback(()=>g.current.onBlur({target:{value:V(r._formValues,s),name:s},type:kt.BLUR}),[s,r._formValues]),N=p.useCallback(v=>{const S=V(r._fields,s);S&&S._f&&v&&(S._f.ref={focus:()=>Ne(v.focus)&&v.focus(),select:()=>Ne(v.select)&&v.select(),setCustomValidity:L=>Ne(v.setCustomValidity)&&v.setCustomValidity(L),reportValidity:()=>Ne(v.reportValidity)&&v.reportValidity()})},[r._fields,s]),C=p.useMemo(()=>({name:s,value:h,...$e(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:w,ref:N}),[s,a,f.disabled,b,w,N,h]);return p.useEffect(()=>{const v=r._options.shouldUnregister||i,S=m.current;S&&S!==s&&!d&&r.unregister(S),r.register(s,{...x.current.rules,...$e(x.current.disabled)?{disabled:x.current.disabled}:{}});const L=(A,k)=>{const E=V(r._fields,A);E&&E._f&&(E._f.mount=k)};if(L(s,!0),v){const A=fe(V(r._options.defaultValues,s,x.current.defaultValue));ie(r._defaultValues,s,A),ce(V(r._formValues,s))&&ie(r._formValues,s,A)}return!d&&r.register(s),m.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:f,fieldState:j}),[C,f,j])}const $c=p.createContext(null);$c.displayName="HookFormContext";var Ac=(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],ks=()=>{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 nr(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&he(r)&&i){const l=nr(r,i);he(l)&&(s[a]=l)}else e[a]&&(s[a]=i)}return s}var we=e=>he(e)&&!Object.keys(e).length,Rn=e=>e.type==="file",St=e=>{if(!Ln)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},sr=e=>e.type==="select-multiple",On=e=>e.type==="radio",Dc=e=>On(e)||ft(e),Kt=e=>St(e)&&e.isConnected;function Ec(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=ce(e)?a++:e[n[a++]];return e}function Fc(e){for(const n in e)if(e.hasOwnProperty(n)&&!ce(e[n]))return!1;return!0}function me(e,n){const s=Array.isArray(n)?n:It(n)?[n]:In(n),a=s.length===1?e:Ec(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(he(a)&&we(a)||Array.isArray(a)&&Fc(a))&&me(e,s.slice(0,-1)),e}var Mc=e=>{for(const n in e)if(Ne(e[n]))return!0;return!1};function ar(e){return Array.isArray(e)||he(e)&&!Mc(e)}function bn(e,n={}){for(const s in e){const a=e[s];ar(a)?(n[s]=Array.isArray(a)?[]:{},bn(a,n[s])):ce(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=bn(n));for(const a in e){const r=e[a];if(ar(r))ce(n)||gn(s[a])?s[a]=bn(r,Array.isArray(r)?[]:{}):Ze(r,Se(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Fe(r,i)}}return s}const Ss={value:!1,isValid:!1},$s={value:!0,isValid:!0};var rr=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&&!ce(e[0].attributes.value)?ce(e[0].value)||e[0].value===""?$s:{value:e[0].value,isValid:!0}:$s:Ss}return Ss},ir=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>ce(e)?e:n?e===""?NaN:e&&+e:s&&Ae(e)?new Date(e):a?a(e):e;const As={isValid:!1,value:null};var lr=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,As):As;function Ds(e){const n=e.ref;return Rn(n)?n.files:On(n)?lr(e.refs).value:sr(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?rr(e.refs).value:ir(ce(n.value)?e.ref.value:n.value,e)}var Lc=(e,n,s,a)=>{const r={};for(const i of e){const l=V(n,i);l&&ie(r,i,l._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},$t=e=>e instanceof RegExp,at=e=>ce(e)?e:$t(e)?e.source:he(e)?$t(e.value)?e.value.source:e.value:e,Es=e=>({isOnSubmit:!e||e===Ee.onSubmit,isOnBlur:e===Ee.onBlur,isOnChange:e===Ee.onChange,isOnAll:e===Ee.all,isOnTouch:e===Ee.onTouched});const Fs="AsyncFunction";var Tc=e=>!!e&&!!e.validate&&!!(Ne(e.validate)&&e.validate.constructor.name===Fs||he(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===Fs)),Ic=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ms=(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=V(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(he(o)&&ot(o,n))break}}};function Ls(e,n,s){const a=V(e,s);if(a||It(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),l=V(n,i),o=V(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 _c=(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||Ee.all))},Pc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Rc=(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,Oc=(e,n)=>!Tn(V(e,n)).length&&me(e,n),zc=(e,n,s)=>{const a=lt(V(e,s));return ie(a,"root",n[s]),ie(e,s,a),e};function Ts(e,n,s="validate"){if(Ae(e)||Array.isArray(e)&&e.every(Ae)||$e(e)&&!e)return{type:s,message:Ae(e)?e:"",ref:n}}var Ke=e=>he(e)&&!$t(e)?e:{value:e,message:""},Is=async(e,n,s,a,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:h,min:f,max:x,pattern:m,validate:g,name:j,valueAsNumber:b,mount:w}=e._f,N=V(s,j);if(!w||n.has(j))return{};const C=o?o[0]:l,v=F=>{r&&C.reportValidity&&(C.setCustomValidity($e(F)?"":F||""),C.reportValidity())},S={},L=On(l),A=ft(l),k=L||A,E=(b||Rn(l))&&ce(l.value)&&ce(N)||St(l)&&l.value===""||N===""||Array.isArray(N)&&!N.length,I=Ac.bind(null,j,a,S),D=(F,T,_,W=Ie.maxLength,U=Ie.minLength)=>{const B=F?T:_;S[j]={type:F?W:U,message:B,ref:l,...I(F?W:U,B)}};if(i?!Array.isArray(N)||!N.length:d&&(!k&&(E||Se(N))||$e(N)&&!N||A&&!rr(o).isValid||L&&!lr(o).isValid)){const{value:F,message:T}=Ae(d)?{value:!!d,message:d}:Ke(d);if(F&&(S[j]={type:Ie.required,message:T,ref:C,...I(Ie.required,T)},!a))return v(T),S}if(!E&&(!Se(f)||!Se(x))){let F,T;const _=Ke(x),W=Ke(f);if(!Se(N)&&!isNaN(N)){const U=l.valueAsNumber||N&&+N;Se(_.value)||(F=U>_.value),Se(W.value)||(T=U<W.value)}else{const U=l.valueAsDate||new Date(N),B=ne=>new Date(new Date().toDateString()+" "+ne),X=l.type=="time",Q=l.type=="week";Ae(_.value)&&N&&(F=X?B(N)>B(_.value):Q?N>_.value:U>new Date(_.value)),Ae(W.value)&&N&&(T=X?B(N)<B(W.value):Q?N<W.value:U<new Date(W.value))}if((F||T)&&(D(!!F,_.message,W.message,Ie.max,Ie.min),!a))return v(S[j].message),S}if((u||h)&&!E&&(Ae(N)||i&&Array.isArray(N))){const F=Ke(u),T=Ke(h),_=!Se(F.value)&&N.length>+F.value,W=!Se(T.value)&&N.length<+T.value;if((_||W)&&(D(_,F.message,T.message),!a))return v(S[j].message),S}if(m&&!E&&Ae(N)){const{value:F,message:T}=Ke(m);if($t(F)&&!N.match(F)&&(S[j]={type:Ie.pattern,message:T,ref:l,...I(Ie.pattern,T)},!a))return v(T),S}if(g){if(Ne(g)){const F=await g(N,s),T=Ts(F,C);if(T&&(S[j]={...T,...I(Ie.validate,T.message)},!a))return v(T.message),S}else if(he(g)){let F={};for(const T in g){if(!we(F)&&!a)break;const _=Ts(await g[T](N,s),C,T);_&&(F={..._,...I(T,_.message)},v(_.message),a&&(S[j]=F))}if(!we(F)&&(S[j]={ref:C,...F},!a))return S}}return v(!0),S};const Bc={mode:Ee.onSubmit,reValidateMode:Ee.onChange,shouldFocusError:!0};function Vc(e={}){let n={...Bc,...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=he(n.defaultValues)||he(n.values)?fe(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:fe(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 h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...h};let x={...f};const m={array:ks(),state:ks()},g=n.criteriaMode===Ee.all,j=y=>$=>{clearTimeout(u),u=setTimeout(y,$)},b=async y=>{if(!l.keepIsValid&&!n.disabled&&(f.isValid||x.isValid||y)){let $;n.resolver?($=we((await k()).errors),w()):$=await I(a,!0),$!==s.isValid&&m.state.next({isValid:$})}},w=(y,$)=>{!n.disabled&&(f.isValidating||f.validatingFields||x.isValidating||x.validatingFields)&&((y||Array.from(o.mount)).forEach(M=>{M&&($?ie(s.validatingFields,M,$):me(s.validatingFields,M))}),m.state.next({validatingFields:s.validatingFields,isValidating:!we(s.validatingFields)}))},N=(y,$=[],M,H,R=!0,P=!0)=>{if(H&&M&&!n.disabled){if(l.action=!0,P&&Array.isArray(V(a,y))){const G=M(V(a,y),H.argA,H.argB);R&&ie(a,y,G)}if(P&&Array.isArray(V(s.errors,y))){const G=M(V(s.errors,y),H.argA,H.argB);R&&ie(s.errors,y,G),Oc(s.errors,y)}if((f.touchedFields||x.touchedFields)&&P&&Array.isArray(V(s.touchedFields,y))){const G=M(V(s.touchedFields,y),H.argA,H.argB);R&&ie(s.touchedFields,y,G)}(f.dirtyFields||x.dirtyFields)&&(s.dirtyFields=Ze(r,i)),m.state.next({name:y,isDirty:F(y,$),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else ie(i,y,$)},C=(y,$)=>{ie(s.errors,y,$),m.state.next({errors:s.errors})},v=y=>{s.errors=y,m.state.next({errors:s.errors,isValid:!1})},S=(y,$,M,H)=>{const R=V(a,y);if(R){const P=V(i,y,ce(M)?V(r,y):M);ce(P)||H&&H.defaultChecked||$?ie(i,y,$?P:Ds(R._f)):W(y,P),l.mount&&!l.action&&b()}},L=(y,$,M,H,R)=>{let P=!1,G=!1;const ae={name:y};if(!n.disabled){if(!M||H){(f.isDirty||x.isDirty)&&(G=s.isDirty,s.isDirty=ae.isDirty=F(),P=G!==ae.isDirty);const re=Fe(V(r,y),$);G=!!V(s.dirtyFields,y),re?me(s.dirtyFields,y):ie(s.dirtyFields,y,!0),ae.dirtyFields=s.dirtyFields,P=P||(f.dirtyFields||x.dirtyFields)&&G!==!re}if(M){const re=V(s.touchedFields,y);re||(ie(s.touchedFields,y,M),ae.touchedFields=s.touchedFields,P=P||(f.touchedFields||x.touchedFields)&&re!==M)}P&&R&&m.state.next(ae)}return P?ae:{}},A=(y,$,M,H)=>{const R=V(s.errors,y),P=(f.isValid||x.isValid)&&$e($)&&s.isValid!==$;if(n.delayError&&M?(d=j(()=>C(y,M)),d(n.delayError)):(clearTimeout(u),d=null,M?ie(s.errors,y,M):me(s.errors,y)),(M?!Fe(R,M):R)||!we(H)||P){const G={...H,...P&&$e($)?{isValid:$}:{},errors:s.errors,name:y};s={...s,...G},m.state.next(G)}},k=async y=>(w(y,!0),await n.resolver(i,n.context,Lc(y||o.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),E=async y=>{const{errors:$}=await k(y);if(w(y),y)for(const M of y){const H=V($,M);H?ie(s.errors,M,H):me(s.errors,M)}else s.errors=$;return $},I=async(y,$,M={valid:!0})=>{for(const H in y){const R=y[H];if(R){const{_f:P,...G}=R;if(P){const ae=o.array.has(P.name),re=R._f&&Tc(R._f);re&&f.validatingFields&&w([P.name],!0);const je=await Is(R,o.disabled,i,g,n.shouldUseNativeValidation&&!$,ae);if(re&&f.validatingFields&&w([P.name]),je[P.name]&&(M.valid=!1,$||e.shouldUseNativeValidation))break;!$&&(V(je,P.name)?ae?zc(s.errors,je,P.name):ie(s.errors,P.name,je[P.name]):me(s.errors,P.name))}!we(G)&&await I(G,$,M)}}return M.valid},D=()=>{for(const y of o.unMount){const $=V(a,y);$&&($._f.refs?$._f.refs.every(M=>!Kt(M)):!Kt($._f.ref))&&te(y)}o.unMount=new Set},F=(y,$)=>!n.disabled&&(y&&$&&ie(i,y,$),!Fe(q(),r)),T=(y,$,M)=>pn(y,o,{...l.mount?i:ce($)?r:Ae(y)?{[y]:$}:$},M,$),_=y=>Tn(V(l.mount?i:r,y,n.shouldUnregister?V(r,y,[]):[])),W=(y,$,M={})=>{const H=V(a,y);let R=$;if(H){const P=H._f;P&&(!P.disabled&&ie(i,y,ir($,P)),R=St(P.ref)&&Se($)?"":$,sr(P.ref)?[...P.ref.options].forEach(G=>G.selected=R.includes(G.value)):P.refs?ft(P.ref)?P.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(R)?G.checked=!!R.find(ae=>ae===G.value):G.checked=R===G.value||!!R)}):P.refs.forEach(G=>G.checked=G.value===R):Rn(P.ref)?P.ref.value="":(P.ref.value=R,P.ref.type||m.state.next({name:y,values:fe(i)})))}(M.shouldDirty||M.shouldTouch)&&L(y,R,M.shouldTouch,M.shouldDirty,!0),M.shouldValidate&&ne(y)},U=(y,$,M)=>{for(const H in $){if(!$.hasOwnProperty(H))return;const R=$[H],P=y+"."+H,G=V(a,P);(o.array.has(y)||he(R)||G&&!G._f)&&!We(R)?U(P,R,M):W(P,R,M)}},B=(y,$,M={})=>{const H=V(a,y),R=o.array.has(y),P=fe($);ie(i,y,P),R?(m.array.next({name:y,values:fe(i)}),(f.isDirty||f.dirtyFields||x.isDirty||x.dirtyFields)&&M.shouldDirty&&m.state.next({name:y,dirtyFields:Ze(r,i),isDirty:F(y,P)})):H&&!H._f&&!Se(P)?U(y,P,M):W(y,P,M),Ms(y,o)?m.state.next({...s,name:y,values:fe(i)}):m.state.next({name:l.mount?y:void 0,values:fe(i)})},X=async y=>{l.mount=!0;const $=y.target;let M=$.name,H=!0;const R=V(a,M),P=re=>{H=Number.isNaN(re)||We(re)&&isNaN(re.getTime())||Fe(re,V(i,M,re))},G=Es(n.mode),ae=Es(n.reValidateMode);if(R){let re,je;const Ue=$.type?Ds(R._f):Xa(y),Oe=y.type===kt.BLUR||y.type===kt.FOCUS_OUT,Si=!Ic(R._f)&&!n.resolver&&!V(s.errors,M)&&!R._f.deps||Rc(Oe,V(s.touchedFields,M),s.isSubmitted,ae,G),Pt=Ms(M,o,Oe);ie(i,M,Ue),Oe?(!$||!$.readOnly)&&(R._f.onBlur&&R._f.onBlur(y),d&&d(0)):R._f.onChange&&R._f.onChange(y);const Rt=L(M,Ue,Oe),$i=!we(Rt)||Pt;if(!Oe&&m.state.next({name:M,type:y.type,values:fe(i)}),Si)return(f.isValid||x.isValid)&&(n.mode==="onBlur"?Oe&&b():Oe||b()),$i&&m.state.next({name:M,...Pt?{}:Rt});if(!Oe&&Pt&&m.state.next({...s}),n.resolver){const{errors:es}=await k([M]);if(w([M]),P(Ue),H){const Ai=Ls(s.errors,a,M),ts=Ls(es,a,Ai.name||M);re=ts.error,M=ts.name,je=we(es)}}else w([M],!0),re=(await Is(R,o.disabled,i,g,n.shouldUseNativeValidation))[M],w([M]),P(Ue),H&&(re?je=!1:(f.isValid||x.isValid)&&(je=await I(a,!0)));H&&(R._f.deps&&(!Array.isArray(R._f.deps)||R._f.deps.length>0)&&ne(R._f.deps),A(M,je,re,Rt))}},Q=(y,$)=>{if(V(s.errors,$)&&y.focus)return y.focus(),1},ne=async(y,$={})=>{let M,H;const R=lt(y);if(n.resolver){const P=await E(ce(y)?y:R);M=we(P),H=y?!R.some(G=>V(P,G)):M}else y?(H=(await Promise.all(R.map(async P=>{const G=V(a,P);return await I(G&&G._f?{[P]:G}:G)}))).every(Boolean),!(!H&&!s.isValid)&&b()):H=M=await I(a);return m.state.next({...!Ae(y)||(f.isValid||x.isValid)&&M!==s.isValid?{}:{name:y},...n.resolver||!y?{isValid:M}:{},errors:s.errors}),$.shouldFocus&&!H&&ot(a,Q,y?R:o.mount),H},q=(y,$)=>{let M={...l.mount?i:r};return $&&(M=nr($.dirtyFields?s.dirtyFields:s.touchedFields,M)),ce(y)?M:Ae(y)?V(M,y):y.map(H=>V(M,H))},Z=(y,$)=>({invalid:!!V(($||s).errors,y),isDirty:!!V(($||s).dirtyFields,y),error:V(($||s).errors,y),isValidating:!!V(s.validatingFields,y),isTouched:!!V(($||s).touchedFields,y)}),K=y=>{y&&lt(y).forEach($=>me(s.errors,$)),m.state.next({errors:y?s.errors:{}})},J=(y,$,M)=>{const H=(V(a,y,{_f:{}})._f||{}).ref,R=V(s.errors,y)||{},{ref:P,message:G,type:ae,...re}=R;ie(s.errors,y,{...re,...$,ref:H}),m.state.next({name:y,errors:s.errors,isValid:!1}),M&&M.shouldFocus&&H&&H.focus&&H.focus()},oe=(y,$)=>Ne(y)?m.state.subscribe({next:M=>"values"in M&&y(T(void 0,$),M)}):T(y,$,!0),ee=y=>m.state.subscribe({next:$=>{Pc(y.name,$.name,y.exact)&&_c($,y.formState||f,Te,y.reRenderRoot)&&y.callback({values:{...i},...s,...$,defaultValues:r})}}).unsubscribe,ue=y=>(l.mount=!0,x={...x,...y.formState},ee({...y,formState:{...h,...y.formState}})),te=(y,$={})=>{for(const M of y?lt(y):o.mount)o.mount.delete(M),o.array.delete(M),$.keepValue||(me(a,M),me(i,M)),!$.keepError&&me(s.errors,M),!$.keepDirty&&me(s.dirtyFields,M),!$.keepTouched&&me(s.touchedFields,M),!$.keepIsValidating&&me(s.validatingFields,M),!n.shouldUnregister&&!$.keepDefaultValue&&me(r,M);m.state.next({values:fe(i)}),m.state.next({...s,...$.keepDirty?{isDirty:F()}:{}}),!$.keepIsValid&&b()},ye=({disabled:y,name:$})=>{if($e(y)&&l.mount||y||o.disabled.has($)){const R=o.disabled.has($)!==!!y;y?o.disabled.add($):o.disabled.delete($),R&&l.mount&&!l.action&&b()}},De=(y,$={})=>{let M=V(a,y);const H=$e($.disabled)||$e(n.disabled);return ie(a,y,{...M||{},_f:{...M&&M._f?M._f:{ref:{name:y}},name:y,mount:!0,...$}}),o.mount.add(y),M?ye({disabled:$e($.disabled)?$.disabled:n.disabled,name:y}):S(y,!0,$.value),{...H?{disabled:$.disabled||n.disabled}:{},...n.progressive?{required:!!$.required,min:at($.min),max:at($.max),minLength:at($.minLength),maxLength:at($.maxLength),pattern:at($.pattern)}:{},name:y,onChange:X,onBlur:X,ref:R=>{if(R){De(y,$),M=V(a,y);const P=ce(R.value)&&R.querySelectorAll&&R.querySelectorAll("input,select,textarea")[0]||R,G=Dc(P),ae=M._f.refs||[];if(G?ae.find(re=>re===P):P===M._f.ref)return;ie(a,y,{_f:{...M._f,...G?{refs:[...ae.filter(Kt),P,...Array.isArray(V(r,y))?[{}]:[]],ref:{type:P.type,name:y}}:{ref:P}}}),S(y,!1,void 0,P)}else M=V(a,y,{}),M._f&&(M._f.mount=!1),(n.shouldUnregister||$.shouldUnregister)&&!(Ja(o.array,y)&&l.action)&&o.unMount.add(y)}}},ke=()=>n.shouldFocusError&&ot(a,Q,o.mount),Pe=y=>{$e(y)&&(m.state.next({disabled:y}),ot(a,($,M)=>{const H=V(a,M);H&&($.disabled=H._f.disabled||y,Array.isArray(H._f.refs)&&H._f.refs.forEach(R=>{R.disabled=H._f.disabled||y}))},0,!1))},Re=(y,$)=>async M=>{let H;M&&(M.preventDefault&&M.preventDefault(),M.persist&&M.persist());let R=fe(i);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:G}=await k();w(),s.errors=P,R=fe(G)}else await I(a);if(o.disabled.size)for(const P of o.disabled)me(R,P);if(me(s.errors,"root"),we(s.errors)){m.state.next({errors:{}});try{await y(R,M)}catch(P){H=P}}else $&&await $({...s.errors},M),ke(),setTimeout(ke);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(s.errors)&&!H,submitCount:s.submitCount+1,errors:s.errors}),H)throw H},Ve=(y,$={})=>{V(a,y)&&(ce($.defaultValue)?B(y,fe(V(r,y))):(B(y,$.defaultValue),ie(r,y,fe($.defaultValue))),$.keepTouched||me(s.touchedFields,y),$.keepDirty||(me(s.dirtyFields,y),s.isDirty=$.defaultValue?F(y,fe(V(r,y))):F()),$.keepError||(me(s.errors,y),f.isValid&&b()),m.state.next({...s}))},Me=(y,$={})=>{const M=y?fe(y):r,H=fe(M),R=we(y),P=R?r:H;if($.keepDefaultValues||(r=M),!$.keepValues){if($.keepDirtyValues){const G=new Set([...o.mount,...Object.keys(Ze(r,i))]);for(const ae of Array.from(G)){const re=V(s.dirtyFields,ae),je=V(i,ae),Ue=V(P,ae);re&&!ce(je)?ie(P,ae,je):!re&&!ce(Ue)&&B(ae,Ue)}}else{if(Ln&&ce(y))for(const G of o.mount){const ae=V(a,G);if(ae&&ae._f){const re=Array.isArray(ae._f.refs)?ae._f.refs[0]:ae._f.ref;if(St(re)){const je=re.closest("form");if(je){je.reset();break}}}}if($.keepFieldsRef)for(const G of o.mount)B(G,V(P,G));else a={}}i=n.shouldUnregister?$.keepDefaultValues?fe(r):{}:fe(P),m.array.next({values:{...P}}),m.state.next({values:{...P}})}o={mount:$.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!f.isValid||!!$.keepIsValid||!!$.keepDirtyValues||!n.shouldUnregister&&!we(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!$.keepIsValid,l.action=!1,$.keepErrors||(s.errors={}),m.state.next({submitCount:$.keepSubmitCount?s.submitCount:0,isDirty:R?!1:$.keepDirty?s.isDirty:!!($.keepDefaultValues&&!Fe(y,r)),isSubmitted:$.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:R?{}:$.keepDirtyValues?$.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:$.keepDefaultValues&&y?Ze(r,y):$.keepDirty?s.dirtyFields:{},touchedFields:$.keepTouched?s.touchedFields:{},errors:$.keepErrors?s.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},se=(y,$)=>Me(Ne(y)?y(i):y,{...n.resetOptions,...$}),xe=(y,$={})=>{const M=V(a,y),H=M&&M._f;if(H){const R=H.refs?H.refs[0]:H.ref;R.focus&&setTimeout(()=>{R.focus(),$.shouldSelect&&Ne(R.select)&&R.select()})}},Te=y=>{s={...s,...y}},ge={control:{register:De,unregister:te,getFieldState:Z,handleSubmit:Re,setError:J,_subscribe:ee,_runSchema:k,_updateIsValidating:w,_focusError:ke,_getWatch:T,_getDirty:F,_setValid:b,_setFieldArray:N,_setDisabledField:ye,_setErrors:v,_getFieldArray:_,_reset:Me,_resetDefaultValues:()=>Ne(n.defaultValues)&&n.defaultValues().then(y=>{se(y,n.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:Pe,_subjects:m,_proxyFormState:f,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(y){l=y},get _defaultValues(){return r},get _names(){return o},set _names(y){o=y},get _formState(){return s},get _options(){return n},set _options(y){n={...n,...y}}},subscribe:ue,trigger:ne,register:De,handleSubmit:Re,watch:oe,setValue:B,getValues:q,reset:se,resetField:Ve,clearErrors:K,unregister:te,setError:J,setFocus:xe,getFieldState:Z};return{...ge,formControl:ge}}function Uc(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}=Vc(e);n.current={...o,formState:a}}const i=n.current.control;return i._options=e,Pn(()=>{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&&!Fe(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(()=>tr(a,i),[i,a]),n.current}function Hc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function qc(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 Wc(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 Gc(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 Yc(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 zn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}zn();const Kc={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:"$"},Qt=()=>({id:zn(),amount:0,glAccount:null,isTaxDeductible:!1}),or=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:h=!0,canEditTaxDeductible:f=!0,isDisabled:x=!1,labels:m,classNames:g={},"data-testid":j,control:b,name:w,rules:N})=>{const C={...Kc,...m},v=b!==void 0&&w!==void 0,S=Uc({defaultValues:{_internal:n||Qt()}}),L=Sc({control:v?b:S.control,name:v?w:"_internal",rules:v?N:void 0}),[A,k]=p.useState(n||Qt()),E=v?L.field.value??Qt():e??A,I=v&&!!L.fieldState?.error,D=v&&(L.fieldState?.isTouched??!1),F=I||D,T=F&&(!E.amount||E.amount<=0),_=F&&!E.glAccount,[W,U]=p.useState(E.glAccount?.name||""),B=p.useCallback(J=>{const oe={...E,...J};v&&L.field.onChange(oe),!v&&e===void 0&&k(oe),i?.(oe)},[E,e,i,v,L]),X=p.useCallback(J=>{const oe=J||0;B({amount:oe}),l?.(oe)},[B,l]),Q=p.useCallback(J=>{U(J),r?.(J)},[r]),ne=p.useCallback(J=>{if(J===null){B({glAccount:null}),o?.(null);return}const ee=s.find(ue=>String(ue.id)===String(J))||null;B({glAccount:ee}),o?.(ee)},[s,B,o]),q=p.useCallback(()=>{U(""),B({glAccount:null}),o?.(null)},[B,o]),Z=p.useCallback(J=>{B({isTaxDeductible:J}),d?.(J)},[B,d]),K=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${j||"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(O,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:E.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:g.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",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.glAccount,t.jsx(c.Tooltip,{content:C.glAccountTooltip,children:t.jsx(O,{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:E.glAccount?.name??W,selectedKey:E.glAccount?.id??null,isDisabled:x,isInvalid:_,errorMessage:_?"GL Account is required":void 0,listboxProps:{emptyContent:a?C.searching:C.noGlAccountsFound},placeholder:C.glAccountPlaceholder,onInputChange:Q,onSelectionChange:ne,onClear:q,className:g.glAccountInput,children:J=>t.jsx(c.AutocompleteItem,{textValue:J.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:J.name}),J.code&&t.jsx("span",{className:"text-xs text-default-400",children:J.code})]})},J.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:E.isTaxDeductible,onValueChange:Z,isDisabled:x||!f,className:g.taxDeductibleCheckbox,children:C.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(z,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!h,onPress:K,startContent:t.jsx(O,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:C.deleteButton})})]})})};or.displayName="RevenueDistributionCard";const cr=({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(O,{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})};cr.displayName="RevenueDistributionEmpty";const Qc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},dr=({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})};dr.displayName="RevenueDistributionError";const ur=({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))})};ur.displayName="RevenueDistributionSkeleton";function Bn({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:h}){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:f=>!f&&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(z,{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(z,{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:h,children:n.confirm})]})]})})}const Zc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function _s(e){return!e.fund&&Number(e.percentage||0)<=0}function Xc({mode:e,assignments:n}){const s=n.filter(i=>i.fund),a=s.reduce((i,l)=>i+Number(l.percentage||0),0),r=n.some(i=>!i.fund||Number(i.percentage||0)<=0);return s.length>=1&&!r&&Math.round(a*100)/100===100}const Jc={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"},fr={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={...fr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},ed={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"},td={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function nd(){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 sd=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,ad=e=>e.fund!==null;function rd({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:h,footer:f,onAssignmentsChange:x,onOpenFundPicker:m,onCloseFundPicker:g,onCollapseChange:j,onSave:b}){const[w,N]=p.useState(null),C=h??w??void 0,v={...Jc,...s},S=e.filter(ee=>!_s(ee)),A=S.filter(ad).length>0,k=p.useMemo(()=>e.filter(ee=>!_s(ee)).reduce((ee,ue)=>ee+Number(ue.percentage||0),0),[e]),E=Math.round(k*100)/100,I=S.some(ee=>!ee.fund||Number(ee.percentage||0)<=0),D=A&&(E!==100||I),F=`${v.totalError} (${v.total} ${Number(k.toFixed(2))}%)`,T=Xc({mode:"split",assignments:e}),_=A&&E>=100,[W,U]=p.useState(!1),[B,X]=p.useState(!1),Q=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(nd,{}),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]}),ne=(ee,ue)=>{x(e.map(te=>te.id===ee?{...te,...ue}:te))},q=()=>{_||x([...e,Zc()])},Z=ee=>{e.length<=1||x(e.filter(ue=>ue.id!==ee))},K=()=>{if(!r){if(!T){X(!0);return}if(!i){b();return}U(!0)}},J=()=>{U(!1),b()},oe=ee=>{const ue=u??e.find(te=>!te.fund)?.id??e[0]?.id;ue&&(x(e.map(te=>te.id===ue?{...te,fund:ee}:te)),g())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!h&&"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:ee=>j?.(!(ee==="all"||Array.from(ee).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":v.title,title:Q,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!A&&t.jsx(c.Alert,{icon:t.jsx(O,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:fr,color:"default",variant:"flat",title:v.emptySplit}),A&&t.jsx(id,{assignments:e,labels:v,total:k,hasTotalError:B&&!T||D,validationMessage:F,onSelectFund:ee=>m(ee),onRemoveFund:Z,onPercentageChange:(ee,ue)=>ne(ee,{percentage:sd(ue)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(z,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(Y.Plus,{className:"size-5",strokeWidth:2}),isDisabled:_,onPress:()=>A?q():m(),children:v.assignSpecificFund}),t.jsx(z,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(O,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!T||r,onPress:K,children:v.saveAssignment})]})]}),f]})},"installment-fund-assignment")}),d&&t.jsx(ld,{funds:n,labels:v,selectedFundIds:e.map(ee=>ee.fund?.id).filter(Boolean),portalContainer:C,onSelect:oe,onClose:g}),t.jsx(Bn,{isOpen:W,labels:{title:v.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:v.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:v.modifyAssignedFundsWarning})]}),cancel:v.modifyAssignedFundsCancel,confirm:v.modifyAssignedFundsConfirm},icon:t.jsx(O,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:C,shouldBlockScroll:!1,classNames:td,onClose:()=>U(!1),onConfirm:J})]})}function id({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(z,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(z,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(Y.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:h=>o(d.id,Number(h.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:ed})}),e.length>1&&t.jsx(z,{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(O,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(O,{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 ld({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 h=l.trim().toLowerCase();return h?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(h):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:l,placeholder:n.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(O,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(z,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function od(){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 cd={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function dd({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:l}){const o={...cd,...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(Zt,{label:o.totalAmount,value:d.format(e)}),t.jsx(Zt,{label:o.remainingBalance,value:d.format(n)}),t.jsx(Zt,{label:o.amountReceived,value:d.format(s)})]})})}function Zt({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 ud={monthly:1,quarterly:3,annual:12},mr=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},fd=(e,n)=>new Date(e,n+1,0).getDate(),md=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},hd=(e,n)=>{const{year:s,month:a,day:r}=mr(e),i=a-1+n,l=s+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,fd(l,o));return new Date(l,o,d)},xd=(e,n)=>{const{year:s,month:a,day:r}=mr(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function hr(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=ud[n.frequency];return Array.from({length:s},(o,d)=>{const u=n.frequency==="weekly"?xd(n.firstInstallmentDate,d*7):hd(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:md(u),amount:(r+(d===0?i:0))/100}})}function pd(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 gd(e){return{missingDateRows:new Set(e.filter(n=>!n.dueDate).map(n=>n.id)),invalidDateRows:pd(e),invalidAmountRows:new Set(e.filter(n=>Number(n.amount||0)<=0).map(n=>n.id))}}function bd(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function yd(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const vd={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},jd=["weekly","monthly","quarterly","annual"],wd=Array.from({length:31},(e,n)=>n+1),Nd=["numberOfInstallments","frequency","firstInstallmentDate"],Ps=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),At=e=>Math.round(e*100)/100,Cd=(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)},_t=e=>{if(!e)return null;try{return go(e)}catch{return null}},kd=e=>_t(e)?.day??1,Sd=(e,n)=>new Date(e,n,0).getDate(),$d=(e,n)=>{const s=_t(e);if(!s)return e;const a=Math.min(n,Sd(s.year,s.month));return s.set({day:a}).toString()},Rs=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 Ad({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:h=!0,inputs:f=Nd,startDate:x,firstInstallmentDateOverride:m,labels:g,classNames:j,isSaving:b=!1,showSavedIndicator:w=!1,isModeSwitchDisabled:N=!1,onModeChange:C,onAutomaticSettingsChange:v,onInstallmentsChange:S,onSave:L,onCancel:A}){const[k,E]=p.useState(l),I={...vd,...g},D=e??k,F=p.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),T=p.useMemo(()=>({...i,firstInstallmentDate:f.includes("firstInstallmentDate")?i.firstInstallmentDate:f.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,f,x]),_=D==="automatic"?yd(hr(n,T),f.includes("firstInstallmentDate")?void 0:m):r,W=p.useMemo(()=>At(_.reduce((te,ye)=>te+Number(ye.amount||0),0)),[_]),U=Math.abs(W-n)>.009,B=At(n-W)<=0,X=p.useMemo(()=>gd(r),[r]),Q=D==="manual"&&bd(X),ne=U||Q,q=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Y.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:I.title}),w?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:I.saved}):null]}):void 0,Z=te=>{te!==D&&(e||E(te),C?.(te),te==="manual"&&r.length===0&&S([Ps()]))},K=(te,ye)=>{r.find(ke=>ke.id===te)?.status!=="paid"&&S(r.map(ke=>ke.id===te?{...ke,...ye}:ke))},J=()=>{S([...r,Ps()])},oe=te=>{r.find(De=>De.id===te)?.status!=="paid"&&S(r.filter(De=>De.id!==te))},ee=()=>{b||ne||L?.()},ue=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.content),children:[h||u||A?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[h?t.jsx(Dd,{mode:D,labels:I,onModeChange:Z,isDisabled:N,className:j?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[A?t.jsx(z,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:A,children:I.cancelEdit}):null,u?t.jsx(z,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(O,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||ne,onPress:ee,children:I.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",j?.preview),children:[D==="automatic"&&t.jsx(Ed,{settings:T,inputs:f,labels:I,className:j?.controls,onSettingsChange:v}),_.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:D==="automatic"?I.emptyAutomatic:I.emptyManual}),_.length>0&&t.jsx(Fd,{mode:D,installments:_,rowErrors:X,labels:I,formatter:F,locale:a,onUpdateInstallment:K,onRemoveInstallment:oe}),D==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(z,{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(Y.Plus,{className:"size-5",strokeWidth:2}),isDisabled:B,onPress:J,children:I.addInstallment})}),t.jsx(Id,{total:W,donationAmount:n,hasTotalMismatch:U,mode:D,installments:_,formatter:F,labels:I,className:j?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",j?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",j?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",j?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":I.title,title:q,children:ue},"installment-schedule")}):ue})}function Dd({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 Ed({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(Le,{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:jd.map(o=>t.jsx(c.SelectItem,{textValue:s[o],children:s[o]},o))})},l);if(l==="dayOfMonth"){const o=String(kd(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Le,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:$d(e.firstInstallmentDate,u)})},children:wd.map(d=>t.jsx(c.SelectItem,{textValue:Rs(d),children:Rs(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Mn,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:_t(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(O,{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 Fd({mode:e,installments:n,rowErrors:s,labels:a,formatter:r,locale:i,onUpdateInstallment:l,onRemoveInstallment:o}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Cd(d.dueDate,i)}),u===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((d,u)=>{const h=s.missingDateRows.has(d.id),f=s.invalidDateRows.has(d.id),x=s.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Mn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:d.status==="paid",isInvalid:h||f,errorMessage:h?a.dueDateRequiredError:f?a.dateOrderError:void 0,value:_t(d.dueDate),onChange:m=>l(d.id,{dueDate:m?m.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Ld,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:d.status==="paid",isInvalid:x,errorMessage:a.amountGreaterThanZeroError,onAmountChange:m=>l(d.id,{amount:m})})}),t.jsx(Td,{isDisabled:n.length<=1,isPaid:d.status==="paid",label:a.deleteInstallment,onRemove:()=>o(d.id)})]})},d.id)})})}const Md=/^\d*(?:[.,]\d{0,2})?$/;function Ld({amount:e,ariaLabel:n,isDisabled:s,isInvalid:a,errorMessage:r,onAmountChange:i}){const[l,o]=p.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":n,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:s,isInvalid:a,errorMessage:a?r:void 0,value:l??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Md.test(u))return;o(u);const h=Number(u.replace(",","."));i(At(Number.isFinite(h)?h:0))},onBlur:()=>o(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Td({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(z,{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(O,{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 Id({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,h=r[1]?.amount??u,f=d>1&&Math.round(u*100)!==Math.round(h*100),x=At(n-e),m=Math.max(x,0),g=Math.max(-x,0),j=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"?f?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(h)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${l.remaining}: ${i.format(m)}`;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:b}),title:j})}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 Os={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"},xr={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"},Pd={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",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."},Rd={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Od=[];function zd({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Od,showSavedIndicator:d=!1,labels:u,isSaving:h=!1,onEditInstallments:f,onPayInstallment:x,onDeleteInstallment:m}){const[g,j]=p.useState(null),b={...Pd,...u},[w,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(Y.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,S=p.useMemo(()=>{const A=w.trim().toLowerCase();return A?e.filter(k=>{const E=k.status??"scheduled";return[Xt(k),k.id,k.amount,k.dueDate,jt(k.dueDate,s),Jt(k,b.paidOn,s),E,xr[E]??E].join(" ").toLowerCase().includes(A)}):e},[s,e,w,b.paidOn]),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:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:w,placeholder:b.searchPlaceholder,onChange:A=>N(A.target.value),startContent:t.jsx(O,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(z,{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(O,{icon:"solar:pen-outline",className:"size-4"}),isLoading:h,onPress:f,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",S.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[S.map((A,k)=>{const E=A.status??"scheduled",I=Xt(A),D=Jt(A,b.paidOn,s);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",k+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:I||`PMT-${k+1}`})]}),t.jsx(zs,{status:E})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:C.format(A.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:jt(A.dueDate,s)}),D?t.jsx("p",{className:"text-xs text-default-500",children:D}):null]})]}),t.jsx(Bs,{status:E,installment:A,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:x,onDeleteInstallment:m})]})},A.id)}),S.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",S.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:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[S.map((A,k)=>{const E=A.status??"scheduled",I=Xt(A),D=Jt(A,b.paidOn,s);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:k+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:I||`PMT-${k+1}`})}),t.jsx("td",{className:"px-2 py-3",children:C.format(A.amount)}),t.jsxs("td",{className:"px-2 py-3",children:[jt(A.dueDate,s),D?t.jsx("span",{className:"block text-xs",children:D}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(zs,{status:E})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Bs,{status:E,installment:A,labels:b,portalContainer:g??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:x,onDeleteInstallment:m})})]},A.id)}),S.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:j,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:v,children:L},"installment-table")}):L})}function Xt(e){return e.name?.trim()||e.id}function Jt(e,n,s){return e.status!=="paid"||!e.fulfilledAt?null:`${n} ${jt(e.fulfilledAt,s)}`}function zs({status:e}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Os[e]??Os.scheduled),startContent:t.jsx(Vd,{status:e}),children:xr[e]??e})}function Bs({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(z,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(O,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:s.payNow}):null,t.jsx(Bd,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>o(n.id)})]})}function Bd({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(z,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(O,{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(O,{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(O,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Bn,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(O,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Rd,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Vd({status:e}){return e==="paid"?t.jsx(O,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(O,{icon:"solar:close-circle-bold",className:"size-3"}):e==="processing"?t.jsx(O,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(O,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(O,{icon:"solar:calendar-outline",className:"size-3"})}const Ud=/^\d{4}-\d{2}-\d{2}$/;function jt(e,n){const s=Ud.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Hd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},qd=({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:h,className:f=""})=>{const x=Array.isArray(e)?e:[],[m,g]=p.useState(o),[j,b]=p.useState(l),w={...Hd,...r};p.useEffect(()=>{g(o)},[o]);const N=v=>{if(v===m){d&&h?.(v);return}g(v),h?.(v)},C=v=>{b(v),u?.(v)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",f),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:m??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:w.title}),i&&t.jsx(yr,{title:w.renewalTitle,description:w.renewalDescription,value:j,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(pr,{itemKey:v.id,name:v.name,type:v.type,price:v.price,locale:n,currency:s,isSelected:m===v.id,onSelect:N},v.id))})]})},pr=({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:h=!1,disabledReason:f,statusLabel:x,statusTone:m="default",className:g=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!h,w=f||x,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",h?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":o,isDisabled:h,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),w&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:m,size:"sm",variant:"flat",className:"px-2",children:w})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Vs="w-full bg-gray-100",Us={variant:"light",color:"default"},gr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:h,onPress:f,isPressable:x=!1,isDisabled:m=!1,compact:g=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:N})=>{const C=!!(d&&d.value),v=!!u?.label,S=x&&!!f&&!v,L=!S,A=v?{variant:u?.variant??Us.variant,color:u?.color??Us.color,size:u?.size??"sm",isDisabled:m||u?.isDisabled,startContent:u?.icon?t.jsx(O,{icon:u.icon,width:16}):void 0}:null,k=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Vs,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,Vs,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(O,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",j),isPressable:S,onPress:f,isDisabled:m,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:k}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:n}),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((E,I)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(O,{icon:E.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:E.label})]},`${E.label}-${I}`))}):null,(C||v)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",w),children:[C?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),v&&L?t.jsx(z,{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]}),h?t.jsx("div",{className:"pt-1",children:h}):null]})]})};gr.displayName="CatalogItemCard";const Wd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Gd={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Yd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},Kd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Qd={card:"mt-1",panel:"mt-[22px]"},Zd="bg-acct-page border-acct-border text-acct-muted",Xd={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Jd={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"},eu={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"},tu={empty:"status",error:"alert",success:"status",loading:"status"},nu={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function su(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:Xd[e];return r?t.jsx(O,{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=tu[e],ariaLive:d=nu[e],iconSize:u=24,className:h,classNames:f={},"data-testid":x="feedback-state"}){const m=su(e,i,u,f);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",Wd[n],n==="card"?Jd[e]:"bg-transparent",h,f.base),children:[m?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",Gd[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Zd:eu[e],f.iconWrapper),children:m}):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(Yd[n],f.title),children:s}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(Kd[n],f.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Qd[n],f.actions),children:l}):null]})}function Vn(e){return t.jsx(et,{...e,variant:"empty"})}function Un(e){return t.jsx(et,{...e,variant:"error"})}function Hn(e){return t.jsx(et,{...e,variant:"loading"})}function br(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Vn.displayName="EmptyState";Un.displayName="ErrorState";Hn.displayName="LoadingState";br.displayName="SuccessState";const yr=({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"})]})},au={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"},ru=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),vr=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),iu=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,l)=>i+l.max,0),0),0),qn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),Hs=(e,n,s)=>{const a={};let r=s?n??iu(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of qn(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},qs=(e,n,s)=>`${e}::${n}::${s}`,lu=(e,n,s)=>{const a=vr(n);for(const{exhibition:r,dateGroup:i,ticket:l}of qn(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},ou=({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),h=d?l:String(i),f=()=>{r||i>=s||a?.(i+1)},x=()=>{r||i<=n||a?.(i-1)},m=v=>{if(r)return;o(v.target.value);const S=parseInt(v.target.value,10);isNaN(S)||a?.(Math.max(n,Math.min(s,S)))},g=v=>{const S=parseInt(v.target.value,10);if(u(!1),isNaN(S)){a?.(n);return}const L=Math.max(n,Math.min(s,S));L!==S?a?.(L):o(String(L))},j=i<=n,b=i>=s,w="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",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||j,className:c.cn(w,r||j?C:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:h,onChange:m,onFocus:()=>u(!0),onBlur:g,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:f,disabled:r||b,className:c.cn(w,r||b?C:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},cu=({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})]})},du=({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 f=a();return Math.min(e.max,r-(f-n))},d=i?.locale??"en-US",u=i?.currency??"USD",h=ru(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:h.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:h.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(ou,{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]})},uu=({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,h)=>t.jsxs("div",{children:[t.jsx(du,{item:u,quantity:r(e,n.id,u.id),onChange:f=>a(e,n.id,u.id,f),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),h<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),fu=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,h]=p.useState(d),f=n.dates.reduce((m,g)=>m+g.tickets.reduce((j,b)=>j+a(n.id,g.id,b.id),0),0),x=n.dates.some(m=>m.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:()=>h(!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:[f," ",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(O,{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((m,g)=>t.jsx(uu,{exhibitionId:n.id,dateGroup:m,isLast:g===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},m.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})})})})]})},mu=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...au,...s},[u,h]=p.useState(()=>Hs(o,n,!0)),f=p.useRef(!1),x=p.useMemo(()=>{const N=qn(o).map(({exhibition:C,dateGroup:v,ticket:S})=>[qs(C.id,v.id,S.id),S]);return new Map(N)},[o]),m=lu(o,u,n),g=(N,C,v)=>u[N]?.[C]?.[v]?.selectedQuantity??0,j=()=>vr(u),b=(N,C,v,S)=>{const L=g(N,C,v),A=j()-L;if(n!==void 0&&A+S>n)return;const k=x.get(qs(N,C,v));if(!k)return;const E={...u,[N]:{...u[N],[C]:{...u[N]?.[C],[v]:{id:v,selectedQuantity:S,originalPrice:k.originalPrice,discountedPrice:k.price}}}};h(E),l?.(E)},w=N=>{const C=Hs(o,n,N);h(C),l?.(C)};return p.useEffect(()=>{!f.current&&m&&(l?.(u),f.current=!0)},[m,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(cu,{label:d.selectAllButtonLabel,checked:m,onChange:w})]}),o.map(N=>t.jsx(fu,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:j,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},N.id))]})},en={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},tn=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},hu=(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},xu=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,jr=({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:h,onClear:f,appliedCount:x,countAriaLabel:m,countDisplay:g="badge",confirmLabel:j=en.confirm,clearLabel:b=en.clear,isOpen:w,defaultOpen:N=!1,onOpenChange:C,isDisabled:v=!1,closeOnConfirm:S=!0,keepOpenAfterClear:L=!1})=>{const[A,k]=p.useState(N),[E,I]=p.useState(()=>tn(u)),D=w??A,F=x??u.filter(q=>xu(q)).length,T=q=>{q&&I(tn(u)),w||k(q),C?.(q)},_=(q,Z)=>{I(K=>({...K,[q.id]:Z}))},W=(q,Z)=>{I(K=>({...K,[q.id]:Z?[Z]:[]}))},U=async()=>{I(tn(u.map(q=>q.type==="checkbox"?{...q,selectedValues:[]}:{...q,selectedValue:null}))),await f(),L||T(!1)},B=async()=>{const q=hu(E,u);await h(q),S&&T(!1)},X=q=>{if(q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:q.label,value:E[q.id]??[],onValueChange:K=>_(q,K),children:q.options.map(K=>t.jsx(c.Checkbox,{value:K.value,isDisabled:K.isDisabled,children:K.label},K.value))},q.id);const Z=E[q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:q.label,value:Z,onValueChange:K=>W(q,K||null),children:q.options.map(K=>t.jsx(c.Radio,{value:K.value,isDisabled:K.isDisabled,children:K.label},K.value))},q.id)},Q=p.useMemo(()=>F>0?m?.(F)||`${F} filters applied`:void 0,[m,F]),ne=p.useMemo(()=>F===0?e||en.noLabel:m?m(F):`${e} (${F})`,[F,e,m]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:D,onOpenChange:T,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(z,{isDisabled:v,variant:a,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":D,children:[t.jsx(O,{icon:s,width:16}),t.jsx("span",{children:e}),g==="badge"&&F>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":Q,children:F}):g==="summary"&&ne!==e?t.jsx("span",{className:"text-xs",children:ne}):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(z,{variant:"light",color:"default",size:"sm",onPress:U,children:b}),t.jsx(z,{color:"primary",size:"sm",onPress:B,children:j})]})]})})]})})};jr.displayName="FilterPopover";const pu="No sessions available for this date",gu=e=>e==="sold-out"||e==="closed"?"danger":"success",bu=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"},Ws=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",yu=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,wr=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=pu,statusLabel:u,statusTone:h,sessionAriaLabel:f,dayButtonClassName:x,calendarSlot:m,dayGroupAriaLabel:g,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:N})=>{const C=yu(s,a),v=s.find(E=>E.date===C),S=i??s.map(E=>({date:E.date,label:E.label})),L=v?.sessions??[],A=E=>E===C?"solid":"bordered",k=E=>{if(!Ws(E)){if(E.id===l){o(null);return}o(E.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",w),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[S.map(E=>t.jsx(z,{size:"sm",variant:A(E.date),color:"default",className:c.cn("rounded-full",x),isDisabled:E.isDisabled,onPress:()=>{r(E.date)},children:t.jsx("span",{children:E.label})},E.date)),m?t.jsx("div",{children:m}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":j||"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(E=>{const I=Ws(E),D=E.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!I,onPress:()=>{k(E)},"aria-disabled":I,"aria-pressed":I?void 0:D,className:c.cn("w-full",I?"bg-gray-100 opacity-70":"",D?"w-full ring-2 ring-gray-900":""),"aria-label":f?f(E,{isSelected:D,isUnavailable:I}):I?`${E.startTime} ${E.endTime} sold out`:`${E.startTime} ${E.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:[E.startTime," – ",E.endTime]}),t.jsx(c.Chip,{size:"sm",color:h?h(E):gu(E.status),variant:"flat",children:u?u(E):bu(E)})]})})},E.id)})]})]})};wr.displayName="SessionTimeline";const vu=(e,n)=>typeof e=="string"?t.jsx(O,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,Nr=({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 h=vu(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:[h?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:h}):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]})};Nr.displayName="PageHeader";const ju={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},wu={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"}},Cr=({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=wu[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??ju[e],variant:s,size:a,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),children:n})};Cr.displayName="StatusChip";const Nu={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"},Wn=({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",Nu[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})]});Wn.displayName="KeyValueChip";const kr=({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((h,f)=>{const x=f===e.length-1;return t.jsx("div",{className:c.cn(h==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:h==="fill"?void 0:{width:h},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:h==="fill"?"60%":h}})},f)})},u))})]});kr.displayName="TableSkeleton";const Sr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",$r="px-4 text-[13.5px] text-acct-ink2 align-middle",Ar="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Dr="w-full",Er="border-t border-acct-border px-5 py-3.5",Fr=({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(Dr,l.table),th:c.cn(Sr,l.th),tr:c.cn(Ar,l.tr),td:c.cn($r,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(Er,l.footer),children:a}):null]});Fr.displayName="AdminTable";const Cu={md:"w-[280px]",lg:"w-[360px]"},Mr=({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:Cu[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]});Mr.displayName="AdminToolbar";const ku="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",Su="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",Lr=p.forwardRef(function({icon:n,children:s,count:a,className:r,testId:i,...l},o){return t.jsxs(z,{ref:o,"data-testid":i,variant:"light",size:"sm",className:c.cn(Su,r),...l,children:[t.jsx(O,{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:ku,children:a})]})});Lr.displayName="ToolbarButton";function Tr({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))})}Tr.displayName="UnderlineTabs";const Gn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Yn="font-normal normal-case tracking-normal",Ir=["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(" "),_r="text-[13.5px] text-acct-ink",Pr="bg-acct-page text-acct-muted cursor-default",Rr="mt-[5px] text-xs text-acct-sub",Or="mt-[5px] text-xs text-acct-danger",zr=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Gn,s),children:[e,n?t.jsxs("span",{className:Yn,children:[" ",n]}):null]});zr.displayName="AdminFieldLabel";const Br=({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:h=!1,className:f,"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:h,description:!h&&u?u:void 0,errorMessage:h?u:void 0,onValueChange:a,"data-testid":x,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",f),label:Gn,inputWrapper:Ir,input:c.cn(_r,(o||l)&&"font-mono",l&&Pr),description:Rr,errorMessage:Or}});Br.displayName="AdminTextField";const $u={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Vr=({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(z,{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",$u[n]),children:r.icon},r.key))});Vr.displayName="RowActions";const Ur=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":h="picker-row"})=>{const f=e!=null;return t.jsxs("div",{"data-testid":h,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(z,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${h}-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,f?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]}),f&&a?t.jsx(z,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${h}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Ur.displayName="PickerRow";function Hr(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 qr=({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}=Hr(e,n,s),h=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:h,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:h,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};qr.displayName="PaginationSummary";const Wr=({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:h,emptyTitle:f="Nothing here yet",emptyDescription:x,emptyIcon:m,emptyActions:g,emptyContent:j,children:b,className:w,classNames:N={},"data-testid":C="list-panel"})=>{const v={base:c.cn("border-0 bg-transparent py-12",N.state)};let S;return e?S=r??t.jsx(Hn,{title:a,classNames:v,"data-testid":`${C}-loading`}):n?S=h??t.jsx(Un,{title:i,description:l,classNames:v,"data-testid":`${C}-error`,actions:u??(d?t.jsx(z,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):s?S=j??t.jsx(Vn,{title:f,description:x,icon:m,actions:g,classNames:v,"data-testid":`${C}-empty`}):S=b,t.jsx("section",{"data-testid":C,className:c.cn("rounded-xl bg-white p-2 shadow-sm",w,N.base),children:S})};Wr.displayName="ListPanel";const Au=350,Du={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}"},nn=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),Eu=({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":h="cash-tender-form"})=>{const f={...Du,...i},x=Tt(e.currency,r),m=n!==void 0,[g,j]=p.useState(s??null),b=m?n:g,w=p.useMemo(()=>{const T=typeof b=="number"&&Number.isFinite(b)?b:0,_=mn(T,e.value,e.currency,r);return{received:T,change:_>0?_:0,isValid:T>=e.value&&T>0}},[b,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(",","."),W=_===""?null:Number.parseFloat(_),U=W===null||Number.isNaN(W)?null:W;if(U!==null&&o!==void 0&&U>o)return;m||j(U);const B=typeof U=="number"&&Number.isFinite(U)?U:0,X=mn(B,e.value,e.currency,r);a?.({received:B,change:X>0?X:0,isValid:B>=e.value&&B>0})},[m,l,e.value,e.currency,r,a,o]),v=b==null?"":String(b),S=w.isValid&&w.change>0,L=!w.isValid&&w.received>0,A=pe(w.change,r,e.currency),k=pe(e.value,r,e.currency),[E,I]=p.useState(""),D=p.useRef(null);p.useEffect(()=>{D.current&&clearTimeout(D.current);const T=S?nn(f.changeMessageTemplate,{change:A}):"",_=S?Au:0;return D.current=setTimeout(()=>I(T),_),()=>{D.current&&clearTimeout(D.current)}},[S,A,f.changeMessageTemplate]);const F=`${h}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":h,children:[t.jsx(c.Input,{id:F,label:f.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:f.receivedPlaceholder,isDisabled:l,isInvalid:L,errorMessage:L?nn(f.insufficientMessageTemplate,{due:k}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${h}-received-input`}),S&&t.jsx(c.Alert,{"data-testid":`${h}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:nn(f.changeMessageTemplate,{change:A}),icon:t.jsx(O,{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:E})]})},Fu={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Gs=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Gr=({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:h=!1,className:f,"data-testid":x="check-tender-form"})=>{const m={...Fu,...r},g=n!==void 0,[j,b]=p.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Gs()}),[w,N]=p.useState(!!s?.checkNumber),C=p.useMemo(()=>g?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Gs()}:j,[g,n,j]),v=p.useCallback(D=>{g||b(D);const F=D.checkNumber.trim(),T={amount:e.value,checkNumber:F,bankName:D.bankName.trim()||void 0,date:i?void 0:D.date,isValid:F.length>0&&e.value>0};a?.(T)},[g,e.value,i,a]),S=p.useCallback(D=>F=>{o||(D==="checkNumber"&&F.length>0&&N(!0),v({...C,[D]:F}))},[C,v,o]),L=p.useCallback(()=>{o||N(!0)},[o]),A=w&&C.checkNumber.trim()==="",k=`${x}-check-number`,E=`${x}-bank-name`,I=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",f),"data-testid":x,children:[t.jsx(c.Input,{id:k,label:m.checkNumberLabel,labelPlacement:"outside",type:"text",value:C.checkNumber,onChange:D=>S("checkNumber")(D.target.value),onBlur:L,placeholder:m.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:A,errorMessage:A?m.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:h,"data-testid":`${x}-check-number-input`}),!l&&t.jsx(c.Input,{id:E,label:m.bankNameLabel,labelPlacement:"outside",type:"text",value:C.bankName,onChange:D=>S("bankName")(D.target.value),placeholder:m.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:I,label:m.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"})]})};Gr.displayName="CheckTenderForm";const Mu={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Lu=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Yr=({dueAmount:e,methodOptions:n=Lu,value:s,defaultValue:a,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const h={...Mu,...i},f=s!==void 0,[x,m]=p.useState({method:a?.method??"",reference:a?.reference??""}),g=p.useMemo(()=>f?{method:s?.method??"",reference:s?.reference??""}:x,[f,s,x]),j=p.useCallback(S=>n.find(L=>L.value===S)?.label??"",[n]),b=p.useCallback(S=>{f||m(S);const L=j(S.method),A={amount:e.value,method:S.method,description:L,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(A)},[f,e.value,r,j]),w=p.useCallback(S=>{if(o)return;const L=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";b({...g,method:L})},[g,b,o]),N=p.useCallback(S=>{o||b({...g,reference:S})},[g,b,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(Le,{id:C,label:h.methodLabel,labelPlacement:"outside",placeholder:h.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:w,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),l&&t.jsx(c.Input,{id:v,label:h.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:S=>N(S.target.value),placeholder:h.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Yr.displayName="OtherTenderForm";const Tu={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Iu={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},_u={pending:"warning",recorded:"success",failed:"danger"},Pu=e=>e==="pending"||e==="recorded",Ru=e=>`#${e+1}`,Kr=({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={...Tu,...r},{collected:u,remaining:h,isComplete:f}=p.useMemo(()=>{const m=n.reduce((j,b)=>Pu(b.status)?j+b.amount:j,0),g=Math.max(e.value-m,0);return{collected:m,remaining:g,isComplete:m>=e.value&&e.value>0}},[n,e.value]),x=m=>m==="pending"?d.statusPending:m==="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:f?d.completeLabel:d.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${o}-remaining-amount`,children:pe(f?u:h,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((m,g)=>t.jsx(Ou,{index:g,tender:m,locale:a,currency:e.currency,removable:!!s&&m.status!=="recorded",onRemove:s?()=>s(m.id):void 0,statusLabel:x(m.status),removeAriaLabel:d.removeAriaLabel,recordedTooltip:d.removeTooltipForRecorded,dataTestId:`${o}-row-${g}`},m.id))]})]})};Kr.displayName="SplitPaymentSummary";const Ou=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const h=i?t.jsx(z,{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(O,{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:Ru(e)}),t.jsx(O,{icon:Iu[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(O,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(O,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),h&&(r?h:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:h})}))]})},zu=`
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
- `,Yr=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:Pu}),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})]}));Yr.displayName="ModalShell";const Gr=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(B,{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"})})]})]});Gr.displayName="ModalShellHeader";const Kr=({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});Kr.displayName="ModalShellFooter";const Ou={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Ru={1:"grid-cols-1",2:"grid-cols-2"},gt=e=>typeof e=="string"?t.jsx(R,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Qr=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",columnsDesktop:o=3,columnsMobile:l=2,className:d,"data-testid":u="tile-select"})=>{const m=e.find(f=>f.key===n);return i==="compact"?t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${u}-heading`,children:a}),t.jsx("div",{role:"group","aria-labelledby":a?`${u}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-2 overflow-x-auto snap-x",children:e.map(f=>{const x=n===f.key;return t.jsxs(B,{variant:"bordered",radius:"lg","aria-pressed":x,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${u}-${f.key}`,className:c.cn("shrink-0 snap-start min-w-0 h-auto min-h-[44px]","flex flex-row items-center justify-center gap-2 px-3 py-2","border bg-transparent transition-colors",x?"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:gt(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${u}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Le,{"aria-label":a?void 0:r,"aria-labelledby":a?`${u}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:f=>{const h=Array.from(f)[0];typeof h=="string"&&s(h)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${u}-mobile-select`,startContent:m?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:gt(m.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:gt(f.icon)}),"data-testid":f["data-testid"]??`${u}-${f.key}-mobile`,children:f.label},f.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${u}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",Ru[l],Ou[o]),children:e.map(f=>{const x=n===f.key;return t.jsxs(B,{variant:"bordered",radius:"lg","aria-pressed":x,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${u}-${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",x?"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:gt(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Qr.displayName="TileSelect";const zu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Zr=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=zu[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:pe(e.value,s,e.currency)})]})};Zr.displayName="PaymentTotalBanner";const Bu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Xr=({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",Bu[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})]})]});Xr.displayName="LoadingOverlay";const Gn=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(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(B,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(R,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Gn.displayName="PaymentCashChangeBanner";const Jr=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":m="payment-success-view"})=>{const f=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":m,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":`${m}-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})]})]}),f&&r&&t.jsx(Gn,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${m}-cash-change`}),d&&t.jsx(B,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${m}-close`,className:"mt-4 w-full",children:l})]})};Jr.displayName="PaymentSuccessView";const Kn=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:d,autoFocus:u,maxAmount:m,hideHeading:f=!1,className:x,"data-testid":h="payment-sub-amount-input"})=>{const y=`${h}-input`,w=p.useCallback(j=>{if(m!==void 0){const N=Number.parseFloat(j.replace(",","."));if(Number.isFinite(N)&&N>m)return}r?.(j)},[m,r]),b=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",f&&"sr-only"),"data-testid":`${h}-heading`,children:e}),t.jsx(c.Input,{id:y,label:n,labelPlacement:"outside",classNames:f?{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:b,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:l?d:void 0,variant:"bordered",radius:"lg","aria-invalid":l||void 0,autoFocus:u,"data-testid":`${h}-field`})]})};Kn.displayName="PaymentSubAmountInput";const Vu={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"}},Uu=e=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e,ei=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:m,isKeyboardDismissDisabled:f=!1,hideIcon:x=!1,icon:h,"data-testid":y="confirm-dialog"})=>{const w=i??o??null,b=Vu[d],j=x?null:Uu(h??b.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(m??!0)&&!u,isKeyboardDismissDisabled:f||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":y,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":`${y}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:j}):null,t.jsx("span",{"data-testid":`${y}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),w!==null?t.jsx(c.ModalBody,{"data-testid":`${y}-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(B,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${y}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(B,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${y}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};ei.displayName="ConfirmDialog";const Hu=60,qu=(e,n,s=Hu)=>n?e>s:e<-s,ti=(e,n)=>Math.max(0,Math.min(e,n)),Wu=160,Yu=(e,n,s=Wu)=>Math.min(e,Math.max(0,n-s)),Gu=(e,n,s)=>ti(e-n,s),Ku=(e,n,s)=>e!==null?ti(e,s):n?s:0,Qu=e=>e?"":"transition-[height] duration-300 ease-out",Zu=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Gu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{qu(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,o=!!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)}),o&&t.jsx(B,{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((l,d)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${l.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:[l.icon,t.jsx("span",{className:"truncate",children:l.label})]}),(l.value!=null||l.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",l.valueTone==="primary"&&"font-medium text-primary"),children:l.value}),l.tooltip!=null&&t.jsx(c.Tooltip,{content:l.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${l.key??d}`,className:"flex shrink-0 items-center",children:t.jsx(R,{icon:"lucide:info",width:16,height:16,className:c.cn(l.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},l.key??d)),i&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(l=>t.jsx(Qn,{item:l,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},l.id))})]})};Qn.displayName="SummaryItemRow";const ni=({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)})]});ni.displayName="SummaryServiceFeeRow";const Zn=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const o=!!a&&i&&!!e.id,l=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}),o?t.jsxs("div",{className:"flex shrink-0 items-center",children:[l,t.jsx(B,{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"})})]}):l]})};Zn.displayName="SummaryTotalsLineRow";const si=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,showRemoveButton:d,emptyState:u,classNames:m})=>{const f=(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",m.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),f?t.jsx("div",{className:c.cn("flex flex-col gap-4",m.items),children:s.map(x=>t.jsx(Qn,{item:x,locale:i,onRemove:o,removeAriaLabel:l,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(ni,{fee:a,locale:i,className:m.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn("flex flex-col gap-4",m.totalsRows),children:r.map((x,h)=>t.jsx(Zn,{row:x,locale:i,emphasized:h===0},x.key))})]})};si.displayName="SummaryBody";const ai=({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)})]});ai.displayName="SummaryGrandTotalRow";const ri=({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)})]});ri.displayName="SummarySecondaryTotalRow";const Dt=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(B,{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});Dt.displayName="SummaryPrimaryCta";const ii=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(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",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children: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)})]})]})]})});ii.displayName="SummaryCollapseHeader";const li=({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})]});li.displayName="SummaryCartButton";const oi=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,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(li,{cart:i,ariaLabel:o,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),a&&t.jsx(Dt,{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(Dt,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),l&&t.jsx("div",{children:l})]});oi.displayName="SummaryActionBar";const Xu="(max-width: 767px)",Ju=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,ef=(e=Xu)=>{const[n,s]=p.useState(()=>Ju(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},ci=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemovePostTotalRow:u,secondaryTotal:m,collapsible:f,isOpen:x,onToggleOpen:h,defaultOpen:y=!1,primaryAction:w,isLoading:b=!1,onRemoveItem:j,showRemoveButton:N,ctaCaption:C,variant:v,cart:k,emptyState:L,labels:$,classNames:M={},"data-testid":E="summary",className:I})=>{const A=$?.removeAriaLabel??"Remove item",D=$?.removePostTotalRowAriaLabel??"Remove applied code",T=$?.toggleAriaLabel??"Toggle summary",_=$?.cartAriaLabel??"View cart",Y=ef(),U=f??(v??(Y?"mobile":"main"))==="mobile",[Z,J]=p.useState(y),re=x!==void 0,q=!U||(re?x:Z),Q=p.useCallback(()=>{re||J(ge=>!ge),h?.()},[re,h]),[K,ee]=p.useState(0),[oe,X]=p.useState(null),ue=p.useRef(null),te=p.useRef(null),ye=p.useCallback(()=>{const ge=ue.current;ge&&ee(Yu(ge.scrollHeight,window.innerHeight))},[]),De=p.useCallback(ge=>{te.current?.disconnect(),te.current=null,ue.current=ge,ge&&(ye(),typeof ResizeObserver<"u"&&(te.current=new ResizeObserver(ye),te.current.observe(ge)))},[ye]);p.useEffect(()=>(window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)),[ye]);const ke=Zu({open:q,fullHeight:K,setDragHeight:X,onToggleOpen:Q}),Pe=oe!==null,Oe=Ku(oe,q,K),Ve=K>0?Math.min(1,Math.max(0,Oe/K)):q?1:0,Me=t.jsx(ai,{total:l,locale:a,className:M.total}),ne=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=m&&t.jsx(ri,{secondaryTotal:m,locale:a,className:M.secondaryTotal}),Te=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(si,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:j,removeAriaLabel:A,showRemoveButton:N,emptyState:L,classNames:M});return U?t.jsxs(Ce.motion.section,{"data-testid":E,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ke.onDrag,onDragEnd:ke.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(ii,{title:e,total:l,secondaryTotal:m,locale:a,open:q,progress:Ve,dragging:Pe,toggleAriaLabel:T,onToggleOpen:Q,classNames:M}),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",Qu(Pe)),children:t.jsxs("div",{ref:De,className:"flex flex-col gap-4 pb-4",children:[mt,t.jsx(c.Divider,{className:"bg-default-200"}),Me,ne,xe]})}),t.jsx(oi,{open:q,progress:Ve,dragging:Pe,primaryAction:w,isLoading:b,cart:k,cartAriaLabel:_,ctaCaption:Te,onToggleOpen:Q,classNames:M})]}):t.jsxs("section",{"data-testid":E,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"}),Me,ne,xe,m&&w&&t.jsx(c.Divider,{className:"bg-default-200"}),w&&t.jsx(Dt,{action:w,disabledByLoading:b,className:c.cn("w-full",M.cta)}),Te]})};ci.displayName="Summary";const tf={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},nf={backgroundColor:wn.destructive,color:"#fff"},Ys="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",sn="absolute top-0 h-5 w-5 opacity-0",di=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:m,className:f,"data-testid":x="wizard-shell",children:h})=>{const y={...tf,...m},w=n.filter(v=>v.state!=="skipped"),b=n.find(v=>v.id===s),j=Math.max(0,w.findIndex(v=>v.id===s)),N=r??e,C=r?y.back:y.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",f),"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(B,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:N,"data-testid":`${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:b?.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":y.close,onClick:e,className:c.cn(sn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":y.back,onClick:r,className:c.cn(sn,"left-6"),"data-testid":`${x}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(sn,"left-12"),"data-testid":`${x}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${x}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:pe(o.amount.value,void 0,o.amount.currency)}),o.badge==="partial"&&t.jsx("span",{className:c.cn(Ys,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:y.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(Ys,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:y.owesBadge})]}),t.jsx(B,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?nf: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]})};di.displayName="WizardShell";const sf=(e,n,s)=>Math.min(Math.max(e,n),s);function bn(e,n,s){const a=Math.max(1,Math.trunc(n)),r=sf(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Tt(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function af(e,n){return bn(e,n,1)}const rf=e=>Number.isFinite(e)?e.toFixed(2):"",yn=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,m]=p.useState(null),f=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",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:f,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??rf(e),onChange:h=>{const y=h.target.value,w=Number.parseFloat(y.replace(",","."));s!==void 0&&Number.isFinite(w)&&w>s+.004||(m(y),Number.isFinite(w)&&w>=0?a(w):y.trim()===""&&a(0))},onFocus:h=>h.currentTarget.select(),onBlur:()=>m(null),"data-testid":d})]})};yn.displayName="AmountCell";const lf={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer — price adjustment",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},of="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",Gs="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",an="absolute h-5 w-5 opacity-0",cf=e=>{const n=pe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=af(e.paidAmount,e.quantity);return`${e.quantity} × ${pe(s.value,void 0,s.currency)} · ${n}`},ui=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...lf,...o},m=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(f=>{const x=n[f.id],h=f.state==="already_refunded"||f.state==="non_refundable",y=`${d}-row-${f.id}`,w=Math.max(1,Math.trunc(f.quantity)),b=x?.quantity,j=x?.selected?Math.min(b??w,w):b??0,N=bn(f.paidAmount,w,j).value,C=x?.amount??(x?.selected?N:0),v=j===0&&C>.004,k=$=>s(f.id,{selected:$.quantity>0||$.amount>.004,mode:"full",...$}),L=$=>{const M=Math.min(Math.max($,0),w);k({quantity:M,amount:bn(f.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":y,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":`${y}-icon`,children:t.jsx(R,{icon:f.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:f.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${y}-detail`,children:f.detail??cf(f)}),v&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${y}-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":`${y}-partial`,children:[h?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:pe(f.paidAmount.value,void 0,f.paidAmount.currency)}):t.jsx(yn,{value:C,expected:N,max:f.paidAmount.value,onChange:$=>k({quantity:j,amount:$}),ariaLabel:u.amount.replace("{name}",f.name),className:"w-[120px]","data-testid":`${y}-amount`,inputTestId:`${y}-partial-input-field`}),h?t.jsx("span",{className:of,"data-testid":`${y}-blocked`,children:f.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":f.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${y}-qty`,children:[t.jsx("button",{type:"button",className:Gs,"aria-label":u.decrease.replace("{name}",f.name),disabled:j===0,onClick:()=>L(j-1),"data-testid":`${y}-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":`${y}-qty-value`,children:j}),t.jsx("button",{type:"button",className:Gs,"aria-label":u.increase.replace("{name}",f.name),disabled:j===w,onClick:()=>L(j+1),"data-testid":`${y}-qty-increase`,children:"+"})]})]})]}),j>=w&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${y}-max-note`,children:u.maxNote.replace("{count}",String(w))}),x?.selected&&!f.restock.available&&f.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:f.restock.unavailableHint}),f.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":`${y}-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:f.warning})]}),j>0&&f.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(Le,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[f.restock.disposition??(f.restock.on?"stock":"norestock")],onSelectionChange:$=>{if($==="all")return;const M=[...$][0];M&&(r?.(f.id,M),a(f.id,M==="stock"))},"data-testid":`${y}-restock`,children:m.map($=>t.jsx(c.SelectItem,{children:$.label},$.key))})]})]}),!h&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(an,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:$=>s(f.id,{selected:$,mode:"full"}),"aria-label":f.name,"data-testid":`${y}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${y}-partial-input-field"]`)?.focus(),className:c.cn(an,"left-0 top-0"),"data-testid":`${y}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>k({quantity:j,amount:N}),className:c.cn(an,"left-5 top-0"),"data-testid":`${y}-partial-cancel`})]})]},f.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(yn,{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"})})]})]})})]}))]})};ui.displayName="LineItemList";const fi=({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})});fi.displayName="MetaCard";const mi=({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})]});mi.displayName="MetaCard.Row";const hi=({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]});hi.displayName="MetaCard.Section";const df=Object.assign(fi,{Row:mi,Section:hi}),xi=({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]});xi.displayName="SectionPanel";const pi=({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})]})]});pi.displayName="CustomerCard";const uf={label:"Reason for the return",placeholder:"Select a reason…"},gi=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":o="reason-select"})=>{const l={...uf,...r};return t.jsx(Le,{label:l.label,labelPlacement:"outside",placeholder:l.placeholder,selectedKeys:n?[n]:[],isInvalid:!!a,errorMessage:a,className:c.cn(i),"data-testid":o,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))})};gi.displayName="ReasonSelect";const ff={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},bi=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...ff,...i},[u,m]=p.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:f=>n(f.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:f=>n(f.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(B,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>m(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};bi.displayName="NotesField";const mf={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"}},hf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Ks="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:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:m})=>{const f=mf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",f.surface,l),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",f.disc),"aria-hidden":"true",children:t.jsx(R,{icon:hf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",f.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(B,{color:"primary",className:Ks,onPress:a,"data-testid":u,children:r}),t.jsx(B,{variant:"bordered",className:c.cn(Ks,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":m,children:o})]})]})]})};Xn.displayName="TenderBanner";const xf={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"},pf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},yi=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...xf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(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":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(m=>{const f=m.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":f,onClick:()=>s(m.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",f?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${m.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",f?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(R,{icon:pf[m.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:m.label}),t.jsx("span",{className:"block text-xs text-default-500",children:pe(m.maxRefundable.value,void 0,m.maxRefundable.currency)})]})]},m.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(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})]})]})]})};yi.displayName="TenderMethods";const gf=e=>e.refunded!==null,bf={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"},yf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",vf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",vi=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:m,className:f,"data-testid":x="split-tender-panel"})=>{const h={...bf,...m},y=e.filter(gf),w=e.find(C=>C.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),j=p.useCallback(C=>{const v=Number.parseFloat(C.replace(",","."));a.onAmountChange(Number.isFinite(v)?v:0)},[a]),N=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",f),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:h.title}),o&&t.jsx(Xn,{tone:N?"danger":"warning",title:N?h.declinedTitle:h.networkTitle,body:N?h.partDeclinedBody:h.partNetworkBody,onRetry:o.onRetry,retryLabel:h.retry,onChooseDifferent:o.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)]})]}),y.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:yf,children:h.refundedSoFar}),y.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(vf,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(y.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`}),b&&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(B,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${x}-back`,children:h.back}),t.jsx(B,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${x}-submit`,children:h.submit})]})]})};vi.displayName="SplitTenderPanel";const jf={label:"Supervisor authorization",placeholder:"••••"},ji=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...jf,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(R,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};ji.displayName="PinField";const wf={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}"},Nf={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Cf="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Qs="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",kf="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)]",Sf=["email","print"],wi=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:o,onDone:l,frameless:d=!1,labels:u,className:m,"data-testid":f="outcome-view"})=>{const x={...wf,...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",m),"aria-live":"polite","data-testid":f,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${f}-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":`${f}-processing-total`,children:h})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&kf,m),"aria-live":"polite","data-testid":f,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":`${f}-title`,children:x.title}),h&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${f}-total`,children:h}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${f}-reason`,children:x.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Qs,children:x.destinationsTitle}),s.map((y,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":`${f}-destination-${w}-${y.status}`,children:[t.jsx("span",{className:"font-semibold",children:y.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:pe(y.amount.value,void 0,y.amount.currency)}),t.jsx("span",{className:c.cn(Cf,Nf[y.status]),children:y.status==="succeeded"?x.succeeded:x.pending})]})]},`${y.label}-${w}`))]}),o&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Qs,children:x.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Sf.map(y=>{const w=i?.includes(y)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":w,onClick:()=>o(y),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":`${f}-receipt-${y}`,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[y]})]},y)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${f}-authorized-by`,children:x.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(B,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:l,"data-testid":`${f}-done`,children:x.done})})]})};wi.displayName="OutcomeView";exports.AdminFieldLabel=Pr;exports.AdminTable=Ar;exports.AdminTextField=Or;exports.AdminToolbar=Dr;exports.AppliedCodeCard=da;exports.Button=B;exports.CashTenderForm=$u;exports.CatalogItemCard=hr;exports.CheckTenderForm=Hr;exports.CommitmentDetails=ld;exports.ConfirmDialog=ei;exports.ConfirmationModal=zn;exports.ConfirmationPageTemplate=Fo;exports.CustomerCard=pi;exports.DatePicker=Fn;exports.DimensionChip=qn;exports.DonationAmounts=za;exports.EmptyState=Bn;exports.ErrorState=Vn;exports.EventDetails=mc;exports.EventDetailsTemplate=Lo;exports.ExpireCartTimer=Ba;exports.FeedbackState=et;exports.FilterPopover=br;exports.Footer=_o;exports.HeroUIProvider=el;exports.HorizontalSteps=Ia;exports.InstallmentFundAssignment=nd;exports.InstallmentFundAssignmentSkeleton=rd;exports.InstallmentSchedule=kd;exports.InstallmentScheduleSkeleton=Ld;exports.InstallmentTable=Pd;exports.ItemCard=mr;exports.KeyValueChip=qn;exports.LineItemList=ui;exports.ListPanel=Ur;exports.LoadingOverlay=Xr;exports.LoadingState=Un;exports.MembershipSelectCards=Vd;exports.MetaCard=df;exports.ModalShell=Yr;exports.ModalShellFooter=Kr;exports.ModalShellHeader=Gr;exports.Multiselect=Po;exports.Navbar=Eo;exports.NotesField=bi;exports.OfferCard=Ct;exports.OfferCardEmpty=Va;exports.OfferCardError=Ua;exports.OfferCardList=Ya;exports.OfferCardSkeleton=Ha;exports.OtherTenderForm=qr;exports.OutcomeView=wi;exports.PageHeader=vr;exports.PaginationSummary=Vr;exports.PaymentCashChangeBanner=Gn;exports.PaymentSubAmountInput=Kn;exports.PaymentSuccessView=Jr;exports.PaymentTotalBanner=Zr;exports.PickerRow=zr;exports.PinField=ji;exports.RICH_TEXT_PRESETS=Oa;exports.ReasonSelect=gi;exports.RedeemCodeInput=So;exports.RevenueDistributionCard=rr;exports.RevenueDistributionEmpty=ir;exports.RevenueDistributionError=lr;exports.RevenueDistributionSkeleton=or;exports.RichTextArea=Ra;exports.RowActions=Rr;exports.SectionPanel=xi;exports.Select=Le;exports.SessionTimeline=yr;exports.SplitPaymentSummary=Wr;exports.SplitTenderPanel=vi;exports.StatusChip=jr;exports.Stepper=La;exports.SuccessState=xr;exports.Summary=ci;exports.TableSkeleton=wr;exports.TenderMethods=yi;exports.TicketSelection=du;exports.TileSelect=Qr;exports.Toggle=pr;exports.ToolbarButton=Er;exports.UnderlineTabs=Fr;exports.WizardShell=di;exports.adminFieldErrorClass=_r;exports.adminFieldHintClass=Ir;exports.adminFieldLabelClass=Wn;exports.adminFieldLabelSuffixClass=Yn;exports.adminInputClass=Lr;exports.adminInputReadOnlyClass=Tr;exports.adminInputWrapperClass=Mr;exports.adminRowClass=kr;exports.adminSurfaceCss=Ji;exports.adminSurfaceTokens=jn;exports.adminTableClass=Sr;exports.adminTableFooterClass=$r;exports.adminTdClass=Cr;exports.adminThClass=Nr;exports.calculateAllocationDifference=qc;exports.computeChange=fn;exports.currencyFractionDigits=Tt;exports.formatMoney=pe;exports.formatOfferCurrency=hn;exports.formatRevenueAmount=Bc;exports.formatRevenueCurrency=Vc;exports.generateAutomaticInstallments=ur;exports.generateDistributionId=Rn;exports.getCurrencySymbol=Uc;exports.offerCardVariants=Wa;exports.offerListVariants=qa;exports.pageRange=Br;exports.parseOfferCurrency=hc;exports.parseRevenueCurrency=Hc;exports.posSurfaceTokens=wn;exports.roundToCurrency=Ta;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
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:zu}),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 Zr=({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(z,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(O,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Zr.displayName="ModalShellHeader";const Xr=({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});Xr.displayName="ModalShellFooter";const Bu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Vu={1:"grid-cols-1",2:"grid-cols-2"},sn=e=>typeof e=="string"?t.jsx(O,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,gt="h-[34px] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-[10px] text-[13px] font-medium transition-colors",Uu="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Ys="flex-none",Hu=typeof window<"u"?p.useLayoutEffect:p.useEffect,Ks=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",Jr=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:l,moreLabel:o="More",columnsDesktop:d=3,columnsMobile:u=2,className:h,"data-testid":f="tile-select"})=>{const x=e.find(m=>m.key===n);return i==="compact"?t.jsx(qu,{options:e,selectedKey:n,onSelect:s,ariaLabel:r,moreLabel:o,dataTestId:f,...a!==void 0?{heading:a}:{},...l!==void 0?{maxVisible:l}:{},...h!==void 0?{className:h}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",h),"data-testid":f,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${f}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Le,{"aria-label":a?void 0:r,"aria-labelledby":a?`${f}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:m=>{const j=Array.from(m)[0];typeof j=="string"&&s(j)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${f}-mobile-select`,startContent:x?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:sn(x.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(m=>t.jsx(c.SelectItem,{isDisabled:m.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:sn(m.icon)}),"data-testid":m["data-testid"]??`${f}-${m.key}-mobile`,children:m.label},m.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${f}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",Vu[u],Bu[d]),children:e.map(m=>{const g=n===m.key;return t.jsxs(z,{variant:"bordered",radius:"lg","aria-pressed":g,"aria-label":m.label,isDisabled:m.isDisabled,onPress:()=>s(m.key),"data-testid":m["data-testid"]??`${f}-${m.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",g?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:sn(m.icon)}),t.jsx("span",{className:"text-sm font-medium",children:m.label})]},m.key)})})]})};Jr.displayName="TileSelect";function qu({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r,maxVisible:i,moreLabel:l,className:o,dataTestId:d}){const u=p.useRef(null),h=p.useRef(null),f=p.useMemo(()=>e.map((k,E)=>({option:k,index:E})).filter(({option:k})=>k.alwaysInMenu!==!0).map(({index:k})=>k),[e]),x=f.length<e.length,m=p.useCallback(k=>{const E=f.map(D=>({index:D,priority:e[D]?.priority??0})).sort((D,F)=>D.priority-F.priority||F.index-D.index),I=new Set(E.slice(0,f.length-k).map(D=>D.index));return f.filter(D=>!I.has(D))},[e,f]),[g,j]=p.useState(e.length);Hu(()=>{const k=u.current,E=h.current;if(!k||!E)return;const I=()=>{const F=Array.from(E.children),T=F.slice(0,e.length).map(Q=>Q.getBoundingClientRect().width),_=F[e.length]?.getBoundingClientRect().width??0,W=window.getComputedStyle(k),U=Number.parseFloat(W.columnGap)||0,B=k.clientWidth-(Number.parseFloat(W.paddingLeft)||0)-(Number.parseFloat(W.paddingRight)||0);if(B<=0||T.some(Q=>Q===0)){j(f.length);return}const X=Q=>{const ne=x||Q<f.length,q=Q+(ne?1:0);return m(Q).reduce((K,J)=>K+(T[J]??0),0)+(ne?_:0)+U*(q-1)<=B};for(let Q=f.length;Q>=1;Q-=1)if(X(Q)){j(Q);return}j(1)};I();const D=new ResizeObserver(I);return D.observe(k),()=>D.disconnect()},[e,l,m,f,x]);const b=Math.max(1,Math.min(g,i??f.length,f.length)),N=!x&&b===f.length-1&&g===f.length?f.length:b,C=x||N<f.length,v=new Set(m(N)),S=e.filter((k,E)=>v.has(E)),L=C?e.filter((k,E)=>!v.has(E)):[],A=L.find(k=>k.key===n);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",o),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[S.map(k=>t.jsx(z,{variant:"light",radius:"full","aria-pressed":n===k.key,isDisabled:k.isDisabled,onPress:()=>s(k.key),"data-testid":k["data-testid"]??`${d}-${k.key}`,className:c.cn(gt,Ks(n===k.key)),children:k.label},k.key)),L.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(z,{variant:"light",radius:"full","aria-pressed":A!==void 0,"data-testid":`${d}-more`,className:c.cn(gt,"gap-1",A!==void 0?"min-w-0":"min-w-fit",Ks(A!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:A?.label??l}),t.jsx(O,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":l,className:"w-64 p-2",selectionMode:"single",selectedKeys:A?[A.key]:[],disabledKeys:L.filter(k=>k.isDisabled).map(k=>k.key),onAction:k=>s(String(k)),children:L.map(k=>t.jsx(c.DropdownItem,{textValue:k.label,...k.description!==void 0?{description:k.description}:{},"data-testid":k["data-testid"]??`${d}-${k.key}`,children:k.label},k.key))})]})]}),t.jsxs("div",{ref:h,"aria-hidden":"true",className:Uu,children:[e.map(k=>t.jsx(z,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(gt,Ys),children:k.label},k.key)),t.jsxs(z,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(gt,Ys,"gap-1"),children:[l,t.jsx(O,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const Wu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},ei=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=Wu[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)})]})};ei.displayName="PaymentTotalBanner";const Gu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},ti=({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",Gu[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})]})]});ti.displayName="LoadingOverlay";const Kn=({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(O,{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(z,{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(O,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Kn.displayName="PaymentCashChangeBanner";const ni=({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":h="payment-success-view"})=>{const f=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":h,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(O,{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":`${h}-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})]})]}),f&&r&&t.jsx(Kn,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${h}-cash-change`}),d&&t.jsx(z,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${h}-close`,className:"mt-4 w-full",children:o})]})};ni.displayName="PaymentSuccessView";const Qn=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:d,autoFocus:u,maxAmount:h,hideHeading:f=!1,className:x,"data-testid":m="payment-sub-amount-input"})=>{const g=`${m}-input`,j=p.useCallback(w=>{if(h!==void 0){const N=Number.parseFloat(w.replace(",","."));if(Number.isFinite(N)&&N>h)return}r?.(w)},[h,r]),b=p.useCallback(w=>{const N=w.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":m,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",f&&"sr-only"),"data-testid":`${m}-heading`,children:e}),t.jsx(c.Input,{id:g,label:n,labelPlacement:"outside",classNames:f?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:w=>j(w.target.value),onFocus:b,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:o?d:void 0,variant:"bordered",radius:"lg","aria-invalid":o||void 0,autoFocus:u,"data-testid":`${m}-field`})]})};Qn.displayName="PaymentSubAmountInput";const Yu={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"}},Ku=e=>typeof e=="string"?t.jsx(O,{icon:e,className:"size-5","aria-hidden":"true"}):e,si=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:h,isKeyboardDismissDisabled:f=!1,hideIcon:x=!1,icon:m,"data-testid":g="confirm-dialog"})=>{const j=i??l??null,b=Yu[d],w=x?null:Ku(m??b.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(h??!0)&&!u,isKeyboardDismissDisabled:f||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),j!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof j=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:j}):j}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(z,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(z,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};si.displayName="ConfirmDialog";const Qu=60,Zu=(e,n,s=Qu)=>n?e>s:e<-s,ai=(e,n)=>Math.max(0,Math.min(e,n)),Xu=160,Ju=(e,n,s=Xu)=>Math.min(e,Math.max(0,n-s)),ef=(e,n,s)=>ai(e-n,s),tf=(e,n,s)=>e!==null?ai(e,s):n?s:0,nf=e=>e?"":"transition-[height] duration-300 ease-out",sf=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(ef(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{Zu(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ge=(e,n)=>pe(e.value,n,e.currency),Zn=({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:Ge(e.amount,n)}),l&&t.jsx(z,{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(O,{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(O,{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(O,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(O,{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(O,{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(Zn,{item:o,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},o.id))})]})};Zn.displayName="SummaryItemRow";const ri=({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:Ge(e.amount,n)})]});ri.displayName="SummaryServiceFeeRow";const Xn=({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:Ge(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(z,{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(O,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):o]})};Xn.displayName="SummaryTotalsLineRow";const ii=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,showRemoveButton:d,emptyState:u,classNames:h})=>{const f=(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",h.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),f?t.jsx("div",{className:c.cn("flex flex-col gap-4",h.items),children:s.map(x=>t.jsx(Zn,{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(ri,{fee:a,locale:i,className:h.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn("flex flex-col gap-4",h.totalsRows),children:r.map((x,m)=>t.jsx(Xn,{row:x,locale:i,emphasized:m===0},x.key))})]})};ii.displayName="SummaryBody";const li=({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:Ge(e.amount,n)})]});li.displayName="SummaryGrandTotalRow";const oi=({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:Ge(e.amount,n)})]});oi.displayName="SummarySecondaryTotalRow";const Dt=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(z,{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(O,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Dt.displayName="SummaryPrimaryCta";const ci=({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(O,{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:Ge(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:Ge(s.amount,a)})]})]})]})});ci.displayName="SummaryCollapseHeader";const di=({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(O,{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})]});di.displayName="SummaryCartButton";const ui=({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(di,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),a&&t.jsx(Dt,{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(Dt,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&t.jsx("div",{children:o})]});ui.displayName="SummaryActionBar";const af="(max-width: 767px)",rf=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,lf=(e=af)=>{const[n,s]=p.useState(()=>rf(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},fi=({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:h,collapsible:f,isOpen:x,onToggleOpen:m,defaultOpen:g=!1,primaryAction:j,isLoading:b=!1,onRemoveItem:w,showRemoveButton:N,ctaCaption:C,variant:v,cart:S,emptyState:L,labels:A,classNames:k={},"data-testid":E="summary",className:I})=>{const D=A?.removeAriaLabel??"Remove item",F=A?.removePostTotalRowAriaLabel??"Remove applied code",T=A?.toggleAriaLabel??"Toggle summary",_=A?.cartAriaLabel??"View cart",W=lf(),B=f??(v??(W?"mobile":"main"))==="mobile",[X,Q]=p.useState(g),ne=x!==void 0,q=!B||(ne?x:X),Z=p.useCallback(()=>{ne||Q(ge=>!ge),m?.()},[ne,m]),[K,J]=p.useState(0),[oe,ee]=p.useState(null),ue=p.useRef(null),te=p.useRef(null),ye=p.useCallback(()=>{const ge=ue.current;ge&&J(Ju(ge.scrollHeight,window.innerHeight))},[]),De=p.useCallback(ge=>{te.current?.disconnect(),te.current=null,ue.current=ge,ge&&(ye(),typeof ResizeObserver<"u"&&(te.current=new ResizeObserver(ye),te.current.observe(ge)))},[ye]);p.useEffect(()=>(window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)),[ye]);const ke=sf({open:q,fullHeight:K,setDragHeight:ee,onToggleOpen:Z}),Pe=oe!==null,Re=tf(oe,q,K),Ve=K>0?Math.min(1,Math.max(0,Re/K)):q?1:0,Me=t.jsx(li,{total:o,locale:a,className:k.total}),se=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(Xn,{row:ge,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:F,showRemoveButton:N},ge.key))}),xe=h&&t.jsx(oi,{secondaryTotal:h,locale:a,className:k.secondaryTotal}),Te=C!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",k.ctaCaption),children:C}),mt=t.jsx(ii,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:l,locale:a,onRemoveItem:w,removeAriaLabel:D,showRemoveButton:N,emptyState:L,classNames:k});return B?t.jsxs(Ce.motion.section,{"data-testid":E,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ke.onDrag,onDragEnd:ke.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,k.base),children:[t.jsx(ci,{title:e,total:o,secondaryTotal:h,locale:a,open:q,progress:Ve,dragging:Pe,toggleAriaLabel:T,onToggleOpen:Z,classNames:k}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!q,style:{height:Re},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",nf(Pe)),children:t.jsxs("div",{ref:De,className:"flex flex-col gap-4 pb-4",children:[mt,t.jsx(c.Divider,{className:"bg-default-200"}),Me,se,xe]})}),t.jsx(ui,{open:q,progress:Ve,dragging:Pe,primaryAction:j,isLoading:b,cart:S,cartAriaLabel:_,ctaCaption:Te,onToggleOpen:Z,classNames:k})]}):t.jsxs("section",{"data-testid":E,className:c.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",I,k.base),children:[t.jsx("div",{className:c.cn("flex items-center justify-between",k.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",k.title),children:e})}),mt,t.jsx(c.Divider,{className:"bg-default-200"}),Me,se,xe,h&&j&&t.jsx(c.Divider,{className:"bg-default-200"}),j&&t.jsx(Dt,{action:j,disabledByLoading:b,className:c.cn("w-full",k.cta)}),Te]})};fi.displayName="Summary";const of={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},cf={backgroundColor:Nn.destructive,color:"#fff"},Qs="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",an="absolute top-0 h-5 w-5 opacity-0",mi=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:h,className:f,"data-testid":x="wizard-shell",children:m})=>{const g={...of,...h},j=n.filter(v=>v.state!=="skipped"),b=n.find(v=>v.id===s),w=Math.max(0,j.findIndex(v=>v.id===s)),N=r??e,C=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",f),"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(z,{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(O,{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:b?.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":g.close,onClick:e,className:c.cn(an,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(an,"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(an,"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(Qs,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:g.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Qs,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:g.owesBadge})]}),t.jsx(z,{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"?cf: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:j.map((v,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<w&&"bg-pos-ok",S===w&&"bg-primary",S>w&&"bg-pos-line")},v.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:m}),u]})};mi.displayName="WizardShell";const df=(e,n,s)=>Math.min(Math.max(e,n),s);function yn(e,n,s){const a=Math.max(1,Math.trunc(n)),r=df(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Tt(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 uf(e,n){return yn(e,n,1)}const ff=e=>Number.isFinite(e)?e.toFixed(2):"",vn=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,h]=p.useState(null),f=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:f,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??ff(e),onChange:m=>{const g=m.target.value,j=Number.parseFloat(g.replace(",","."));s!==void 0&&Number.isFinite(j)&&j>s+.004||(h(g),Number.isFinite(j)&&j>=0?a(j):g.trim()===""&&a(0))},onFocus:m=>m.currentTarget.select(),onBlur:()=>h(null),"data-testid":d})]})};vn.displayName="AmountCell";const mf={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"},hf="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",Zs="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",rn="absolute h-5 w-5 opacity-0",xf=e=>{const n=pe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=uf(e.paidAmount,e.quantity);return`${e.quantity} × ${pe(s.value,void 0,s.currency)} · ${n}`},hi=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...mf,...l},h=[{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(f=>{const x=n[f.id],m=f.state==="already_refunded"||f.state==="non_refundable",g=`${d}-row-${f.id}`,j=Math.max(1,Math.trunc(f.quantity)),b=x?.quantity,w=x?.selected?Math.min(b??j,j):b??0,N=yn(f.paidAmount,j,w).value,C=x?.amount??(x?.selected?N:0),v=w===0&&C>.004,S=A=>s(f.id,{selected:A.quantity>0||A.amount>.004,mode:"full",...A}),L=A=>{const k=Math.min(Math.max(A,0),j);S({quantity:k,amount:yn(f.paidAmount,j,k).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",m&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(O,{icon:f.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:f.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:f.detail??xf(f)}),v&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[m?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:pe(f.paidAmount.value,void 0,f.paidAmount.currency)}):t.jsx(vn,{value:C,expected:N,max:f.paidAmount.value,onChange:A=>S({quantity:w,amount:A}),ariaLabel:u.amount.replace("{name}",f.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),m?t.jsx("span",{className:hf,"data-testid":`${g}-blocked`,children:f.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":f.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:Zs,"aria-label":u.decrease.replace("{name}",f.name),disabled:w===0,onClick:()=>L(w-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:w}),t.jsx("button",{type:"button",className:Zs,"aria-label":u.increase.replace("{name}",f.name),disabled:w===j,onClick:()=>L(w+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),w>=j&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(j))}),x?.selected&&!f.restock.available&&f.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:f.restock.unavailableHint}),f.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(O,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:f.warning})]}),w>0&&f.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(Le,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[f.restock.disposition??(f.restock.on?"stock":"norestock")],onSelectionChange:A=>{if(A==="all")return;const k=[...A][0];k&&(r?.(f.id,k),a(f.id,k==="stock"))},"data-testid":`${g}-restock`,children:h.map(A=>t.jsx(c.SelectItem,{children:A.label},A.key))})]})]}),!m&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(rn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:A=>s(f.id,{selected:A,mode:"full"}),"aria-label":f.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(rn,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>S({quantity:w,amount:N}),className:c.cn(rn,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},f.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(O,{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(O,{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(vn,{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(O,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};hi.displayName="LineItemList";const xi=({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})});xi.displayName="MetaCard";const pi=({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})]});pi.displayName="MetaCard.Row";const gi=({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]});gi.displayName="MetaCard.Section";const pf=Object.assign(xi,{Row:pi,Section:gi}),bi=({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(O,{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(O,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});bi.displayName="SectionPanel";const yi=({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(O,{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})]})]});yi.displayName="CustomerCard";const gf={label:"Reason for the return",placeholder:"Select a reason…"},vi=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...gf,...r};return t.jsx(Le,{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))})};vi.displayName="ReasonSelect";const bf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},ji=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...bf,...i},[u,h]=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:f=>n(f.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:f=>n(f.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(z,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>h(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};ji.displayName="NotesField";const yf={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"}},vf={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Xs="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Jn=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:h})=>{const f=yf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",f.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",f.disc),"aria-hidden":"true",children:t.jsx(O,{icon:vf[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",f.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(z,{color:"primary",className:Xs,onPress:a,"data-testid":u,children:r}),t.jsx(z,{variant:"bordered",className:c.cn(Xs,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":h,children:l})]})]})]})};Jn.displayName="TenderBanner";const jf={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"},wf={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},wi=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...jf,...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(Jn,{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(h=>{const f=h.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":f,onClick:()=>s(h.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",f?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${h.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",f?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(O,{icon:wf[h.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:h.label}),t.jsx("span",{className:"block text-xs text-default-500",children:pe(h.maxRefundable.value,void 0,h.maxRefundable.currency)})]})]},h.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(O,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};wi.displayName="TenderMethods";const Nf=e=>e.refunded!==null,Cf={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"},kf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Sf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ni=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:h,className:f,"data-testid":x="split-tender-panel"})=>{const m={...Cf,...h},g=e.filter(Nf),j=e.find(C=>C.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),w=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",f),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:m.title}),l&&t.jsx(Jn,{tone:N?"danger":"warning",title:N?m.declinedTitle:m.networkTitle,body:N?m.partDeclinedBody:m.partNetworkBody,onRetry:l.onRetry,retryLabel:m.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:m.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:m.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:[m.refundedSoFar,": ",pe(n.value,void 0,n.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:kf,children:m.refundedSoFar}),g.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(O,{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(Sf,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?m.pending:m.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:m.partHeading.replace("{n}",String(g.length+1))}),j&&t.jsx("span",{className:"text-xs text-default-500",children:j})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:m.amountForPart}),t.jsx(Qn,{heading:m.amountForPart,amountLabel:m.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:w,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),b&&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(O,{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(z,{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:m.back}),t.jsx(z,{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:m.submit})]})]})};Ni.displayName="SplitTenderPanel";const $f={label:"Supervisor authorization",placeholder:"••••"},Ci=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...$f,...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(O,{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`})]})};Ci.displayName="PinField";const Af={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}"},Df={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Ef="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Js="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",Ff="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)]",Mf=["email","print"],ki=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:h,"data-testid":f="outcome-view"})=>{const x={...Af,...u},m=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",h),"aria-live":"polite","data-testid":f,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${f}-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}),m&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${f}-processing-total`,children:m})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&Ff,h),"aria-live":"polite","data-testid":f,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(O,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${f}-title`,children:x.title}),m&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${f}-total`,children:m}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${f}-reason`,children:x.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Js,children:x.destinationsTitle}),s.map((g,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${f}-destination-${j}-${g.status}`,children:[t.jsx("span",{className:"font-semibold",children:g.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:pe(g.amount.value,void 0,g.amount.currency)}),t.jsx("span",{className:c.cn(Ef,Df[g.status]),children:g.status==="succeeded"?x.succeeded:x.pending})]})]},`${g.label}-${j}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Js,children:x.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Mf.map(g=>{const j=i?.includes(g)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>l(g),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${f}-receipt-${g}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:x[g]})]},g)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${f}-authorized-by`,children:x.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(z,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${f}-done`,children:x.done})})]})};ki.displayName="OutcomeView";exports.AdminFieldLabel=zr;exports.AdminTable=Fr;exports.AdminTextField=Br;exports.AdminToolbar=Mr;exports.AppliedCodeCard=ma;exports.Button=z;exports.CashTenderForm=Eu;exports.CatalogItemCard=gr;exports.CheckTenderForm=Gr;exports.CommitmentDetails=dd;exports.ConfirmDialog=si;exports.ConfirmationModal=Bn;exports.ConfirmationPageTemplate=To;exports.CustomerCard=yi;exports.DatePicker=Mn;exports.DimensionChip=Wn;exports.DonationAmounts=Ua;exports.EmptyState=Vn;exports.ErrorState=Un;exports.EventDetails=pc;exports.EventDetailsTemplate=_o;exports.ExpireCartTimer=Ha;exports.FeedbackState=et;exports.FilterPopover=jr;exports.Footer=Oo;exports.HeroUIProvider=sl;exports.HorizontalSteps=Ra;exports.InstallmentFundAssignment=rd;exports.InstallmentFundAssignmentSkeleton=od;exports.InstallmentSchedule=Ad;exports.InstallmentScheduleSkeleton=_d;exports.InstallmentTable=zd;exports.ItemCard=pr;exports.KeyValueChip=Wn;exports.LineItemList=hi;exports.ListPanel=Wr;exports.LoadingOverlay=ti;exports.LoadingState=Hn;exports.MembershipSelectCards=qd;exports.MetaCard=pf;exports.ModalShell=Qr;exports.ModalShellFooter=Xr;exports.ModalShellHeader=Zr;exports.Multiselect=zo;exports.Navbar=Lo;exports.NotesField=ji;exports.OfferCard=Ct;exports.OfferCardEmpty=qa;exports.OfferCardError=Wa;exports.OfferCardList=Qa;exports.OfferCardSkeleton=Ga;exports.OtherTenderForm=Yr;exports.OutcomeView=ki;exports.PageHeader=Nr;exports.PaginationSummary=qr;exports.PaymentCashChangeBanner=Kn;exports.PaymentSubAmountInput=Qn;exports.PaymentSuccessView=ni;exports.PaymentTotalBanner=ei;exports.PickerRow=Ur;exports.PinField=Ci;exports.RICH_TEXT_PRESETS=Ba;exports.ReasonSelect=vi;exports.RedeemCodeInput=Do;exports.RevenueDistributionCard=or;exports.RevenueDistributionEmpty=cr;exports.RevenueDistributionError=dr;exports.RevenueDistributionSkeleton=ur;exports.RichTextArea=Va;exports.RowActions=Vr;exports.SectionPanel=bi;exports.Select=Le;exports.SessionTimeline=wr;exports.SplitPaymentSummary=Kr;exports.SplitTenderPanel=Ni;exports.StatusChip=Cr;exports.Stepper=_a;exports.SuccessState=br;exports.Summary=fi;exports.TableSkeleton=kr;exports.TenderMethods=wi;exports.TicketSelection=mu;exports.TileSelect=Jr;exports.Toggle=yr;exports.ToolbarButton=Lr;exports.UnderlineTabs=Tr;exports.WizardShell=mi;exports.adminFieldErrorClass=Or;exports.adminFieldHintClass=Rr;exports.adminFieldLabelClass=Gn;exports.adminFieldLabelSuffixClass=Yn;exports.adminInputClass=_r;exports.adminInputReadOnlyClass=Pr;exports.adminInputWrapperClass=Ir;exports.adminRowClass=Ar;exports.adminSurfaceCss=nl;exports.adminSurfaceTokens=wn;exports.adminTableClass=Dr;exports.adminTableFooterClass=Er;exports.adminTdClass=$r;exports.adminThClass=Sr;exports.calculateAllocationDifference=Yc;exports.computeChange=mn;exports.currencyFractionDigits=Tt;exports.formatMoney=pe;exports.formatOfferCurrency=xn;exports.formatRevenueAmount=Hc;exports.formatRevenueCurrency=qc;exports.generateAutomaticInstallments=hr;exports.generateDistributionId=zn;exports.getCurrencySymbol=Wc;exports.offerCardVariants=Ka;exports.offerListVariants=Ya;exports.pageRange=Hr;exports.parseOfferCurrency=gc;exports.parseRevenueCurrency=Gc;exports.posSurfaceTokens=Nn;exports.roundToCurrency=Pa;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)}})();