@veevarts/design-system 1.17.0-alpha.2 → 1.17.0-alpha.4

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.
Files changed (41) hide show
  1. package/dist/index.cjs +8 -8
  2. package/dist/index.js +4270 -3506
  3. package/dist/patterns/ActingAsToggle/ActingAsToggle.d.ts +3 -0
  4. package/dist/patterns/ActingAsToggle/index.d.ts +2 -0
  5. package/dist/patterns/ActingAsToggle/types.d.ts +13 -0
  6. package/dist/patterns/AdminTable/styles.d.ts +12 -2
  7. package/dist/patterns/CustomAmountField/CustomAmountField.d.ts +3 -0
  8. package/dist/patterns/CustomAmountField/index.d.ts +2 -0
  9. package/dist/patterns/CustomAmountField/types.d.ts +21 -0
  10. package/dist/patterns/MoneyBackMethods/MoneyBackMethods.d.ts +4 -0
  11. package/dist/patterns/MoneyBackMethods/index.d.ts +2 -0
  12. package/dist/patterns/MoneyBackMethods/types.d.ts +44 -0
  13. package/dist/patterns/NotesField/NotesField.d.ts +3 -0
  14. package/dist/patterns/NotesField/index.d.ts +2 -0
  15. package/dist/patterns/NotesField/types.d.ts +12 -0
  16. package/dist/patterns/PaymentSubAmountInput/PaymentSubAmountInput.d.ts +9 -0
  17. package/dist/patterns/ReasonSelect/ReasonSelect.d.ts +3 -0
  18. package/dist/patterns/ReasonSelect/index.d.ts +2 -0
  19. package/dist/patterns/ReasonSelect/types.d.ts +17 -0
  20. package/dist/patterns/RefundCompleteView/RefundCompleteView.d.ts +3 -0
  21. package/dist/patterns/RefundCompleteView/index.d.ts +2 -0
  22. package/dist/patterns/RefundCompleteView/types.d.ts +22 -0
  23. package/dist/patterns/RefundItemList/RefundItemList.d.ts +3 -0
  24. package/dist/patterns/RefundItemList/index.d.ts +2 -0
  25. package/dist/patterns/RefundItemList/types.d.ts +40 -0
  26. package/dist/patterns/RefundTotalBar/RefundTotalBar.d.ts +3 -0
  27. package/dist/patterns/RefundTotalBar/index.d.ts +2 -0
  28. package/dist/patterns/RefundTotalBar/types.d.ts +13 -0
  29. package/dist/patterns/SplitRefundPanel/SplitRefundPanel.d.ts +4 -0
  30. package/dist/patterns/SplitRefundPanel/index.d.ts +2 -0
  31. package/dist/patterns/SplitRefundPanel/types.d.ts +51 -0
  32. package/dist/patterns/SupervisorPinField/SupervisorPinField.d.ts +3 -0
  33. package/dist/patterns/SupervisorPinField/index.d.ts +2 -0
  34. package/dist/patterns/SupervisorPinField/types.d.ts +12 -0
  35. package/dist/patterns/WizardShell/WizardShell.d.ts +4 -0
  36. package/dist/patterns/WizardShell/index.d.ts +2 -0
  37. package/dist/patterns/WizardShell/types.d.ts +29 -0
  38. package/dist/patterns/index.d.ts +25 -2
  39. package/dist/patterns/refund-shared/index.d.ts +1 -0
  40. package/dist/patterns/refund-shared/types.d.ts +12 -0
  41. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),c=require("@heroui/react"),p=require("react"),G=require("lucide-react"),Se=require("framer-motion"),mn=require("@tiptap/react"),Hn=require("@tiptap/core"),Ka=require("@tiptap/extension-bold"),Qa=require("@tiptap/extension-italic"),Za=require("@tiptap/extension-strike"),Xa=require("@tiptap/extension-underline"),Ja=require("@tiptap/extension-code"),ei=require("@tiptap/extension-color"),ti=require("@tiptap/extension-highlight"),ni=require("@tiptap/extension-link"),si=require("@tiptap/extension-text-style"),ri=require("@tiptap/extension-heading"),ai=require("@tiptap/extension-paragraph"),ii=require("@tiptap/extension-bullet-list"),li=require("@tiptap/extension-ordered-list"),oi=require("@tiptap/extension-task-list"),ci=require("@tiptap/extension-task-item"),di=require("@tiptap/extension-list-item"),ui=require("@tiptap/extension-code-block"),fi=require("@tiptap/extension-blockquote"),mi=require("@tiptap/extension-horizontal-rule"),hi=require("@tiptap/extension-hard-break"),qn=require("@tiptap/extension-history"),xi=require("@tiptap/extension-text-align"),pi=require("@tiptap/extension-document"),gi=require("@tiptap/extension-text"),bi=require("@tiptap/extension-dropcursor"),yi=require("@tiptap/extension-gapcursor"),ge={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},le={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ce={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:ht}=ge.neutral,vi=ge.palettes.warning[700],ji=ge.palettes.warning[100],Oe={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},hn={"--rust":ge.brand.primary[500],"--rust-fill":Oe.rustFill,"--rust-border":Oe.rustBorder,"--page":Oe.page,"--surface":ge.neutral.white,"--border":Oe.border,"--hair":Oe.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":ge.semantic.success,"--ok-fill":Oe.okFill,"--warn":vi,"--warn-fill":ji,"--danger":ge.semantic.danger,"--danger-fill":Oe.dangerFill,"--info":ge.semantic.info,"--info-fill":Oe.infoFill};Object.fromEntries(Object.entries(hn).map(([e,t])=>[e.replace(/^--/,""),t]));function wi({scope:e=".acct",fontFamily:t="'NeueMontreal', system-ui, sans-serif"}={}){const n=Object.entries(hn).map(([a,i])=>` ${a}: ${i};`).join(`
2
- `),r=t?`
3
- font-family: ${t};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("@heroui/react"),x=require("react"),K=require("lucide-react"),$e=require("framer-motion"),hn=require("@tiptap/react"),Zn=require("@tiptap/core"),li=require("@tiptap/extension-bold"),oi=require("@tiptap/extension-italic"),ci=require("@tiptap/extension-strike"),di=require("@tiptap/extension-underline"),ui=require("@tiptap/extension-code"),fi=require("@tiptap/extension-color"),mi=require("@tiptap/extension-highlight"),hi=require("@tiptap/extension-link"),xi=require("@tiptap/extension-text-style"),pi=require("@tiptap/extension-heading"),gi=require("@tiptap/extension-paragraph"),bi=require("@tiptap/extension-bullet-list"),yi=require("@tiptap/extension-ordered-list"),vi=require("@tiptap/extension-task-list"),ji=require("@tiptap/extension-task-item"),wi=require("@tiptap/extension-list-item"),Ni=require("@tiptap/extension-code-block"),Ci=require("@tiptap/extension-blockquote"),ki=require("@tiptap/extension-horizontal-rule"),Si=require("@tiptap/extension-hard-break"),Xn=require("@tiptap/extension-history"),$i=require("@tiptap/extension-text-align"),Ai=require("@tiptap/extension-document"),Di=require("@tiptap/extension-text"),Ei=require("@tiptap/extension-dropcursor"),Fi=require("@tiptap/extension-gapcursor"),ge={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},le={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ce={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:xt}=ge.neutral,Mi=ge.palettes.warning[700],Li=ge.palettes.warning[100],Re={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},xn={"--rust":ge.brand.primary[500],"--rust-fill":Re.rustFill,"--rust-border":Re.rustBorder,"--page":Re.page,"--surface":ge.neutral.white,"--border":Re.border,"--hair":Re.hair,"--ink":xt[900],"--ink2":xt[700],"--sub":xt[500],"--muted":xt[400],"--ok":ge.semantic.success,"--ok-fill":Re.okFill,"--warn":Mi,"--warn-fill":Li,"--danger":ge.semantic.danger,"--danger-fill":Re.dangerFill,"--info":ge.semantic.info,"--info-fill":Re.infoFill};Object.fromEntries(Object.entries(xn).map(([e,n])=>[e.replace(/^--/,""),n]));function Ii({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(xn).map(([r,i])=>` ${r}: ${i};`).join(`
2
+ `),a=n?`
3
+ font-family: ${n};
4
4
  color: var(--ink);`:"";return`${e} {
5
- ${n}${r}
5
+ ${s}${a}
6
6
  }
7
- `}function Ni({children:e}){return s.jsx(c.HeroUIProvider,{children:e})}function Ci(e,t){const n=e.icons,r=e.aliases||Object.create(null),a=Object.create(null);function i(l){if(n[l])return a[l]=[];if(!(l in a)){a[l]=null;const o=r[l]&&r[l].parent,d=o&&i(o);d&&(a[l]=[o].concat(d))}return a[l]}return Object.keys(n).concat(Object.keys(r)).forEach(i),a}const Ts=Object.freeze({left:0,top:0,width:16,height:16}),vt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),xn=Object.freeze({...Ts,...vt}),Jt=Object.freeze({...xn,body:"",hidden:!1});function ki(e,t){const n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);const r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Wn(e,t){const n=ki(e,t);for(const r in Jt)r in vt?r in e&&!(r in n)&&(n[r]=vt[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function Si(e,t,n){const r=e.icons,a=e.aliases||Object.create(null);let i={};function l(o){i=Wn(r[o]||a[o],i)}return l(t),n.forEach(l),Wn(e,i)}function Ls(e,t){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(a=>{t(a,null),n.push(a)});const r=Ci(e);for(const a in r){const i=r[a];i&&(t(a,Si(e,a,i)),n.push(a))}return n}const Ai={provider:"",aliases:{},not_found:{},...Ts};function Lt(e,t){for(const n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function Ps(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Lt(e,Ai))return null;const n=t.icons;for(const a in n){const i=n[a];if(!a||typeof i.body!="string"||!Lt(i,Jt))return null}const r=t.aliases||Object.create(null);for(const a in r){const i=r[a],l=i.parent;if(!a||typeof l!="string"||!n[l]&&!r[l]||!Lt(i,Jt))return null}return t}const Yn=Object.create(null);function $i(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Xe(e,t){const n=Yn[e]||(Yn[e]=Object.create(null));return n[t]||(n[t]=$i(e,t))}function Os(e,t){return Ps(t)?Ls(t,(n,r)=>{r?e.icons[n]=r:e.missing.add(n)}):[]}function Di(e,t,n){try{if(typeof n.body=="string")return e.icons[t]={...n},!0}catch{}return!1}const _s=/^[a-z0-9]+(-[a-z0-9]+)*$/,At=(e,t,n,r="")=>{const a=e.split(":");if(e.slice(0,1)==="@"){if(a.length<2||a.length>3)return null;r=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const o=a.pop(),d=a.pop(),u={provider:a.length>0?a[0]:r,prefix:d,name:o};return t&&!gt(u)?null:u}const i=a[0],l=i.split("-");if(l.length>1){const o={provider:r,prefix:l.shift(),name:l.join("-")};return t&&!gt(o)?null:o}if(n&&r===""){const o={provider:r,prefix:"",name:i};return t&&!gt(o,n)?null:o}return null},gt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function zs(e){return typeof e=="boolean"&&(ct=e),ct}function Gn(e){const t=typeof e=="string"?At(e,!0,ct):e;if(t){const n=Xe(t.provider,t.prefix),r=t.name;return n.icons[r]||(n.missing.has(r)?null:void 0)}}function Ei(e,t){const n=At(e,!0,ct);if(!n)return!1;const r=Xe(n.provider,n.prefix);return t?Di(r,n.name,t):(r.missing.add(n.name),!0)}function Fi(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),ct&&!t&&!e.prefix){let a=!1;return Ps(e)&&(e.prefix="",Ls(e,(i,l)=>{Ei(i,l)&&(a=!0)})),a}const n=e.prefix;if(!gt({prefix:n,name:"a"}))return!1;const r=Xe(t,n);return!!Os(r,e)}const Rs=Object.freeze({width:null,height:null}),Bs=Object.freeze({...Rs,...vt}),Ii=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Mi=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Kn(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const r=e.split(Ii);if(r===null||!r.length)return e;const a=[];let i=r.shift(),l=Mi.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?a.push(i):a.push(Math.ceil(o*t*n)/n)}else a.push(i);if(i=r.shift(),i===void 0)return a.join("");l=!l}}function Ti(e,t="defs"){let n="";const r=e.indexOf("<"+t);for(;r>=0;){const a=e.indexOf(">",r),i=e.indexOf("</"+t);if(a===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;n+=e.slice(a+1,i).trim(),e=e.slice(0,r).trim()+e.slice(l+1)}return{defs:n,content:e}}function Li(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Pi(e,t,n){const r=Ti(e);return Li(r.defs,t+r.content+n)}const Oi=e=>e==="unset"||e==="undefined"||e==="none";function _i(e,t){const n={...xn,...e},r={...Bs,...t},a={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,r].forEach(v=>{const b=[],j=v.hFlip,y=v.vFlip;let S=v.rotate;j?y?S+=2:(b.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),b.push("scale(-1 1)"),a.top=a.left=0):y&&(b.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),b.push("scale(1 -1)"),a.top=a.left=0);let w;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:w=a.height/2+a.top,b.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:b.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:w=a.width/2+a.left,b.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}S%2===1&&(a.left!==a.top&&(w=a.left,a.left=a.top,a.top=w),a.width!==a.height&&(w=a.width,a.width=a.height,a.height=w)),b.length&&(i=Pi(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const l=r.width,o=r.height,d=a.width,u=a.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=Kn(m,d/u)):(f=l==="auto"?d:l,m=o===null?Kn(f,u/d):o==="auto"?u:o);const g={},h=(v,b)=>{Oi(b)||(g[v]=b.toString())};h("width",f),h("height",m);const N=[a.left,a.top,d,u];return g.viewBox=N.join(" "),{attributes:g,viewBox:N,body:i}}const zi=/\sid="(\S+)"/g,Ri="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Bi=0;function Vi(e,t=Ri){const n=[];let r;for(;r=zi.exec(e);)n.push(r[1]);if(!n.length)return e;const a="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const l=typeof t=="function"?t(i):t+(Bi++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+a+"$3")}),e=e.replace(new RegExp(a,"g"),""),e}const en=Object.create(null);function Ui(e,t){en[e]=t}function tn(e){return en[e]||en[""]}function pn(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const gn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],bt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?bt.push(tt.shift()):bt.push(tt.pop());gn[""]=pn({resources:["https://api.iconify.design"].concat(bt)});function Hi(e,t){const n=pn(t);return n===null?!1:(gn[e]=n,!0)}function bn(e){return gn[e]}const qi=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Qn=qi();function Wi(e,t){const n=bn(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let a=0;n.resources.forEach(l=>{a=Math.max(a,l.length)});const i=t+".json?icons=";r=n.maxURL-a-n.path.length-i.length}return r}function Yi(e){return e===404}const Gi=(e,t,n)=>{const r=[],a=Wi(e,t),i="icons";let l={type:i,provider:e,prefix:t,icons:[]},o=0;return n.forEach((d,u)=>{o+=d.length+1,o>=a&&u>0&&(r.push(l),l={type:i,provider:e,prefix:t,icons:[]},o=d.length),l.icons.push(d)}),r.push(l),r};function Ki(e){if(typeof e=="string"){const t=bn(e);if(t)return t.path}return"/"}const Qi=(e,t,n)=>{if(!Qn){n("abort",424);return}let r=Ki(t.provider);switch(t.type){case"icons":{const i=t.prefix,o=t.icons.join(","),d=new URLSearchParams({icons:o});r+=i+".json?"+d.toString();break}case"custom":{const i=t.uri;r+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let a=503;Qn(e+r).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{n(Yi(l)?"abort":"next",l)});return}return a=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",a)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",a)})},Zi={prepare:Gi,send:Qi};function Vs(e,t){e.forEach(n=>{const r=n.loaderCallbacks;r&&(n.loaderCallbacks=r.filter(a=>a.id!==t))})}function Xi(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1;const r=e.provider,a=e.prefix;t.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==a)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:r,prefix:a,name:u});else if(e.missing.has(u))l.missing.push({provider:r,prefix:a,name:u});else return n=!0,!0;return!1}),l.pending.length!==o&&(n||Vs([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let Ji=0;function el(e,t,n){const r=Ji++,a=Vs.bind(null,n,r);if(!t.pending.length)return a;const i={id:r,icons:t,callback:e,abort:a};return n.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),a}function tl(e){const t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((a,i)=>a.provider!==i.provider?a.provider.localeCompare(i.provider):a.prefix!==i.prefix?a.prefix.localeCompare(i.prefix):a.name.localeCompare(i.name));let r={provider:"",prefix:"",name:""};return e.forEach(a=>{if(r.name===a.name&&r.prefix===a.prefix&&r.provider===a.provider)return;r=a;const i=a.provider,l=a.prefix,o=a.name,d=n[i]||(n[i]=Object.create(null)),u=d[l]||(d[l]=Xe(i,l));let f;o in u.icons?f=t.loaded:l===""||u.missing.has(o)?f=t.missing:f=t.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),t}function nl(e,t=!0,n=!1){const r=[];return e.forEach(a=>{const i=typeof a=="string"?At(a,t,n):a;i&&r.push(i)}),r}const sl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function rl(e,t,n,r){const a=e.resources.length,i=e.random?Math.floor(Math.random()*a):e.index;let l;if(e.random){let E=e.resources.slice(0);for(l=[];E.length>1;){const I=Math.floor(Math.random()*E.length);l.push(E[I]),E=E.slice(0,I).concat(E.slice(I+1))}l=l.concat(E)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,g=[],h=[];typeof r=="function"&&h.push(r);function N(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),N(),g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function b(E,I){I&&(h=[]),typeof E=="function"&&h.push(E)}function j(){return{startTime:o,payload:t,status:d,queriesSent:u,queriesPending:g.length,subscribe:b,abort:v}}function y(){d="failed",h.forEach(E=>{E(void 0,f)})}function S(){g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function w(E,I,M){const $=I!=="success";switch(g=g.filter(_=>_!==E),d){case"pending":break;case"failed":if($||!e.dataAfterTimeout)return;break;default:return}if(I==="abort"){f=M,y();return}if($){f=M,g.length||(l.length?k():y());return}if(N(),S(),!e.random){const _=e.resources.indexOf(E.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",h.forEach(_=>{_(M)})}function k(){if(d!=="pending")return;N();const E=l.shift();if(E===void 0){if(g.length){m=setTimeout(()=>{N(),d==="pending"&&(S(),y())},e.timeout);return}y();return}const I={status:"pending",resource:E,callback:(M,$)=>{w(I,M,$)}};g.push(I),u++,m=setTimeout(k,e.rotate),n(E,t,I.callback)}return setTimeout(k),j}function Us(e){const t={...sl,...e};let n=[];function r(){n=n.filter(o=>o().status==="pending")}function a(o,d,u){const f=rl(t,o,d,(m,g)=>{r(),u&&u(m,g)});return n.push(f),f}function i(o){return n.find(d=>o(d))||null}return{query:a,find:i,setIndex:o=>{t.index=o},getIndex:()=>t.index,cleanup:r}}function Zn(){}const Pt=Object.create(null);function al(e){if(!Pt[e]){const t=bn(e);if(!t)return;const n=Us(t),r={config:t,redundancy:n};Pt[e]=r}return Pt[e]}function il(e,t,n){let r,a;if(typeof e=="string"){const i=tn(e);if(!i)return n(void 0,424),Zn;a=i.send;const l=al(e);l&&(r=l.redundancy)}else{const i=pn(e);if(i){r=Us(i);const l=e.resources?e.resources[0]:"",o=tn(l);o&&(a=o.send)}}return!r||!a?(n(void 0,424),Zn):r.query(t,a,n)().abort}function Xn(){}function ll(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Xi(e)}))}function ol(e){const t=[],n=[];return e.forEach(r=>{(r.match(_s)?t:n).push(r)}),{valid:t,invalid:n}}function nt(e,t,n){function r(){const a=e.pendingIcons;t.forEach(i=>{a&&a.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!Os(e,n).length){r();return}}catch(a){console.error(a)}r(),ll(e)}function Jn(e,t){e instanceof Promise?e.then(n=>{t(n)}).catch(()=>{t(null)}):t(e)}function cl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:r}=e,a=e.iconsToLoad;if(delete e.iconsToLoad,!a||!a.length)return;const i=e.loadIcon;if(e.loadIcons&&(a.length>1||!i)){Jn(e.loadIcons(a,r,n),f=>{nt(e,a,f)});return}if(i){a.forEach(f=>{const m=i(f,r,n);Jn(m,g=>{const h=g?{prefix:r,icons:{[f]:g}}:null;nt(e,[f],h)})});return}const{valid:l,invalid:o}=ol(a);if(o.length&&nt(e,o,null),!l.length)return;const d=r.match(_s)?tn(n):null;if(!d){nt(e,l,null);return}d.prepare(n,r,l).forEach(f=>{il(n,f,m=>{nt(e,f.icons,m)})})}))}const dl=(e,t)=>{const n=nl(e,!0,zs()),r=tl(n);if(!r.pending.length){let d=!0;return t&&setTimeout(()=>{d&&t(r.loaded,r.missing,r.pending,Xn)}),()=>{d=!1}}const a=Object.create(null),i=[];let l,o;return r.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(Xe(u,f));const m=a[u]||(a[u]=Object.create(null));m[f]||(m[f]=[])}),r.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,g=Xe(u,f),h=g.pendingIcons||(g.pendingIcons=new Set);h.has(m)||(h.add(m),a[u][f].push(m))}),i.forEach(d=>{const u=a[d.provider][d.prefix];u.length&&cl(d,u)}),t?el(t,r,i):Xn};function ul(e,t){const n={...e};for(const r in t){const a=t[r],i=typeof a;r in Rs?(a===null||a&&(i==="string"||i==="number"))&&(n[r]=a):i===typeof n[r]&&(n[r]=r==="rotate"?a%4:a)}return n}const fl=/[\s,]+/;function ml(e,t){t.split(fl).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function hl(e,t=0){const n=e.replace(/^-?[0-9.]*/,"");function r(a){for(;a<0;)a+=4;return a%4}if(n===""){const a=parseInt(e);return isNaN(a)?0:r(a)}else if(n!==e){let a=0;switch(n){case"%":a=25;break;case"deg":a=90}if(a){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/a,i%1===0?r(i):0)}}return t}function xl(e,t){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const r in t)n+=" "+r+'="'+t[r]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function pl(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,"+pl(e)}function bl(e){return'url("'+gl(e)+'")'}let it;function yl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function vl(e){return it===void 0&&yl(),it?it.createHTML(e):e}const Hs={...Bs,inline:!1},jl={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},wl={display:"inline-block"},nn={backgroundColor:"currentColor"},qs={backgroundColor:"transparent"},es={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ts={WebkitMask:nn,mask:nn,background:qs};for(const e in ts){const t=ts[e];for(const n in es)t[e+n]=es[n]}const Nl={...Hs,inline:!0};function ns(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Cl=(e,t,n)=>{const r=t.inline?Nl:Hs,a=ul(r,t),i=t.mode||"svg",l={},o=t.style||{},d={...i==="svg"?jl:{}};if(n){const b=At(n,!1,!0);if(b){const j=["iconify"],y=["provider","prefix"];for(const S of y)b[S]&&j.push("iconify--"+b[S]);d.className=j.join(" ")}}for(let b in t){const j=t[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":a[b]=j===!0||j==="true"||j===1;break;case"flip":typeof j=="string"&&ml(a,j);break;case"color":l.color=j;break;case"rotate":typeof j=="string"?a[b]=hl(j):typeof j=="number"&&(a[b]=j);break;case"ariaHidden":case"aria-hidden":j!==!0&&j!=="true"&&delete d["aria-hidden"];break;default:r[b]===void 0&&(d[b]=j)}}const u=_i(e,a),f=u.attributes;if(a.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let b=0,j=t.id;return typeof j=="string"&&(j=j.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:vl(Vi(u.body,j?()=>j+"ID"+b++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:g,height:h}=e,N=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=xl(m,{...f,width:g+"",height:h+""});return d.style={...l,"--svg":bl(v),width:ns(f.width),height:ns(f.height),...wl,...N?nn:qs,...o},p.createElement("span",d)};zs(!0);Ui("",Zi);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(r=>{try{(typeof r!="object"||r===null||r instanceof Array||typeof r.icons!="object"||typeof r.prefix!="string"||!Fi(r))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let n in t){const r="IconifyProviders["+n+"] is invalid.";try{const a=t[n];if(typeof a!="object"||!a||a.resources===void 0)continue;Hi(n,a)||console.error(r)}catch{console.error(r)}}}}function Ws(e){const[t,n]=p.useState(!!e.ssr),[r,a]=p.useState({});function i(h){if(h){const N=e.icon;if(typeof N=="object")return{name:"",data:N};const v=Gn(N);if(v)return{name:N,data:v}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const h=r.callback;h&&(h(),a({}))}function u(h){if(JSON.stringify(l)!==JSON.stringify(h))return d(),o(h),!0}function f(){var h;const N=e.icon;if(typeof N=="object"){u({name:"",data:N});return}const v=Gn(N);if(u({name:N,data:v}))if(v===void 0){const b=dl([N],f);a({callback:b})}else v&&((h=e.onLoad)===null||h===void 0||h.call(e,N))}p.useEffect(()=>(n(!0),d),[]),p.useEffect(()=>{t&&f()},[e.icon,t]);const{name:m,data:g}=l;return g?Cl({...xn,...g},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const V=p.forwardRef((e,t)=>Ws({...e,_ref:t}));p.forwardRef((e,t)=>Ws({inline:!0,...e,_ref:t}));const U=p.forwardRef(({color:e="primary",radius:t="full",testId:n="veevart-button",...r},a)=>s.jsx(c.Button,{ref:a,color:e,radius:t,"data-testid":n,...r}));U.displayName="Button";function Ys({code:e,amount:t,onRemove:n,label:r="Gift Card",removeAriaLabel:a="Remove gift card",testId:i="veevart-applied-code-card"}){return s.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:s.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx("span",{className:"text-xs text-default-500",children:r}),s.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),s.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:t})]}),s.jsx(U,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":a,onPress:n,children:s.jsx(V,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ot(e,t){return e-t*Math.floor(e/t)}const Gs=1721426;function xt(e,t,n,r){t=yn(e,t);let a=t-1,i=-2;return n<=2?i=0:yt(t)&&(i=-1),Gs-1+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)+Math.floor((367*n-362)/12+i+r)}function yt(e){return e%4===0&&(e%100!==0||e%400===0)}function yn(e,t){return e==="BC"?1-t:t}function kl(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const Sl={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class $t{fromJulianDay(t){let n=t,r=n-Gs,a=Math.floor(r/146097),i=Ot(r,146097),l=Math.floor(i/36524),o=Ot(i,36524),d=Math.floor(o/1461),u=Ot(o,1461),f=Math.floor(u/365),m=a*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[g,h]=kl(m),N=n-xt(g,h,1,1),v=2;n<xt(g,h,3,1)?v=0:yt(h)&&(v=1);let b=Math.floor(((N+v)*12+373)/367),j=n-xt(g,h,b,1)+1;return new dt(g,h,b,j)}toJulianDay(t){return xt(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return Sl[yt(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return yt(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}function Al(e,t){var n,r,a,i;return(i=(a=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,t))!==null&&a!==void 0?a:(r=t.isEqual)===null||r===void 0?void 0:r.call(t,e))!==null&&i!==void 0?i:e.identifier===t.identifier}function Ks(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Qs(e,t){return ss(e)-ss(t)}function ss(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let _t=null;function Zs(){return _t==null&&(_t=new Intl.DateTimeFormat().resolvedOptions().timeZone),_t}function rs(e){e=vn(e,new $t);let t=yn(e.era,e.year);return Xs(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Xs(e,t,n,r,a,i,l){let o=new Date;return o.setUTCHours(r,a,i,l),o.setUTCFullYear(e,t-1,n),o.getTime()}function as(e,t){if(t==="UTC")return 0;if(e>0&&t===Zs())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:r,day:a,hour:i,minute:l,second:o}=Js(e,t);return Xs(n,r,a,i,l,o,0)-Math.floor(e/1e3)*1e3}const is=new Map;function Js(e,t){let n=is.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),is.set(t,n));let r=n.formatToParts(new Date(e)),a={};for(let i of r)i.type!=="literal"&&(a[i.type]=i.value);return{year:a.era==="BC"||a.era==="B"?-a.year+1:+a.year,month:+a.month,day:+a.day,hour:a.hour==="24"?0:+a.hour,minute:+a.minute,second:+a.second}}const ls=864e5;function $l(e,t,n,r){return(n===r?[n]:[n,r]).filter(i=>Dl(e,t,i))}function Dl(e,t,n){let r=Js(n,t);return e.year===r.year&&e.month===r.month&&e.day===r.day&&e.hour===r.hour&&e.minute===r.minute&&e.second===r.second}function El(e,t,n="compatible"){let r=tr(e);if(t==="UTC")return rs(r);if(t===Zs()&&n==="compatible"){r=vn(r,new $t);let d=new Date,u=yn(r.era,r.year);return d.setFullYear(u,r.month-1,r.day),d.setHours(r.hour,r.minute,r.second,r.millisecond),d.getTime()}let a=rs(r),i=as(a-ls,t),l=as(a+ls,t),o=$l(r,t,a-i,a-l);if(o.length===1)return o[0];if(o.length>1)switch(n){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(n){case"earlier":return Math.min(a-i,a-l);case"compatible":case"later":return Math.max(a-i,a-l);case"reject":throw new RangeError("No such absolute time found")}}function er(e,t,n="compatible"){return new Date(El(e,t,n))}function tr(e,t){let n=0,r=0,a=0,i=0;if("timeZone"in e)({hour:n,minute:r,second:a,millisecond:i}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:r,second:a,millisecond:i}=t),new jt(e.calendar,e.era,e.year,e.month,e.day,n,r,a,i)}function vn(e,t){if(Al(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),r=e.copy();return r.calendar=t,r.era=n.era,r.year=n.year,r.month=n.month,r.day=n.day,Je(r),r}function jn(e,t){let n=e.copy(),r="hour"in n?or(n,t):0;sn(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,rn(n),nr(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=r,Fl(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let a=n.calendar.getYearsInEra(n);if(n.year>a){var i,l;let d=(i=(l=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,n);n.year=a,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function sn(e,t){var n,r;!((n=(r=e.calendar).isInverseEra)===null||n===void 0)&&n.call(r,e)&&(t=-t),e.year+=t}function rn(e){for(;e.month<1;)sn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,sn(e,1)}function Fl(e){for(;e.day<1;)e.month--,rn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,rn(e)}function nr(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)),nr(e)}function sr(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function rr(e,t){return jn(e,sr(t))}function ar(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Je(n),n}function ir(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),lr(n),n}function Il(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 t=Math.floor(e.hour/24);return e.hour=pt(e.hour,24),t}function lr(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,t){let n=e%t;return n<0&&(n+=t),n}function or(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Il(e)}function cr(e,t){let n=e.copy();return or(n,t),n}function Ml(e,t){return cr(e,sr(t))}function dr(e,t,n,r){let a=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=_e(d,n,0,o.length-1,r?.round),a.era=o[d],Je(a);break}case"year":var i,l;!((i=(l=a.calendar).isInverseEra)===null||i===void 0)&&i.call(l,a)&&(n=-n),a.year=_e(e.year,n,-1/0,9999,r?.round),a.year===-1/0&&(a.year=1),a.calendar.balanceYearMonth&&a.calendar.balanceYearMonth(a,e);break;case"month":a.month=_e(e.month,n,1,e.calendar.getMonthsInYear(e),r?.round);break;case"day":a.day=_e(e.day,n,1,e.calendar.getDaysInMonth(e),r?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(a),Je(a),a}function ur(e,t,n,r){let a=e.copy();switch(t){case"hour":{let i=e.hour,l=0,o=23;if(r?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}a.hour=_e(i,n,l,o,r?.round);break}case"minute":a.minute=_e(e.minute,n,0,59,r?.round);break;case"second":a.second=_e(e.second,n,0,59,r?.round);break;case"millisecond":a.millisecond=_e(e.millisecond,n,0,999,r?.round);break;default:throw new Error("Unsupported field "+t)}return a}function _e(e,t,n,r,a=!1){if(a){e+=Math.sign(t),e<n&&(e=r);let i=Math.abs(t);t>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>r&&(e=n)}else e+=t,e<n?e=r-(n-e-1):e>r&&(e=n+(e-r-1));return e}const Tl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Ll=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Pl(e){let t=e.match(Tl);if(!t)throw Ll.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new dt(zt(t[1],0,9999),zt(t[2],1,12),1);return n.day=zt(t[3],1,n.calendar.getDaysInMonth(n)),n}function zt(e,t,n){let r=Number(e);if(r<t||r>n)throw new RangeError(`Value out of range: ${t} <= ${r} <= ${n}`);return r}function fr(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 mr(e){let t=vn(e,new $t),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function Ol(e){return`${mr(e)}T${fr(e)}`}function _l(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function wn(e,t,n){_l(e,t),t.set(e,n)}function hr(e){let t=typeof e[0]=="object"?e.shift():new $t,n;if(typeof e[0]=="string")n=e.shift();else{let l=t.getEras();n=l[l.length-1]}let r=e.shift(),a=e.shift(),i=e.shift();return[t,n,r,a,i]}var zl=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(t){return jn(this,t)}subtract(t){return rr(this,t)}set(t){return ar(this,t)}cycle(t,n,r){return dr(this,t,n,r)}toDate(t){return er(this,t)}toString(){return mr(this)}compare(t){return Ks(this,t)}constructor(...t){wn(this,zl,{writable:!0,value:void 0});let[n,r,a,i,l]=hr(t);this.calendar=n,this.era=r,this.year=a,this.month=i,this.day=l,Je(this)}}var Rl=new WeakMap;class Dt{copy(){return new Dt(this.hour,this.minute,this.second,this.millisecond)}add(t){return cr(this,t)}subtract(t){return Ml(this,t)}set(t){return ir(this,t)}cycle(t,n,r){return ur(this,t,n,r)}toString(){return fr(this)}compare(t){return Qs(this,t)}constructor(t=0,n=0,r=0,a=0){wn(this,Rl,{writable:!0,value:void 0}),this.hour=t,this.minute=n,this.second=r,this.millisecond=a,lr(this)}}var Bl=new WeakMap;class jt{copy(){return this.era?new jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return jn(this,t)}subtract(t){return rr(this,t)}set(t){return ar(ir(this,t),t)}cycle(t,n,r){switch(t){case"era":case"year":case"month":case"day":return dr(this,t,n,r);default:return ur(this,t,n,r)}}toDate(t,n){return er(this,t,n)}toString(){return Ol(this)}compare(t){let n=Ks(this,t);return n===0?Qs(this,tr(t)):n}constructor(...t){wn(this,Bl,{writable:!0,value:void 0});let[n,r,a,i,l]=hr(t);this.calendar=n,this.era=r,this.year=a,this.month=i,this.day=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Je(this)}}const Vl="Open time options",Ul=320;function os(e,t){return typeof t=="string"&&t.length>0?`${e} ${t}`:e}function Rt(e){if(!e)return null;const t="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,r="second"in e&&typeof e.second=="number"?e.second:0;return new Dt(t,n,r)}function Hl(e,t){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:t===12}).format(n)}function ql(e){const t=[];for(let n=0;n<24;n+=1)for(let r=0;r<60;r+=e)t.push(new Dt(n,r));return t}function Wl(e){const{minuteStep:t=15,timeListClassName:n,timeListLabel:r=Vl,selectorButtonProps:a,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[g,h]=p.useState(()=>Rt(d)),N=m?Rt(o):g,v=p.useMemo(()=>ql(t),[t]),b=y=>{m||h(y),l?.(y)},j=s.jsxs(c.Popover,{placement:"bottom-end",children:[s.jsx(c.PopoverTrigger,{children:s.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":r,...a,onPress:void 0,children:s.jsx(G.Clock3,{className:"size-4",strokeWidth:1.75})})}),s.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:s.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:s.jsx("div",{className:"flex flex-col p-1",children:v.map(y=>{const S=N?.hour===y.hour&&N?.minute===y.minute;return s.jsx(c.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(y),children:Hl(y,u)},`${y.hour}:${y.minute}`)})})})})]});return s.jsx(c.TimeInput,{...f,value:m?N:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:s.jsxs("div",{className:"flex items-center gap-1",children:[i,j]}),onChange:y=>b(Rt(y))})}function Nn(e){if(e.mode==="time")return s.jsx(Wl,{...e});if(e.mode==="datetime"){const{mode:a,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=Ul,disableAnimation:d=!0,classNames:u,...f}=e;return s.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:os("min-w-[20rem]",u?.popoverContent),calendarContent:os("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:t,granularity:n="day",...r}=e;return s.jsx(c.DatePicker,{...r,granularity:n})}function Yl(e){const t=e?.closest('[role="dialog"]');return t?.parentElement??t??void 0}const ze=p.forwardRef(({popoverProps:e,...t},n)=>{const r=p.useRef(null),[a,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(a?!0:void 0),portalContainer:e?.portalContainer??a};return p.useEffect(()=>{i(Yl(r.current))},[]),s.jsx("span",{ref:r,className:"contents",children:s.jsx(c.Select,{ref:n,...t,popoverProps:l})})});ze.displayName="Select";function Gl({state:e,onSubmit:t,onRemove:n,appliedCredit:r,errorMessage:a,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),g=p.useId(),[h,N]=p.useState(e);e!==h&&(N(e),e==="applied"&&m(""));const v=()=>{const y=f.trim();y&&t(y)},b=y=>{y.key==="Enter"&&(y.preventDefault(),v())};if(e==="applied"&&r)return s.jsx("div",{"data-testid":u,children:s.jsx(Ys,{code:r.code,amount:r.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const j=e==="error"&&a!=null;return s.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":j?g:void 0}),s.jsx(U,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:v,children:o})]}),j&&s.jsx("p",{id:g,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:a})]})}const Kl={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Ql({languages:e,selectedLanguage:t,onLanguageChange:n,label:r}){const a=e.find(i=>i.code===t);return s.jsx("div",{className:"flex items-center",children:s.jsxs("div",{className:"relative flex items-center",children:[s.jsx(ze,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":r,selectedKeys:t?[t]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||t;n?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:r,startContent:s.jsx(G.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>s.jsx("span",{children:a?.label||r}),size:"md",radius:"full",children:e.map(i=>s.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),s.jsx(ze,{"aria-label":r,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:t?[t]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||t;n?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:s.jsx(G.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>s.jsx("span",{children:a?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>s.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Zl({isLoggedIn:e,onLogin:t,onLogout:n,labels:r}){return e?s.jsxs(U,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[s.jsx(G.User,{className:"inline w-5 h-5"}),s.jsx("span",{className:"hidden md:inline",children:r.logout})]}):s.jsxs(U,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:t,size:"md",children:[s.jsx(G.User,{className:"inline w-5 h-5"}),s.jsx("span",{className:"hidden md:inline",children:r.login})]})}function Xl({logo:e,languages:t=[],selectedLanguage:n,onLanguageChange:r,isLoggedIn:a,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...Kl,...u};return s.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[s.jsx("div",{className:"flex items-center min-w-10",children:e&&s.jsx("a",{href:"/",className:"block",children:s.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),s.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||t.length>0)&&s.jsx(Ql,{languages:t,selectedLanguage:n,onLanguageChange:r,label:m.selectLanguage}),d&&s.jsx(Zl,{isLoggedIn:a,onLogin:i,onLogout:l,labels:m})]})]})}function Jl(e){return s.jsx("div",{className:"min-h-screen flex flex-col",children:s.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:s.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 Bt;const eo=typeof document<"u"?(Bt=p.useInsertionEffect)!==null&&Bt!==void 0?Bt:p.useLayoutEffect:()=>{};function Cn(e,t,n){let[r,a]=p.useState(e||t),i=p.useRef(r),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:r;eo(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...g)=>{let h=typeof m=="function"?m(i.current):m;Object.is(i.current,h)||(i.current=h,a(h),u(),n?.(h,...g))},[n]);return[d,f]}function to(e){return s.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:s.jsx(Se.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 xr=p.forwardRef(({color:e="primary",variant:t="default",stepsCount:n=3,defaultStep:r=0,label:a,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:g,currentStep:h,hideProgressBars:N=!1,stepClassName:v,className:b,isDisabled:j=!1,...y},S)=>{const[w,k]=Cn(h,r,g),E=p.useMemo(()=>{let I,M;const $=["[--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":I="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":I="[--step-color:var(--heroui-secondary)]",M="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":I="[--step-color:var(--heroui-success)]",M="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":I="[--step-color:var(--heroui-warning)]",M="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":I="[--step-color:var(--heroui-danger)]",M="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":I="[--step-color:var(--heroui-default)]",M="[--step-fg-color:var(--heroui-default-foreground)]";break;default:I="[--step-color:var(--heroui-primary)]",M="[--step-fg-color:var(--heroui-primary-foreground)]";break}return $.unshift(M),$.unshift(I),$},[e]);return s.jsxs("nav",{ref:S,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...y,children:[d&&u==="left"?s.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null,a&&s.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:a}),s.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",E,b),"data-testid":"stepper-list",children:Array.from({length:n})?.map((I,M)=>{const $=w===M?"active":w<M?"inactive":"complete",_=t==="activeLabel"&&$==="active"&&!!i?.[M],F=l&&$!=="active"&&!!i?.[M];return s.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${M}`,children:[s.jsx(c.Tooltip,{content:F?i?.[M]:void 0,isDisabled:!F,offset:12,placement:o,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:s.jsxs("button",{"aria-current":$==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":j},v),onClick:()=>!j&&k(M),disabled:j,"data-testid":`stepper-step-btn-${M}`,children:[s.jsx("div",{className:"h-full relative flex items-center",children:s.jsx(Se.LazyMotion,{features:Se.domAnimation,children:s.jsx(Se.m.div,{animate:$,className:"relative z-10",children:s.jsx(Se.m.div,{animate:$,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":$==="complete","shadow-lg":$==="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:s.jsx("div",{className:"flex items-center justify-center",children:$==="complete"&&t==="default"?s.jsx(to,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${M}`}):s.jsx("span",{children:M+1})})})})})}),_?s.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<n-1&&!N&&s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":M},children:s.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<w})})})]},M)})}),d&&u==="right"?s.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null]})});xr.displayName="Stepper";function no(e){return s.jsx("div",{className:"min-h-screen flex flex-col",children:s.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:s.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 Re(e,t="en-US",n="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function kn(e,t="en-US"){try{const n=new Intl.NumberFormat(t,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function pr(e,t,n="en-US"){const r=kn(t,n),a=Math.pow(10,r);return Math.round(e*a)/a}function an(e,t,n,r){return pr(e-t,n,r)}function so(){return s.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 ro=e=>{const t=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return s.jsx(ao,{...e},t)},ao=({allItems:e,selected:t,onSelectedChange:n,titleLeft:r,titleRight:a})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,g]=p.useState(null),h=p.useMemo(()=>new Set(t),[t]),N=p.useMemo(()=>new Set(e),[e]),v=p.useMemo(()=>e.filter(F=>!h.has(F)),[e,h]),b=F=>{if(F.length===0)return;const A=Array.from(new Set([...t,...F]));n(A)},j=F=>{if(F.length===0)return;const A=new Set(F);n(t.filter(T=>!A.has(T)))},y=()=>{i.length!==0&&(b(i),l([]))},S=()=>{o.length!==0&&(j(o),d([]))},w=()=>{v.length!==0&&(b(v),l([]))},k=()=>{t.length!==0&&(n([]),d([]))},E=(F,A,T)=>{const P=Math.min(A,T),K=Math.max(A,T);return F.slice(P,K+1)},I=(F,A,T)=>{if(T&&u!==null){l(E(v,u,A)),d([]),f(A);return}const P=i.includes(F);l(P?i.filter(K=>K!==F):[...i,F]),d([]),f(A)},M=(F,A,T)=>{if(T&&m!==null){d(E(t,m,A)),l([]),g(A);return}const P=o.includes(F);d(P?o.filter(K=>K!==F):[...o,F]),l([]),g(A)},$=(F,A,T)=>{const P=T==="available"?i.includes(A)?i:[A]:o.includes(A)?o:[A];F.dataTransfer.setData("text/plain",JSON.stringify({source:T,items:P})),F.dataTransfer.effectAllowed="move"},_=(F,A)=>{F.preventDefault();const T=F.dataTransfer.getData("text/plain");if(T)try{const P=JSON.parse(T),K=(P.items||[]).filter(q=>N.has(q));if(K.length===0||P.source===A)return;A==="selected"?(b(K),l([])):(j(K),d([]))}catch{return}};return s.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[s.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[s.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),s.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:s.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:v.map((F,A)=>{const T=i.includes(F);return s.jsx("button",{type:"button",onClick:P=>{I(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${T?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),s.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[s.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:y,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),s.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:S,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),s.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:v.length===0,"aria-label":"Move all to right",children:"»"}),s.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:k,"data-testid":"move-all-to-available",isDisabled:t.length===0,"aria-label":"Move all to left",children:"«"})]}),s.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[s.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),s.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:s.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:t.map((F,A)=>{const T=o.includes(F);return s.jsx("button",{type:"button",onClick:P=>{M(F,A,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>$(P,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${T?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return s.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:s.jsx(c.Divider,{orientation:"vertical"})})}function qe({icon:e,label:t,isActive:n=!1,isDisabled:r=!1,onClick:a,shortcut:i,iconSize:l=16,className:o}){const d=i?`${t} (${i})`:t;return s.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:s.jsx(U,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:r,onPress:a,"aria-label":t,className:o,children:s.jsx(e,{size:l})})})}const Ie={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:t})=>{const n=t?.type==="textColor"?t.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:t})=>{const n=t?.type==="highlight"?t.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:t})=>{const n=t?.type==="link"?t.href:"";if(n){const r=t?.type==="link"?t.target:void 0,a=t?.type==="link"?t.rel:void 0;e.chain().focus().setLink({href:n,target:r,rel:a}).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:t})=>{const n=t?.type==="heading"?t.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,t)=>{const n=t?.type==="heading"?t.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,t)=>t?.type==="heading"?e.isActive("heading",{level:t.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:t})=>{const n=t?.type==="textAlign"?t.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,t)=>t?.type==="textAlign"?e.isActive({textAlign:t.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"}},io={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function lo({editor:e,levels:t=[1,2,3,4,5,6],isDisabled:n=!1}){const[,r]=p.useState(0);p.useEffect(()=>{const l=()=>r(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const a=t.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Ie.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return s.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[s.jsx(c.DropdownTrigger,{children:s.jsx(U,{size:"sm",radius:"sm",variant:a?"solid":"bordered",color:a?"primary":"default",isDisabled:n,startContent:s.jsx(G.Heading,{size:16}),"aria-label":"Select heading level",children:a?`H${a}`:"H"})}),s.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:a?new Set([String(a)]):new Set,onAction:i,children:t.map(l=>s.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?s.jsx(G.Check,{size:16}):s.jsx("div",{className:"w-4"}),children:io[l]},l))})]})}const Vt={bulletList:{label:"Bullet List",icon:G.List},orderedList:{label:"Numbered List",icon:G.ListOrdered},taskList:{label:"Task List",icon:G.ListTodo}};function oo({editor:e,types:t=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,r]=p.useState(0);p.useEffect(()=>{const o=()=>r(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const a=t.find(o=>e.isActive(o)),i=a?Vt[a].icon:G.List,l=o=>{const u=Ie[o];u&&u.execute({editor:e})};return s.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[s.jsx(c.DropdownTrigger,{children:s.jsx(U,{size:"sm",radius:"sm",variant:a?"solid":"bordered",color:a?"primary":"default",isDisabled:n,isIconOnly:!0,"aria-label":"Select list type",children:s.jsx(i,{size:16})})}),s.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:a?new Set([a]):new Set,onAction:l,children:t.map(o=>{const d=Vt[o].icon;return s.jsx(c.DropdownItem,{startContent:s.jsx(d,{size:16}),children:Vt[o].label},o)})})]})}function co({colors:e,selectedColor:t,onColorSelect:n,columns:r=4}){return s.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map(a=>{const i=t===a;return s.jsx("button",{type:"button",onClick:()=>n(a),className:`
7
+ `}function Ti({children:e}){return t.jsx(d.HeroUIProvider,{children:e})}function Pi(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,c=l&&i(l);c&&(r[o]=[l].concat(c))}return r[o]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Vs=Object.freeze({left:0,top:0,width:16,height:16}),jt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),pn=Object.freeze({...Vs,...jt}),en=Object.freeze({...pn,body:"",hidden:!1});function _i(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 Jn(e,n){const s=_i(e,n);for(const a in en)a in jt?a in e&&!(a in s)&&(s[a]=jt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function Oi(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Jn(a[l]||r[l],i)}return o(n),s.forEach(o),Jn(e,i)}function Us(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=Pi(e);for(const r in a){const i=a[r];i&&(n(r,Oi(e,r,i)),s.push(r))}return s}const Ri={provider:"",aliases:{},not_found:{},...Vs};function Pt(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Hs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Pt(e,Ri))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Pt(i,en))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]||!Pt(i,en))return null}return n}const es=Object.create(null);function zi(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Xe(e,n){const s=es[e]||(es[e]=Object.create(null));return s[n]||(s[n]=zi(e,n))}function qs(e,n){return Hs(n)?Us(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function Bi(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const Ws=/^[a-z0-9]+(-[a-z0-9]+)*$/,At=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),c=r.pop(),u={provider:r.length>0?r[0]:a,prefix:c,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 Ys(e){return typeof e=="boolean"&&(ct=e),ct}function ts(e){const n=typeof e=="string"?At(e,!0,ct):e;if(n){const s=Xe(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function Vi(e,n){const s=At(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?Bi(a,s.name,n):(a.missing.add(s.name),!0)}function Ui(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return Hs(e)&&(e.prefix="",Us(e,(i,o)=>{Vi(i,o)&&(r=!0)})),r}const s=e.prefix;if(!bt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!qs(a,e)}const Ks=Object.freeze({width:null,height:null}),Gs=Object.freeze({...Ks,...jt}),Hi=/(-?[0-9.]*[0-9]+[0-9.]*)/g,qi=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ns(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(Hi);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=qi.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 Wi(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 Yi(e,n){return e?"<defs>"+e+"</defs>"+n:n}function Ki(e,n,s){const a=Wi(e);return Yi(a.defs,n+a.content+s)}const Gi=e=>e==="unset"||e==="undefined"||e==="none";function Qi(e,n){const s={...pn,...e},a={...Gs,...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,y=j.vFlip;let S=j.rotate;w?y?S+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):y&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let N;switch(S<0&&(S-=Math.floor(S/4)*4),S=S%4,S){case 1:N=r.height/2+r.top,b.unshift("rotate(90 "+N.toString()+" "+N.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:N=r.width/2+r.left,b.unshift("rotate(-90 "+N.toString()+" "+N.toString()+")");break}S%2===1&&(r.left!==r.top&&(N=r.left,r.left=r.top,r.top=N),r.width!==r.height&&(N=r.width,r.width=r.height,r.height=N)),b.length&&(i=Ki(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,c=r.width,u=r.height;let f,h;o===null?(h=l===null?"1em":l==="auto"?u:l,f=ns(h,c/u)):(f=o==="auto"?c:o,h=l===null?ns(f,u/c):l==="auto"?u:l);const g={},m=(j,b)=>{Gi(b)||(g[j]=b.toString())};m("width",f),m("height",h);const v=[r.left,r.top,c,u];return g.viewBox=v.join(" "),{attributes:g,viewBox:v,body:i}}const Zi=/\sid="(\S+)"/g,Xi="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Ji=0;function el(e,n=Xi){const s=[];let a;for(;a=Zi.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+(Ji++).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 tn=Object.create(null);function tl(e,n){tn[e]=n}function nn(e){return tn[e]||tn[""]}function gn(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 bn=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());bn[""]=gn({resources:["https://api.iconify.design"].concat(yt)});function nl(e,n){const s=gn(n);return s===null?!1:(bn[e]=s,!0)}function yn(e){return bn[e]}const sl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let ss=sl();function al(e,n){const s=yn(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 rl(e){return e===404}const il=(e,n,s)=>{const a=[],r=al(e,n),i="icons";let o={type:i,provider:e,prefix:n,icons:[]},l=0;return s.forEach((c,u)=>{l+=c.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:n,icons:[]},l=c.length),o.icons.push(c)}),a.push(o),a};function ll(e){if(typeof e=="string"){const n=yn(e);if(n)return n.path}return"/"}const ol=(e,n,s)=>{if(!ss){s("abort",424);return}let a=ll(n.provider);switch(n.type){case"icons":{const i=n.prefix,l=n.icons.join(","),c=new URLSearchParams({icons:l});a+=i+".json?"+c.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;ss(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{s(rl(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)})},cl={prepare:il,send:ol};function Qs(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(c=>{if(c.prefix!==r)return!0;const u=c.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||Qs([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let ul=0;function fl(e,n,s){const a=ul++,r=Qs.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,c=s[i]||(s[i]=Object.create(null)),u=c[o]||(c[o]=Xe(i,o));let f;l in u.icons?f=n.loaded:o===""||u.missing.has(l)?f=n.missing:f=n.pending;const h={provider:i,prefix:o,name:l};f.push(h)}),n}function hl(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?At(r,n,s):r;i&&a.push(i)}),a}const xl={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function pl(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 E=e.resources.slice(0);for(o=[];E.length>1;){const M=Math.floor(Math.random()*E.length);o.push(E[M]),E=E.slice(0,M).concat(E.slice(M+1))}o=o.concat(E)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let c="pending",u=0,f,h=null,g=[],m=[];typeof a=="function"&&m.push(a);function v(){h&&(clearTimeout(h),h=null)}function j(){c==="pending"&&(c="aborted"),v(),g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function b(E,M){M&&(m=[]),typeof E=="function"&&m.push(E)}function w(){return{startTime:l,payload:n,status:c,queriesSent:u,queriesPending:g.length,subscribe:b,abort:j}}function y(){c="failed",m.forEach(E=>{E(void 0,f)})}function S(){g.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),g=[]}function N(E,M,L){const A=M!=="success";switch(g=g.filter(O=>O!==E),c){case"pending":break;case"failed":if(A||!e.dataAfterTimeout)return;break;default:return}if(M==="abort"){f=L,y();return}if(A){f=L,g.length||(o.length?k():y());return}if(v(),S(),!e.random){const O=e.resources.indexOf(E.resource);O!==-1&&O!==e.index&&(e.index=O)}c="completed",m.forEach(O=>{O(L)})}function k(){if(c!=="pending")return;v();const E=o.shift();if(E===void 0){if(g.length){h=setTimeout(()=>{v(),c==="pending"&&(S(),y())},e.timeout);return}y();return}const M={status:"pending",resource:E,callback:(L,A)=>{N(M,L,A)}};g.push(M),u++,h=setTimeout(k,e.rotate),s(E,n,M.callback)}return setTimeout(k),w}function Zs(e){const n={...xl,...e};let s=[];function a(){s=s.filter(l=>l().status==="pending")}function r(l,c,u){const f=pl(n,l,c,(h,g)=>{a(),u&&u(h,g)});return s.push(f),f}function i(l){return s.find(c=>l(c))||null}return{query:r,find:i,setIndex:l=>{n.index=l},getIndex:()=>n.index,cleanup:a}}function as(){}const _t=Object.create(null);function gl(e){if(!_t[e]){const n=yn(e);if(!n)return;const s=Zs(n),a={config:n,redundancy:s};_t[e]=a}return _t[e]}function bl(e,n,s){let a,r;if(typeof e=="string"){const i=nn(e);if(!i)return s(void 0,424),as;r=i.send;const o=gl(e);o&&(a=o.redundancy)}else{const i=gn(e);if(i){a=Zs(i);const o=e.resources?e.resources[0]:"",l=nn(o);l&&(r=l.send)}}return!a||!r?(s(void 0,424),as):a.query(n,r,s)().abort}function rs(){}function yl(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,dl(e)}))}function vl(e){const n=[],s=[];return e.forEach(a=>{(a.match(Ws)?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(!qs(e,s).length){a();return}}catch(r){console.error(r)}a(),yl(e)}function is(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function jl(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)){is(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const h=i(f,a,s);is(h,g=>{const m=g?{prefix:a,icons:{[f]:g}}:null;nt(e,[f],m)})});return}const{valid:o,invalid:l}=vl(r);if(l.length&&nt(e,l,null),!o.length)return;const c=a.match(Ws)?nn(s):null;if(!c){nt(e,o,null);return}c.prepare(s,a,o).forEach(f=>{bl(s,f,h=>{nt(e,f.icons,h)})})}))}const wl=(e,n)=>{const s=hl(e,!0,Ys()),a=ml(s);if(!a.pending.length){let c=!0;return n&&setTimeout(()=>{c&&n(a.loaded,a.missing,a.pending,rs)}),()=>{c=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(c=>{const{provider:u,prefix:f}=c;if(f===l&&u===o)return;o=u,l=f,i.push(Xe(u,f));const h=r[u]||(r[u]=Object.create(null));h[f]||(h[f]=[])}),a.pending.forEach(c=>{const{provider:u,prefix:f,name:h}=c,g=Xe(u,f),m=g.pendingIcons||(g.pendingIcons=new Set);m.has(h)||(m.add(h),r[u][f].push(h))}),i.forEach(c=>{const u=r[c.provider][c.prefix];u.length&&jl(c,u)}),n?fl(n,a,i):rs};function Nl(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in Ks?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Cl=/[\s,]+/;function kl(e,n){n.split(Cl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Sl(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 $l(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 Al(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Dl(e){return"data:image/svg+xml,"+Al(e)}function El(e){return'url("'+Dl(e)+'")'}let it;function Fl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Ml(e){return it===void 0&&Fl(),it?it.createHTML(e):e}const Xs={...Gs,inline:!1},Ll={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Il={display:"inline-block"},sn={backgroundColor:"currentColor"},Js={backgroundColor:"transparent"},ls={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},os={WebkitMask:sn,mask:sn,background:Js};for(const e in os){const n=os[e];for(const s in ls)n[e+s]=ls[s]}const Tl={...Xs,inline:!0};function cs(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Pl=(e,n,s)=>{const a=n.inline?Tl:Xs,r=Nl(a,n),i=n.mode||"svg",o={},l=n.style||{},c={...i==="svg"?Ll:{}};if(s){const b=At(s,!1,!0);if(b){const w=["iconify"],y=["provider","prefix"];for(const S of y)b[S]&&w.push("iconify--"+b[S]);c.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":c.ref=w;break;case"className":c[b]=(c[b]?c[b]+" ":"")+w;break;case"inline":case"hFlip":case"vFlip":r[b]=w===!0||w==="true"||w===1;break;case"flip":typeof w=="string"&&kl(r,w);break;case"color":o.color=w;break;case"rotate":typeof w=="string"?r[b]=Sl(w):typeof w=="number"&&(r[b]=w);break;case"ariaHidden":case"aria-hidden":w!==!0&&w!=="true"&&delete c["aria-hidden"];break;default:a[b]===void 0&&(c[b]=w)}}const u=Qi(e,r),f=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){c.style={...o,...l},Object.assign(c,f);let b=0,w=n.id;return typeof w=="string"&&(w=w.replace(/-/g,"_")),c.dangerouslySetInnerHTML={__html:Ml(el(u.body,w?()=>w+"ID"+b++:"iconifyReact"))},x.createElement("svg",c)}const{body:h,width:g,height:m}=e,v=i==="mask"||(i==="bg"?!1:h.indexOf("currentColor")!==-1),j=$l(h,{...f,width:g+"",height:m+""});return c.style={...o,"--svg":El(j),width:cs(f.width),height:cs(f.height),...Il,...v?sn:Js,...l},x.createElement("span",c)};Ys(!0);tl("",cl);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"||!Ui(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;nl(s,r)||console.error(a)}catch{console.error(a)}}}}function ea(e){const[n,s]=x.useState(!!e.ssr),[a,r]=x.useState({});function i(m){if(m){const v=e.icon;if(typeof v=="object")return{name:"",data:v};const j=ts(v);if(j)return{name:v,data:j}}return{name:""}}const[o,l]=x.useState(i(!!e.ssr));function c(){const m=a.callback;m&&(m(),r({}))}function u(m){if(JSON.stringify(o)!==JSON.stringify(m))return c(),l(m),!0}function f(){var m;const v=e.icon;if(typeof v=="object"){u({name:"",data:v});return}const j=ts(v);if(u({name:v,data:j}))if(j===void 0){const b=wl([v],f);r({callback:b})}else j&&((m=e.onLoad)===null||m===void 0||m.call(e,v))}x.useEffect(()=>(s(!0),c),[]),x.useEffect(()=>{n&&f()},[e.icon,n]);const{name:h,data:g}=o;return g?Pl({...pn,...g},e,h):e.children?e.children:e.fallback?e.fallback:x.createElement("span",{})}const V=x.forwardRef((e,n)=>ea({...e,_ref:n}));x.forwardRef((e,n)=>ea({inline:!0,...e,_ref:n}));const R=x.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(d.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));R.displayName="Button";function ta({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(d.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(d.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(R,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(V,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ot(e,n){return e-n*Math.floor(e/n)}const na=1721426;function pt(e,n,s,a){n=vn(e,n);let r=n-1,i=-2;return s<=2?i=0:vt(n)&&(i=-1),na-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 vn(e,n){return e==="BC"?1-n:n}function _l(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const Ol={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 Dt{fromJulianDay(n){let s=n,a=s-na,r=Math.floor(a/146097),i=Ot(a,146097),o=Math.floor(i/36524),l=Ot(i,36524),c=Math.floor(l/1461),u=Ot(l,1461),f=Math.floor(u/365),h=r*400+o*100+c*4+f+(o!==4&&f!==4?1:0),[g,m]=_l(h),v=s-pt(g,m,1,1),j=2;s<pt(g,m,3,1)?j=0:vt(m)&&(j=1);let b=Math.floor(((v+j)*12+373)/367),w=s-pt(g,m,b,1)+1;return new dt(g,m,b,w)}toJulianDay(n){return pt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return Ol[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 Rl(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 sa(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function aa(e,n){return ds(e)-ds(n)}function ds(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Rt=null;function ra(){return Rt==null&&(Rt=new Intl.DateTimeFormat().resolvedOptions().timeZone),Rt}function us(e){e=jn(e,new Dt);let n=vn(e.era,e.year);return ia(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ia(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 fs(e,n){if(n==="UTC")return 0;if(e>0&&n===ra())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:o,second:l}=la(e,n);return ia(s,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const ms=new Map;function la(e,n){let s=ms.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"}),ms.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 hs=864e5;function zl(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>Bl(e,n,i))}function Bl(e,n,s){let a=la(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 Vl(e,n,s="compatible"){let a=ca(e);if(n==="UTC")return us(a);if(n===ra()&&s==="compatible"){a=jn(a,new Dt);let c=new Date,u=vn(a.era,a.year);return c.setFullYear(u,a.month-1,a.day),c.setHours(a.hour,a.minute,a.second,a.millisecond),c.getTime()}let r=us(a),i=fs(r-hs,n),o=fs(r+hs,n),l=zl(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 oa(e,n,s="compatible"){return new Date(Vl(e,n,s))}function ca(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 wt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function jn(e,n){if(Rl(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 wn(e,n){let s=e.copy(),a="hour"in s?pa(s,n):0;an(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,rn(s),da(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,Ul(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 c=(i=(o=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,s);s.year=r,s.month=c?1:s.calendar.getMonthsInYear(s),s.day=c?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 an(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function rn(e){for(;e.month<1;)an(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,an(e,1)}function Ul(e){for(;e.day<1;)e.month--,rn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,rn(e)}function da(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)),da(e)}function ua(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function fa(e,n){return wn(e,ua(n))}function ma(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 ha(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),xa(s),s}function Hl(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=gt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=gt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=gt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=gt(e.hour,24),n}function xa(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function gt(e,n){let s=e%n;return s<0&&(s+=n),s}function pa(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,Hl(e)}function ga(e,n){let s=e.copy();return pa(s,n),s}function ql(e,n){return ga(e,ua(n))}function ba(e,n,s,a){let r=e.copy();switch(n){case"era":{let l=e.calendar.getEras(),c=l.indexOf(e.era);if(c<0)throw new Error("Invalid era: "+e.era);c=ze(c,s,0,l.length-1,a?.round),r.era=l[c],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=ze(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ze(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=ze(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function ya(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 c=i>=12;o=c?12:0,l=c?23:11}r.hour=ze(i,s,o,l,a?.round);break}case"minute":r.minute=ze(e.minute,s,0,59,a?.round);break;case"second":r.second=ze(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=ze(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function ze(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const Wl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Yl=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Kl(e){let n=e.match(Wl);if(!n)throw Yl.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(zt(n[1],0,9999),zt(n[2],1,12),1);return s.day=zt(n[3],1,s.calendar.getDaysInMonth(s)),s}function zt(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function va(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 ja(e){let n=jn(e,new Dt),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 Gl(e){return`${ja(e)}T${va(e)}`}function Ql(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Nn(e,n,s){Ql(e,n),n.set(e,s)}function wa(e){let n=typeof e[0]=="object"?e.shift():new Dt,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 Zl=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 wn(this,n)}subtract(n){return fa(this,n)}set(n){return ma(this,n)}cycle(n,s,a){return ba(this,n,s,a)}toDate(n){return oa(this,n)}toString(){return ja(this)}compare(n){return sa(this,n)}constructor(...n){Nn(this,Zl,{writable:!0,value:void 0});let[s,a,r,i,o]=wa(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=o,Je(this)}}var Xl=new WeakMap;class Et{copy(){return new Et(this.hour,this.minute,this.second,this.millisecond)}add(n){return ga(this,n)}subtract(n){return ql(this,n)}set(n){return ha(this,n)}cycle(n,s,a){return ya(this,n,s,a)}toString(){return va(this)}compare(n){return aa(this,n)}constructor(n=0,s=0,a=0,r=0){Nn(this,Xl,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,xa(this)}}var Jl=new WeakMap;class wt{copy(){return this.era?new wt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new wt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return wn(this,n)}subtract(n){return fa(this,n)}set(n){return ma(ha(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return ba(this,n,s,a);default:return ya(this,n,s,a)}}toDate(n,s){return oa(this,n,s)}toString(){return Gl(this)}compare(n){let s=sa(this,n);return s===0?aa(this,ca(n)):s}constructor(...n){Nn(this,Jl,{writable:!0,value:void 0});let[s,a,r,i,o]=wa(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 eo="Open time options",to=320;function xs(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Bt(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Et(n,s,a)}function no(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 Et(s,a));return n}function ao(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=eo,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:c,hourCycle:u=12,...f}=e,h=l!==void 0,[g,m]=x.useState(()=>Bt(c)),v=h?Bt(l):g,j=x.useMemo(()=>so(n),[n]),b=y=>{h||m(y),o?.(y)},w=t.jsxs(d.Popover,{placement:"bottom-end",children:[t.jsx(d.PopoverTrigger,{children:t.jsx(d.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(K.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(d.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(d.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:j.map(y=>{const S=v?.hour===y.hour&&v?.minute===y.minute;return t.jsx(d.Button,{variant:S?"flat":"light",color:S?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(y),children:no(y,u)},`${y.hour}:${y.minute}`)})})})})]});return t.jsx(d.TimeInput,{...f,value:h?v:void 0,defaultValue:h?void 0:c,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,w]}),onChange:y=>b(Bt(y))})}function Cn(e){if(e.mode==="time")return t.jsx(ao,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=to,disableAnimation:c=!0,classNames:u,...f}=e;return t.jsx(d.DatePicker,{...f,calendarWidth:l,classNames:{...u,popoverContent:xs("min-w-[20rem]",u?.popoverContent),calendarContent:xs("min-h-[18rem]",u?.calendarContent)},disableAnimation:c,granularity:i,hideTimeZone:o})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(d.DatePicker,{...a,granularity:s})}function ro(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Ie=x.forwardRef(({popoverProps:e,...n},s)=>{const a=x.useRef(null),[r,i]=x.useState(void 0),o={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return x.useEffect(()=>{i(ro(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(d.Select,{ref:s,...n,popoverProps:o})})});Ie.displayName="Select";function io({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:c="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,h]=x.useState(""),g=x.useId(),[m,v]=x.useState(e);e!==m&&(v(e),e==="applied"&&h(""));const j=()=>{const y=f.trim();y&&n(y)},b=y=>{y.key==="Enter"&&(y.preventDefault(),j())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(ta,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:c,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(d.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:f,onValueChange:h,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":w?g:void 0}),t.jsx(R,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:j,children:l})]}),w&&t.jsx("p",{id:g,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const lo={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function oo({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(Ie,{"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(K.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(d.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Ie,{"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(K.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(d.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function co({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(R,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(R,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(K.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function uo({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:c,labels:u={},className:f}){const h={...lo,...u};return t.jsxs("nav",{"data-testid":"navbar",className:d.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||n.length>0)&&t.jsx(oo,{languages:n,selectedLanguage:s,onLanguageChange:a,label:h.selectLanguage}),c&&t.jsx(co,{isLoggedIn:r,onLogin:i,onLogout:o,labels:h})]})]})}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(d.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Vt;const mo=typeof document<"u"?(Vt=x.useInsertionEffect)!==null&&Vt!==void 0?Vt:x.useLayoutEffect:()=>{};function kn(e,n,s){let[a,r]=x.useState(e||n),i=x.useRef(a),o=x.useRef(e!==void 0),l=e!==void 0;x.useEffect(()=>{let h=o.current;h!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let c=l?e:a;mo(()=>{i.current=c});let[,u]=x.useReducer(()=>({}),{}),f=x.useCallback((h,...g)=>{let m=typeof h=="function"?h(i.current):h;Object.is(i.current,m)||(i.current=m,r(m),u(),s?.(m,...g))},[s]);return[c,f]}function ho(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx($e.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 Sn=x.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:c=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:h,onStepChange:g,currentStep:m,hideProgressBars:v=!1,stepClassName:j,className:b,isDisabled:w=!1,...y},S)=>{const[N,k]=kn(m,a,g),E=x.useMemo(()=>{let M,L;const A=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":M="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":M="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":M="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":M="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":M="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":M="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:M="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return A.unshift(L),A.unshift(M),A},[e]);return t.jsxs("nav",{ref:S,"aria-label":"Progress",className:d.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...y,children:[c&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+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:d.cn("flex flex-row flex-nowrap gap-x-3",E,b),"data-testid":"stepper-list",children:Array.from({length:s})?.map((M,L)=>{const A=N===L?"active":N<L?"inactive":"complete",O=n==="activeLabel"&&A==="active"&&!!i?.[L],F=o&&A!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(d.Tooltip,{content:F?i?.[L]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":A==="active"?"step":void 0,className:d.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":O},{"cursor-not-allowed opacity-50":w},j),onClick:()=>!w&&k(L),disabled:w,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx($e.LazyMotion,{features:$e.domAnimation,children:t.jsx($e.m.div,{animate:A,className:"relative z-10",children:t.jsx($e.m.div,{animate:A,className:d.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)":O,"bg-(--complete-background-color)":A==="complete","shadow-lg":A==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:A==="complete"&&n==="default"?t.jsx(ho,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),O?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<s-1&&!v&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},children:t.jsx("div",{className:d.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":L<N})})})]},L)})}),c&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:h?h(N+1,s):`Step ${N+1} of ${s}`}):null]})});Sn.displayName="Stepper";function xo(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(d.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 we(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 $n(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 Na(e,n,s="en-US"){const a=$n(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function ln(e,n,s,a){return Na(e-n,s,a)}function po(){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 go=e=>{const n=x.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,o]=x.useState([]),[l,c]=x.useState([]),[u,f]=x.useState(null),[h,g]=x.useState(null),m=x.useMemo(()=>new Set(n),[n]),v=x.useMemo(()=>new Set(e),[e]),j=x.useMemo(()=>e.filter(F=>!m.has(F)),[e,m]),b=F=>{if(F.length===0)return;const $=Array.from(new Set([...n,...F]));s($)},w=F=>{if(F.length===0)return;const $=new Set(F);s(n.filter(I=>!$.has(I)))},y=()=>{i.length!==0&&(b(i),o([]))},S=()=>{l.length!==0&&(w(l),c([]))},N=()=>{j.length!==0&&(b(j),o([]))},k=()=>{n.length!==0&&(s([]),c([]))},E=(F,$,I)=>{const P=Math.min($,I),G=Math.max($,I);return F.slice(P,G+1)},M=(F,$,I)=>{if(I&&u!==null){o(E(j,u,$)),c([]),f($);return}const P=i.includes(F);o(P?i.filter(G=>G!==F):[...i,F]),c([]),f($)},L=(F,$,I)=>{if(I&&h!==null){c(E(n,h,$)),o([]),g($);return}const P=l.includes(F);c(P?l.filter(G=>G!==F):[...l,F]),o([]),g($)},A=(F,$,I)=>{const P=I==="available"?i.includes($)?i:[$]:l.includes($)?l:[$];F.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:P})),F.dataTransfer.effectAllowed="move"},O=(F,$)=>{F.preventDefault();const I=F.dataTransfer.getData("text/plain");if(I)try{const P=JSON.parse(I),G=(P.items||[]).filter(q=>v.has(q));if(G.length===0||P.source===$)return;$==="selected"?(b(G),o([])):(w(G),c([]))}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(d.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"available"),children:j.map((F,$)=>{const I=i.includes(F);return t.jsx("button",{type:"button",onClick:P=>{M(F,$,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>A(P,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(R,{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:y,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:S,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(R,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:N,isDisabled:j.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(R,{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(d.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(d.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>O(F,"selected"),children:n.map((F,$)=>{const I=l.includes(F);return t.jsx("button",{type:"button",onClick:P=>{L(F,$,P.shiftKey)},onMouseDown:P=>{P.shiftKey&&P.preventDefault()},draggable:!0,onDragStart:P=>A(P,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(d.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 c=i?`${n} (${i})`:n;return t.jsx(d.Tooltip,{content:c,placement:"top",offset:10,children:t.jsx(R,{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 Le={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"}},yo={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function vo({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=x.useState(0);x.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),c=Le.heading;c&&c.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(d.DropdownTrigger,{children:t.jsx(R,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(K.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(d.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(o=>t.jsx(d.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(K.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:yo[o]},o))})]})}const Ut={bulletList:{label:"Bullet List",icon:K.List},orderedList:{label:"Numbered List",icon:K.ListOrdered},taskList:{label:"Task List",icon:K.ListTodo}};function jo({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const l=()=>a(c=>c+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?Ut[r].icon:K.List,o=l=>{const u=Le[l];u&&u.execute({editor:e})};return t.jsxs(d.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(d.DropdownTrigger,{children:t.jsx(R,{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(d.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:n.map(l=>{const c=Ut[l].icon;return t.jsx(d.DropdownItem,{startContent:t.jsx(c,{size:16}),children:Ut[l].label},l)})})]})}function wo({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:a},"aria-label":`Select color ${a}`,title:a},a)})})}const uo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],fo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Ut(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const pe={min:50,max:200,step:10,default:100},cs={lineHeight:24,toolbarHeight:60},mo={bold:G.Bold,italic:G.Italic,strike:G.Strikethrough,underline:G.Underline,code:G.Code,textColor:G.Palette,highlight:G.Highlighter,link:G.Link2,paragraph:G.FileText,heading:G.Heading,bulletList:G.List,orderedList:G.ListOrdered,taskList:G.ListTodo,codeBlock:G.CodeSquare,blockquote:G.Quote,horizontalRule:G.Minus,clearMarks:G.Eraser,clearNodes:G.Eraser,undo:G.Undo2,redo:G.Redo2,hardBreak:G.CornerDownLeft,textAlign:G.AlignLeft},ho={left:G.AlignLeft,center:G.AlignCenter,right:G.AlignRight,justify:G.AlignJustify};function Qe(e){return mo[e]}function xo({value:e,onChange:t,onApply:n,placeholder:r="#000000"}){const[a,i]=p.useState(""),l=u=>{const f=u.target.value;t(f),a&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!Ut(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),n(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:r,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!a,errorMessage:a,startContent:s.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Ut(e)?e:"transparent"}})}),s.jsx(U,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!Ut(e),children:s.jsx(G.Check,{size:16})})]}),s.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function ds({editor:e,type:t,allowCustomColor:n=!0,label:r,isDisabled:a=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=t==="textColor"?uo:fo,f=v=>{const b=Ie[t];b&&b.execute({editor:e,config:{type:t,color:v}}),l(!1),d("")},m=v=>{f(v)},g=()=>{const v=Ie[t];v&&v.execute({editor:e,config:{type:t,color:""}}),l(!1)},h=t==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),N=t==="textColor"?G.Palette:G.Highlighter;return s.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[s.jsx(c.PopoverTrigger,{children:s.jsx(U,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:a,"aria-label":r,children:s.jsx(N,{size:16})})}),s.jsx(c.PopoverContent,{className:"w-64",children:s.jsxs("div",{className:"px-2 py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-semibold",children:r}),s.jsx(U,{size:"sm",variant:"light",isIconOnly:!0,onPress:g,"aria-label":"Clear color",children:s.jsx(G.X,{size:16})})]}),s.jsx(co,{colors:u,onColorSelect:f}),n&&s.jsxs(s.Fragment,{children:[s.jsx(c.Divider,{}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),s.jsx(xo,{value:o,onChange:d,onApply:m})]})]})]})})]})}function po({zoom:e,onZoomChange:t,min:n=pe.min,max:r=pe.max,step:a=pe.step}){const i=()=>{const m=Math.max(n,e-a);t(m)},l=()=>{const m=Math.min(r,e+a);t(m)},o=()=>{t(pe.default)},d=e<=n,u=e>=r,f=e===pe.default;return s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:s.jsx(U,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:s.jsx(G.ZoomOut,{size:16})})}),s.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:s.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const No=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Co=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Ht(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const pe={min:50,max:200,step:10,default:100},ps={lineHeight:24,toolbarHeight:60},ko={bold:K.Bold,italic:K.Italic,strike:K.Strikethrough,underline:K.Underline,code:K.Code,textColor:K.Palette,highlight:K.Highlighter,link:K.Link2,paragraph:K.FileText,heading:K.Heading,bulletList:K.List,orderedList:K.ListOrdered,taskList:K.ListTodo,codeBlock:K.CodeSquare,blockquote:K.Quote,horizontalRule:K.Minus,clearMarks:K.Eraser,clearNodes:K.Eraser,undo:K.Undo2,redo:K.Redo2,hardBreak:K.CornerDownLeft,textAlign:K.AlignLeft},So={left:K.AlignLeft,center:K.AlignCenter,right:K.AlignRight,justify:K.AlignJustify};function Qe(e){return ko[e]}function $o({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=x.useState(""),o=u=>{const f=u.target.value;n(f),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Ht(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},c=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(d.Input,{type:"text",value:e,onChange:o,onKeyDown:c,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Ht(e)?e:"transparent"}})}),t.jsx(R,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Ht(e),children:t.jsx(K.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function gs({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,o]=x.useState(!1),[l,c]=x.useState(""),u=n==="textColor"?No:Co,f=j=>{const b=Le[n];b&&b.execute({editor:e,config:{type:n,color:j}}),o(!1),c("")},h=j=>{f(j)},g=()=>{const j=Le[n];j&&j.execute({editor:e,config:{type:n,color:""}}),o(!1)},m=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),v=n==="textColor"?K.Palette:K.Highlighter;return t.jsxs(d.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(d.PopoverTrigger,{children:t.jsx(R,{size:"sm",radius:"sm",variant:m?"solid":"bordered",color:m?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(v,{size:16})})}),t.jsx(d.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(R,{size:"sm",variant:"light",isIconOnly:!0,onPress:g,"aria-label":"Clear color",children:t.jsx(K.X,{size:16})})]}),t.jsx(wo,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(d.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx($o,{value:l,onChange:c,onApply:h})]})]})]})})]})}function Ao({zoom:e,onZoomChange:n,min:s=pe.min,max:a=pe.max,step:r=pe.step}){const i=()=>{const h=Math.max(s,e-r);n(h)},o=()=>{const h=Math.min(a,e+r);n(h)},l=()=>{n(pe.default)},c=e<=s,u=e>=a,f=e===pe.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(d.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(R,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:c,onPress:i,"aria-label":"Zoom out",children:t.jsx(K.ZoomOut,{size:16})})}),t.jsx(d.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:f,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
15
  ${f?"cursor-default":"cursor-pointer hover:text-primary"}
16
- `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),s.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:s.jsx(U,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:s.jsx(G.ZoomIn,{size:16})})})]})}function go({editor:e,isDisabled:t=!1}){const[n,r]=p.useState(!1),[a,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=h=>{if(h){const{from:N,to:v}=e.state.selection,b=e.isActive("link");let j="";if(b){const S=e.schema.marks.link,w=e.state.doc.resolve(N),k=Hn.getMarkRange(w,S);k&&(j=e.state.doc.textBetween(k.from,k.to,""))}else j=e.state.doc.textBetween(N,v,"");const y=e.getAttributes("link").href||"";i(j),o(y),u(b)}r(h)},g=()=>{if(l.trim()){const{from:h,to:N}=e.state.selection,v=e.schema.marks.link,b=e.state.doc.resolve(h),j=Hn.getMarkRange(b,v),y=j?.from??h,S=j?.to??N,w=e.state.doc.textBetween(y,S,"");a.trim()&&a!==w?e.chain().focus().setTextSelection({from:y,to:S}).deleteSelection().insertContent(`<a href="${l.trim()}">${a.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}r(!1)};return s.jsxs(c.Popover,{isOpen:n,onOpenChange:m,placement:"bottom",children:[s.jsx(c.PopoverTrigger,{children:s.jsx(U,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:t,"aria-label":"Link",children:s.jsx(G.Link,{size:16})})}),s.jsx(c.PopoverContent,{children:s.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[s.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:a,onChange:h=>i(h.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),s.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:h=>o(h.target.value),onKeyDown:h=>h.key==="Enter"&&g(),classNames:{inputWrapper:"focus-within:border-default-400"}}),s.jsx(U,{size:"sm",color:"primary",onPress:g,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function bo({children:e,id:t,label:n,className:r,useButtonGroup:a=!0}){return a?s.jsx(c.ButtonGroup,{size:"sm",id:t,"aria-label":n,className:r,children:e}):s.jsx("div",{id:t,role:"group","aria-label":n,className:`flex items-center gap-2 ${r||""}`,children:e})}function gr(e,t){const n=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(t.map(o=>ut(o)))).forEach(o=>{const d=Ie[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,t]),[r,a]=p.useState(n);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(t.map(d=>ut(d)))).forEach(d=>{const u=Ie[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),a(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,t,n]),r}function br(e,t){const n=p.useCallback((l,o)=>{if(!e)return;const d=Ie[l];if(d)try{d.execute({editor:e,config:o}),t?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,t]),r=p.useCallback(l=>{n(l)},[n]),a=p.useCallback((l,o)=>{if(!e)return!1;const d=Ie[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=Ie[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:n,toggleModifier:r,canExecute:a,isActive:i}}function yo(e=pe.default){const[t,n]=p.useState(e),r=p.useCallback((o=pe.step)=>{n(d=>Math.min(pe.max,d+o))},[]),a=p.useCallback((o=pe.step)=>{n(d=>Math.max(pe.min,d-o))},[]),i=p.useCallback(()=>{n(pe.default)},[]),l=p.useCallback(o=>{const d=Math.max(pe.min,Math.min(pe.max,o));n(d)},[]);return{zoom:t,setZoom:l,zoomIn:r,zoomOut:a,resetZoom:i,isMinZoom:t<=pe.min,isMaxZoom:t>=pe.max,isDefaultZoom:t===pe.default}}const vo=["bold","italic","strike","underline","code"];function jo({editor:e,modifiers:t,onToolbarAction:n}){const r=gr(e,t),{toggleModifier:a}=br(e,n);if(!e)return null;const i=t.map(l=>ut(l)).filter(l=>vo.includes(l));return i.length===0?null:s.jsx(bo,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=r[l],d=Qe(l);return s.jsx(qe,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>a(l)},l)})})}function wo({editor:e,modifiers:t,zoom:n=100,onZoomChange:r,sticky:a=!0,className:i,onToolbarAction:l}){const o=gr(e,t),{toggleModifier:d,executeCommand:u}=br(e,l);if(!e)return null;const f=t.map(I=>ut(I)),m=f.some(I=>["bold","italic","strike","underline","code"].includes(I)),g=f.some(I=>["textColor","highlight"].includes(I)),h=f.includes("heading"),N=f.includes("textAlign"),v=f.some(I=>["bulletList","orderedList","taskList"].includes(I)),b=f.includes("blockquote"),j=f.includes("codeBlock"),y=f.includes("link"),S=f.includes("horizontalRule"),w=f.some(I=>["undo","redo"].includes(I)),k=n!==void 0&&r!==void 0,E=a?"sticky top-0 z-10":"";return s.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${i||""}`,children:s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&s.jsxs(s.Fragment,{children:[s.jsx(jo,{editor:e,modifiers:t,onToolbarAction:l}),(g||h||N||v||b||j||y||S||w||k)&&s.jsx(He,{})]}),g&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&s.jsx(ds,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&s.jsx(ds,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(h||N||v||b||j||y||S||w||k)&&s.jsx(He,{})]}),h&&s.jsxs(s.Fragment,{children:[s.jsx(lo,{editor:e}),(N||v||b||j||y||S||w||k)&&s.jsx(He,{})]}),N&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(I=>{const M=ho[I],$=e.isActive({textAlign:I});return s.jsx(qe,{icon:M,label:`Align ${I}`,isActive:$,onClick:()=>u("textAlign",{type:"textAlign",alignment:I})},I)})}),(v||b||j||y||S||w||k)&&s.jsx(He,{})]}),v&&s.jsxs(s.Fragment,{children:[s.jsx(oo,{editor:e,types:f.filter(I=>["bulletList","orderedList","taskList"].includes(I))}),(b||j||y||S||w||k)&&s.jsx(He,{})]}),(b||j||y||S)&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[b&&s.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),j&&s.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),y&&s.jsx(go,{editor:e,isDisabled:o.link?.isDisabled}),S&&s.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||k)&&s.jsx(He,{})]}),w&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&s.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&s.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),k&&s.jsx(He,{})]}),k&&s.jsx(po,{zoom:n,onZoomChange:I=>{r?.(I),l?.({type:"zoom",modifier:`${I}%`})}})]})})}const st={bold:{category:"mark",extension:Ka.Bold,priority:100},italic:{category:"mark",extension:Qa.Italic,priority:100},strike:{category:"mark",extension:Za.Strike,priority:100},underline:{category:"mark",extension:Xa.Underline,priority:100},code:{category:"mark",extension:Ja.Code,priority:100},textColor:{category:"mark",extension:ei.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:ti.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:ni.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:ii.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:li.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:oi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:ui.CodeBlock,priority:100},blockquote:{category:"node",extension:fi.Blockquote,priority:100},horizontalRule:{category:"node",extension:mi.HorizontalRule,priority:100},hardBreak:{category:"node",extension:hi.HardBreak,priority:100},undo:{category:"extension",extension:qn.History,priority:50},redo:{category:"extension",extension:qn.History,priority:50},textAlign:{category:"extension",extension:xi.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}},No=[pi.Document,gi.Text,ai.Paragraph,si.TextStyle.configure({HTMLAttributes:{}}),di.ListItem.configure({HTMLAttributes:{}}),ci.TaskItem.configure({nested:!0}),bi.Dropcursor,yi.Gapcursor];function Co(e){const t=[],n=new Set,r=new Set;No.forEach(o=>{o&&(t.push(o),r.add(o.name))});const a=e.map(o=>ut(o)),i=new Set;return a.forEach(o=>{const d=st[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(n.has(o))return;const d=st[o];if(!d||d.extension===null)return;const u=d.extension.name;if(r.has(u)){n.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;t.push(f),n.add(o),r.add(u)}),a.forEach(o=>{if(n.has(o))return;const d=st[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){n.add(o);return}const u=d.extension.name;if(r.has(u)){n.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;t.push(f),n.add(o),r.add(u)}),t.sort((o,d)=>{const u=Object.values(st).find(h=>h?.extension?.name===o.name),f=Object.values(st).find(h=>h?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const yr={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"]},ko={h1:`font-size: ${ce.fontSize["4xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${ce.fontSize["2xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${ce.fontSize.xl}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${ce.fontSize.lg}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${ce.fontSize.base}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${ce.fontSize.sm}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${ce.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,li:`display: list-item; margin: ${le.xs} 0;`,strong:`font-weight: ${ce.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ce.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ce.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${le.sm}; color: ${ge.neutral.gray[100]}; font-family: ${ce.fontFamily.mono}; margin: ${le.lg} 0; padding: 0.75rem ${le.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${le.lg} 0; padding-left: ${le.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${le.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.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;"},So={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 Ao(e){if(!e)return e;let t=e;for(const[n,r]of Object.entries(So)){const a=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");t=t.replace(a,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${r}"`):`${l} style="${r}">`)}for(const[n,r]of Object.entries(ko)){const a=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");t=t.replace(a,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${r}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${r}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${r}"${i.slice(l)}`}})}return t}const $o=({modifiers:e,zoom:t,onZoomChange:n,onToolbarAction:r})=>{const{editor:a}=mn.useCurrentEditor();return s.jsx(wo,{editor:a,modifiers:e,zoom:t,onZoomChange:n,onToolbarAction:r})},Do=({showCharacterCount:e,showWordCount:t})=>{const{editor:n}=mn.useCurrentEditor();if(!n||!e&&!t)return null;const r=n.getText(),a=r.length,i=r.split(/\s+/).filter(l=>l.length>0).length;return s.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&s.jsxs("span",{children:[a," characters"]}),t&&s.jsxs("span",{children:[i," words"]})]})},ln=p.forwardRef((e,t)=>{const{minRows:n=10,maxRows:r=30,disableAutosize:a=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=yr.full,variant:u="bordered",initialContent:f,content:m,onContentChange:g,onUpdate:h,onToolbarAction:N,isReadOnly:v=!1,isDisabled:b=!1,includeInlineStyles:j=!0,...y}=e,{zoom:S,setZoom:w}=yo(),k=cs.lineHeight,E=n*k,I=a?void 0:r*k,M=p.useMemo(()=>Co(d),[d]),{Component:$,label:_,shouldLabelBeOutside:F,getBaseProps:A,getLabelProps:T,getInputWrapperProps:P}=c.useInput({...y,variant:u,ref:t,isMultiline:!0}),K=_?s.jsx("label",{...T(),children:_}):null,q=p.useCallback(({editor:W})=>{const ee=W.getHTML(),re=j?Ao(ee):ee,ae=W.getJSON(),B=W.getText(),Z=B.length,Q=B.split(/\s+/).filter(X=>X.length>0).length,H={html:re,json:ae,text:B,characters:Z,words:Q};if(g?.(H),h?.(H),"onChange"in y&&typeof y.onChange=="function"){const X={target:{value:re},currentTarget:{value:re}};y.onChange(X)}},[g,h,y,j]);return s.jsxs($,{...A(),children:[F?K:null,s.jsx("div",{...P(),className:c.cn(P().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:I?`${I+cs.toolbarHeight}px`:void 0,overflow:I?"auto":void 0},children:s.jsx(mn.EditorProvider,{editable:!v&&!b,slotBefore:o?s.jsx($o,{modifiers:d,zoom:S,onZoomChange:w,onToolbarAction:N}):void 0,slotAfter:s.jsx(Do,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:M,content:m||f||e.defaultValue||"",onUpdate:q})})]})});ln.displayName="TipTapEditor";const vr=p.forwardRef((e,t)=>{const{adapter:n="tiptap",variant:r="bordered",...a}=e;return n==="tiptap"?s.jsx(ln,{...a,variant:r,ref:t}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),s.jsx(ln,{...a,variant:r,ref:t}))});vr.displayName="RichTextArea";function Eo(e,t="en-US",n="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}const us=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Fo={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},jr=({presetAmounts:e=us,selectedDonation:t,defaultSelectedDonation:n=null,onChange:r,onAddDonation:a,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:g=3,isDisabled:h=!1,buttonVariant:N="bordered",buttonColor:v="default",inputVariant:b="bordered",size:j="md",className:y="",showCard:S=!0})=>{const w={...Fo,...f},k=Array.isArray(e)?e:us,E={2:"grid-cols-2",3:"grid-cols-3"},I={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},M=`${E[m]} ${I[g]}`,[$,_]=Cn(t,n,r),[F,A]=p.useState(""),[T,P]=p.useState(!1),[K,q]=p.useState(0),W=p.useCallback(Z=>{if(h)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};_(Q),A(""),P(!1),q(H=>H+1),a?.(Q)},[h,_,a]),ee=p.useCallback(Z=>{if(h)return;if(A(Z!==void 0?String(Z):""),a){_(null);return}if(Z===void 0||isNaN(Z)){_(null);return}_({amount:Z,isCustom:!0})},[h,_,a]),re=p.useCallback(()=>{if(h)return;const Z=F!==""?parseFloat(F):void 0;Z===void 0||isNaN(Z)||a?.({amount:Z,isCustom:!0})},[h,F,a]),ae=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),B=s.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&s.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),k.length>0&&s.jsx("div",{className:c.cn("grid gap-3",M),"data-testid":"donation-amounts-presets",children:k.map(Z=>{const Q=$!==null&&!$.isCustom&&$.presetId===Z.id;return s.jsx(U,{color:Q?"primary":v,variant:Q?"solid":N,className:"w-full",onPress:()=>W(Z),isDisabled:h,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Eo(Z.amount,l,i)},Z.id)})}),o&&s.jsxs("div",{className:"flex gap-3 items-start",children:[s.jsx(c.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,onInput:a?()=>{_(null),P(!0)}:void 0,variant:b,radius:"full",size:j,minValue:d,maxValue:u,step:.01,formatOptions:ae,value:F!==""?parseFloat(F):void 0,onValueChange:ee,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},a?`custom-${K}`:$?.isCustom===!1?$.presetId:"custom"),a&&s.jsx(U,{color:"primary",variant:"solid",radius:"full",size:j,className:"shrink-0",onPress:re,isDisabled:h||!T,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]})]});return S?s.jsx(c.Card,{className:c.cn("w-full",y),"data-testid":"donation-amounts-card",children:s.jsx(c.CardBody,{children:B})}):s.jsx("div",{className:c.cn("w-full",y),"data-testid":"donation-amounts-plain",children:B})};jr.displayName="DonationAmounts";const Io=e=>{const t=Math.max(0,e),n=Math.floor(t/60).toString().padStart(2,"0"),r=(t%60).toString().padStart(2,"0");return`${n}:${r} minutes`},Mo=e=>{switch(e){case"warning":return G.Clock;case"error":return G.AlertCircle;case"success":return G.CheckCircle;default:return G.Clock}},To=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"}},wr=p.forwardRef(({timeLeft:e,defaultTimeLeft:t=1200,onTimeChange:n,onExpire:r,variant:a="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=Io,className:g,...h},N)=>{const[v,b]=Cn(e!==void 0?Math.max(0,e):void 0,Math.max(0,t),n),j=p.useRef(null),y=p.useRef(!1);p.useEffect(()=>()=>{j.current&&clearInterval(j.current)},[]),p.useEffect(()=>{if(!f||v<=0){j.current&&(clearInterval(j.current),j.current=null);return}return j.current=setInterval(()=>{b(E=>E<=1?(j.current&&(clearInterval(j.current),j.current=null),y.current||(y.current=!0,r?.()),0):E-1)},1e3),()=>{j.current&&(clearInterval(j.current),j.current=null)}},[f,v,b,r]),p.useEffect(()=>{v>0&&(y.current=!1)},[v]);const S=d||Mo(a),w=To(i),k={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return s.jsx("div",{ref:N,role:"banner","aria-live":"polite","aria-label":`${l} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,k[u],g),...h,children:s.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[s.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&&s.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:s.jsx(S,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),s.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:l})]}),s.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:s.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});wr.displayName="ExpireCartTimer";const Ht=({icon:e,children:t,testId:n})=>s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[s.jsx(V,{icon:e,width:20,className:"text-default-500"}),s.jsx("span",{children:t})]}),Lo=({classes:e="",name:t,imageUrl:n,eventDate:r,eventTime:a,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[g,h]=p.useState(!1),[N,v]=p.useState(!1),b=p.useRef(null);return p.useEffect(()=>{const j=()=>{if(b.current){const y=b.current.scrollHeight>b.current.clientHeight;v(y)}};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[l]),s.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[s.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&&n&&s.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:s.jsx(c.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${t}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),s.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:t})]}),s.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[s.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),s.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[r&&s.jsx(Ht,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:r}),a&&s.jsx(Ht,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:a}),i&&s.jsx(Ht,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&s.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{ref:b,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!g&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!g&&N&&s.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"})]}),(N||g)&&s.jsx("div",{className:"flex justify-end mt-1",children:s.jsx(U,{onPress:()=>h(!g),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:s.jsx(V,{icon:g?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:g?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function on(e,t="en-US",n="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function Po(e){const t=e.replace(/[^\d.,-]/g,""),n=t.match(/,\d{1,2}$/);let r;n?r=t.replace(/\./g,"").replace(",","."):r=t.replace(/,/g,"");const a=parseFloat(r);return isNaN(a)?null:a}const Oo={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},Ge=e=>typeof e=="number"&&!isNaN(e),wt=({offer:e,quantity:t,defaultQuantity:n=0,onQuantityChange:r,currency:a="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:g=!0,showPeopleCount:h=!0,showPrice:N=!0,priceDisplay:v,classNames:b={},"data-testid":j,selectedColor:y="default",compact:S=!1,isSoldOut:w,isMaxReached:k,isRuleBlocked:E,statusTone:I="default",statusLabel:M,disabledReason:$,disabled:_})=>{const F=p.useMemo(()=>({...Oo,...l}),[l]),[A,T]=p.useState(n),P=t!==void 0?t:A,K=!!(d||_),q=S||!!e.compact,W=p.useMemo(()=>typeof w=="boolean"?w:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ge(e.totalTicketsSold)||!Ge(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[w,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),ee=p.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!Ge(e.ticketsAllowed)?!1:P>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,P]),re=p.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),ae=$||e.disabledReason,B=K||W||re,Z=te=>{if(B||te>0&&ee)return;const me=Math.max(0,P+te);t===void 0&&T(me),r?.(e.id,me)},Q=p.useMemo(()=>{if(W)return"soldOut";if(re)return"ruleBlocked";if(K)return"disabled"},[W,re,K]),H=p.useMemo(()=>I||(W||re?"danger":ee?"warning":"default"),[I,W,re,ee]),X=p.useMemo(()=>{if(Q)return Q==="ruleBlocked"?M||ae||F.ruleBlocked:Q==="soldOut"?M||ae||F.soldOut:Q==="disabled"?M||ae||F.disabled:M||F.maxReached},[Q,M,ae,F]),J={soldOut:"danger",ruleBlocked:H,disabled:"default",maxReached:"warning"},Ne={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},be=()=>o?.renderName?o.renderName(e.name,e):s.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",q&&"text-sm",b.name),children:e.name}),he=()=>{if(!N)return null;const te=v?.price??e.price,me=v?.originalPrice,Ee=on(te,i,a);if(o?.renderPrice)return o.renderPrice(te,Ee,e);if(Ge(me)&&Ge(te)&&me>te){const xe=on(me,i,a);return s.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",q&&"mt-0.5",b.price),children:[s.jsxs("span",{className:"sr-only",children:["Original price ",xe,", discounted price ",Ee]}),s.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",q&&"text-xs",b.originalPrice),children:xe}),s.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",q&&"text-sm",b.discountedPrice),children:Ee})]})}return s.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",q&&"text-sm mt-0.5",b.price),children:Ee})},Be=()=>!g||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):s.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",q&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Me=()=>{if(!h||!Ge(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?F.person:F.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,te,e):s.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",q&&"mt-1 text-xs",b.peopleCount),children:[s.jsx(V,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Te=()=>{const te=P===0||B,me=ee||B;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:P,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:me,isDisabled:B}):s.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[s.jsx(U,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Decrease quantity",children:s.jsx(V,{icon:"gravity-ui:minus",width:16})}),s.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",q&&"text-sm"),children:P}),s.jsx(U,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:me,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Increase quantity",children:s.jsx(V,{icon:"gravity-ui:plus",width:16})})]})},Le=(te,me)=>o?.renderDisabledState?o.renderDisabledState(te,me):te==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(me):te==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(me):s.jsx(c.Chip,{"data-testid":Ne[te],color:J[te],variant:te==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&b.soldOut,te==="maxReached"&&b.maxReachedAlert,q&&"h-8"),startContent:s.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:s.jsx("span",{className:"font-medium text-sm",children:me})}),Ve=s.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",q?"gap-1":"gap-2"),children:[s.jsxs("div",{className:c.cn("h-full col-span-2",B||ee?"opacity-50 pointer-events-none select-none":""),children:[be(),he(),s.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",q?"mb-1":"mb-2"),children:[Me(),Be()]})]}),s.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",q&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:Q&&X?Le(Q,X):Te()})]}),De=ee&&!W&&!re&&!K?s.jsx(Se.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:Le("maxReached",X||F.maxReached)}):null;return m?s.jsxs(c.Card,{className:c.cn("w-full",q&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,children:[s.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),s.jsx(Se.AnimatePresence,{children:De&&s.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:De})})]}):s.jsxs("div",{className:c.cn("w-full",q&&b.compact,b.base),"data-testid":j||`offer-card-${e.id}`,children:[s.jsx("div",{className:c.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),s.jsx(Se.AnimatePresence,{children:De&&s.jsx("div",{className:c.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:De})})]})};wt.displayName="OfferCard";const Nr=({message:e="No offers available.",icon:t="solar:ticket-sale-outline",iconSize:n=48,showCard:r=!0,classNames:a={},renderEmpty:i})=>{if(i){const o=i();return r?s.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",a.base),children:s.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):s.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",a.base),children:o})}const l=s.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",a.content),children:[s.jsx(V,{"data-testid":"offer-card-empty-icon",icon:t,width:n,className:c.cn("mb-4",a.icon)}),s.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",a.message),children:e})]});return r?s.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",a.base),children:s.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):s.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",a.base),children:l})};Nr.displayName="OfferCardEmpty";const _o={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Cr=({error:e,labels:t,showCard:n=!0,color:r="danger",classNames:a={}})=>{const i={..._o,...t},l=s.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:r,title:i.title,description:e||i.description,className:a.alert});return n?s.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",a.base),children:s.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):s.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",a.base),children:l})};Cr.displayName="OfferCardError";const zo={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},kr=({quantity:e=2,gap:t=4,classNames:n={}})=>{const r=zo[t];return s.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(r,n.base),children:Array.from({length:e}).map((a,i)=>s.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.card),children:[s.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:s.jsxs("div",{className:"space-y-2 w-full",children:[s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:s.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:s.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),s.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[s.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:s.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:s.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),s.jsx("div",{className:"flex items-start justify-end",children:s.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),s.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};kr.displayName="OfferCardSkeleton";const Sr={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ar={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"}}},Ro={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},$r=({offers:e=[],mapOffer:t,selection:n,defaultSelection:r={},onSelectionChange:a,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:g="default",showCard:h=!0,animated:N=!0,gap:v=2,compact:b=!1,classNames:j={}})=>{const[y,S]=p.useState(r),w=n!==void 0?n:y,k=p.useCallback((F,A)=>{const T={...w,[F]:Math.max(0,A)};n===void 0&&S(T),a?.(T),i?.(F,T[F])},[w,n,a,i]),E=[...e].sort((F,A)=>(F.position??0)-(A.position??0)),I=F=>{const A=t?t(F):F,T=(w??{})[A.id]||0;return{offer:A,quantity:T,onQuantityChange:k,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:g,showCard:h,compact:b}},M=Ro[v],$=c.cn("grid mx-auto pt-2",M,j.base),_=F=>{const A=I(F);return s.jsx(wt,{offer:A.offer,quantity:A.quantity,onQuantityChange:A.onQuantityChange,currency:A.currency,locale:A.locale,labels:A.labels,slots:A.slots,isDisabled:A.isDisabled,buttonVariant:A.buttonVariant,buttonColor:A.buttonColor,showCard:A.showCard,compact:A.compact,classNames:j.card},A.offer.id)};return N?s.jsx(Se.motion.div,{"data-testid":"offer-card-list",className:$,variants:Sr,initial:"hidden",animate:"show",children:s.jsx(Se.AnimatePresence,{children:E.map(F=>{const A=I(F);return s.jsx(Se.motion.div,{"data-testid":`offer-card-list-item-${A.offer.id}`,className:j.cardWrapper,variants:Ar,exit:{opacity:0,y:-20},transition:{duration:.3},children:s.jsx(wt,{offer:A.offer,quantity:A.quantity,onQuantityChange:k,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:g,showCard:h,compact:b||A.offer.compact,classNames:j.card})},A.offer.id)})})}):s.jsx("div",{"data-testid":"offer-card-list",className:$,children:E.map(_)})};$r.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,we=e=>e==null;const Dr=e=>typeof e=="object";var fe=e=>!we(e)&&!Array.isArray(e)&&Dr(e)&&!We(e),Er=e=>fe(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,Bo=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Fr=(e,t)=>e.has(Bo(t)),Vo=e=>{const t=e.constructor&&e.constructor.prototype;return fe(t)&&t.hasOwnProperty("isPrototypeOf")},Sn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function de(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Sn&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(fe(e)&&Vo(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=de(e[a]));return r}var Et=e=>/^\w*$/.test(e),oe=e=>e===void 0,An=e=>Array.isArray(e)?e.filter(Boolean):[],$n=e=>An(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,t,n)=>{if(!t||!fe(e))return n;const r=(Et(t)?[t]:$n(t)).reduce((a,i)=>we(a)?a:a[i],e);return oe(r)||r===e?oe(e[t])?n:e[t]:r},Ce=e=>typeof e=="boolean",je=e=>typeof e=="function",ie=(e,t,n)=>{let r=-1;const a=Et(t)?[t]:$n(t),i=a.length,l=i-1;for(;++r<i;){const o=a[r];let d=n;if(r!==l){const u=e[o];d=fe(u)||Array.isArray(u)?u:isNaN(+a[r+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const Nt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ae={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Fe={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ir=p.createContext(null);Ir.displayName="HookFormControlContext";const Dn=()=>p.useContext(Ir);var Mr=(e,t,n,r=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const l=i;return t._proxyFormState[l]!==Ae.all&&(t._proxyFormState[l]=!r||Ae.all),n&&(n[l]=!0),e[l]}});return a};const En=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Uo(e){const t=Dn(),{control:n=t,disabled:r,name:a,exact:i}=e||{},[l,o]=p.useState(n._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return En(()=>n._subscribe({name:a,formState:d.current,exact:i,callback:u=>{!r&&o({...n._formState,...u})}}),[a,r,i]),p.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),p.useMemo(()=>Mr(l,n,d.current,!1),[l,n])}var ke=e=>typeof e=="string",cn=(e,t,n,r,a)=>ke(e)?(r&&t.watch.add(e),z(n,e,a)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),z(n,i))):(r&&(t.watchAll=!0),n),dn=e=>we(e)||!Dr(e);function $e(e,t,n=new WeakSet){if(dn(e)||dn(t))return Object.is(e,t);if(We(e)&&We(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const l=e[i];if(!a.includes(i))return!1;if(i!=="ref"){const o=t[i];if(We(l)&&We(o)||fe(l)&&fe(o)||Array.isArray(l)&&Array.isArray(o)?!$e(l,o,n):!Object.is(l,o))return!1}}return!0}function Ho(e){const t=Dn(),{control:n=t,name:r,defaultValue:a,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(a),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(n),g=p.useRef(r);u.current=o;const[h,N]=p.useState(()=>{const w=n._getWatch(r,d.current);return u.current?u.current(w):w}),v=p.useCallback(w=>{const k=cn(r,n._names,w||n._formValues,!1,d.current);return u.current?u.current(k):k},[n._formValues,n._names,r]),b=p.useCallback(w=>{if(!i){const k=cn(r,n._names,w||n._formValues,!1,d.current);if(u.current){const E=u.current(k);$e(E,f.current)||(N(E),f.current=E)}else N(k)}},[n._formValues,n._names,i,r]);En(()=>((m.current!==n||!$e(g.current,r))&&(m.current=n,g.current=r,b()),n._subscribe({name:r,formState:{values:!0},exact:l,callback:w=>{b(w.values)}})),[n,l,r,b]),p.useEffect(()=>n._removeUnmounted());const j=m.current!==n,y=g.current,S=p.useMemo(()=>{if(i)return null;const w=!j&&!$e(y,r);return j||w?v():null},[i,j,r,y,v]);return S!==null?S:h}function qo(e){const t=Dn(),{name:n,disabled:r,control:a=t,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Fr(a._names.array,n),u=p.useMemo(()=>z(a._formValues,n,z(a._defaultValues,n,l)),[a,n,l]),f=Ho({control:a,name:n,defaultValue:u,exact:o}),m=Uo({control:a,name:n,exact:o}),g=p.useRef(e),h=p.useRef(void 0),N=p.useRef(a.register(n,{...e.rules,value:f,...Ce(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const v=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!z(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!z(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!z(m.validatingFields,n)},error:{enumerable:!0,get:()=>z(m.errors,n)}}),[m,n]),b=p.useCallback(w=>N.current.onChange({target:{value:Er(w),name:n},type:Nt.CHANGE}),[n]),j=p.useCallback(()=>N.current.onBlur({target:{value:z(a._formValues,n),name:n},type:Nt.BLUR}),[n,a._formValues]),y=p.useCallback(w=>{const k=z(a._fields,n);k&&k._f&&w&&(k._f.ref={focus:()=>je(w.focus)&&w.focus(),select:()=>je(w.select)&&w.select(),setCustomValidity:E=>je(w.setCustomValidity)&&w.setCustomValidity(E),reportValidity:()=>je(w.reportValidity)&&w.reportValidity()})},[a._fields,n]),S=p.useMemo(()=>({name:n,value:f,...Ce(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:b,onBlur:j,ref:y}),[n,r,m.disabled,b,j,y,f]);return p.useEffect(()=>{const w=a._options.shouldUnregister||i,k=h.current;k&&k!==n&&!d&&a.unregister(k),a.register(n,{...g.current.rules,...Ce(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(I,M)=>{const $=z(a._fields,I);$&&$._f&&($._f.mount=M)};if(E(n,!0),w){const I=de(z(a._options.defaultValues,n,g.current.defaultValue));ie(a._defaultValues,n,I),oe(z(a._formValues,n))&&ie(a._formValues,n,I)}return!d&&a.register(n),h.current=n,()=>{(d?w&&!a._state.action:w)?a.unregister(n):E(n,!1)}},[n,a,d,i]),p.useEffect(()=>{a._setDisabledField({disabled:r,name:n})},[r,n,a]),p.useMemo(()=>({field:S,formState:m,fieldState:v}),[S,m,v])}const Wo=p.createContext(null);Wo.displayName="HookFormContext";var Yo=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},lt=e=>Array.isArray(e)?e:[e],fs=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function Tr(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],i=t[r];if(a&&fe(a)&&i){const l=Tr(a,i);fe(l)&&(n[r]=l)}else e[r]&&(n[r]=i)}return n}var ve=e=>fe(e)&&!Object.keys(e).length,Fn=e=>e.type==="file",Ct=e=>{if(!Sn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Lr=e=>e.type==="select-multiple",In=e=>e.type==="radio",Go=e=>In(e)||ft(e),qt=e=>Ct(e)&&e.isConnected;function Ko(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=oe(e)?r++:e[t[r++]];return e}function Qo(e){for(const t in e)if(e.hasOwnProperty(t)&&!oe(e[t]))return!1;return!0}function ue(e,t){const n=Array.isArray(t)?t:Et(t)?[t]:$n(t),r=n.length===1?e:Ko(e,n),a=n.length-1,i=n[a];return r&&delete r[i],a!==0&&(fe(r)&&ve(r)||Array.isArray(r)&&Qo(r))&&ue(e,n.slice(0,-1)),e}var Zo=e=>{for(const t in e)if(je(e[t]))return!0;return!1};function Pr(e){return Array.isArray(e)||fe(e)&&!Zo(e)}function un(e,t={}){for(const n in e){const r=e[n];Pr(r)?(t[n]=Array.isArray(r)?[]:{},un(r,t[n])):oe(r)||(t[n]=!0)}return t}function Ze(e,t,n){n||(n=un(t));for(const r in e){const a=e[r];if(Pr(a))oe(t)||dn(n[r])?n[r]=un(a,Array.isArray(a)?[]:{}):Ze(a,we(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!$e(a,i)}}return n}const ms={value:!1,isValid:!1},hs={value:!0,isValid:!0};var Or=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oe(e[0].attributes.value)?oe(e[0].value)||e[0].value===""?hs:{value:e[0].value,isValid:!0}:hs:ms}return ms},_r=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>oe(e)?e:t?e===""?NaN:e&&+e:n&&ke(e)?new Date(e):r?r(e):e;const xs={isValid:!1,value:null};var zr=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,xs):xs;function ps(e){const t=e.ref;return Fn(t)?t.files:In(t)?zr(e.refs).value:Lr(t)?[...t.selectedOptions].map(({value:n})=>n):ft(t)?Or(e.refs).value:_r(oe(t.value)?e.ref.value:t.value,e)}var Xo=(e,t,n,r)=>{const a={};for(const i of e){const l=z(t,i);l&&ie(a,i,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},kt=e=>e instanceof RegExp,rt=e=>oe(e)?e:kt(e)?e.source:fe(e)?kt(e.value)?e.value.source:e.value:e,gs=e=>({isOnSubmit:!e||e===Ae.onSubmit,isOnBlur:e===Ae.onBlur,isOnChange:e===Ae.onChange,isOnAll:e===Ae.all,isOnTouch:e===Ae.onTouched});const bs="AsyncFunction";var Jo=e=>!!e&&!!e.validate&&!!(je(e.validate)&&e.validate.constructor.name===bs||fe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===bs)),ec=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ys=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ot=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const i=z(e,a);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(ot(o,t))break}else if(fe(o)&&ot(o,t))break}}};function vs(e,t,n){const r=z(e,n);if(r||Et(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),l=z(t,i),o=z(e,i);if(l&&!Array.isArray(l)&&n!==i)return{name:n};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};a.pop()}return{name:n}}var tc=(e,t,n,r)=>{n(e);const{name:a,...i}=e;return ve(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(l=>t[l]===(!r||Ae.all))},nc=(e,t,n)=>!e||!t||e===t||lt(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),sc=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,rc=(e,t)=>!An(z(e,t)).length&&ue(e,t),ac=(e,t,n)=>{const r=lt(z(e,n));return ie(r,"root",t[n]),ie(e,n,r),e};function js(e,t,n="validate"){if(ke(e)||Array.isArray(e)&&e.every(ke)||Ce(e)&&!e)return{type:n,message:ke(e)?e:"",ref:t}}var Ke=e=>fe(e)&&!kt(e)?e:{value:e,message:""},ws=async(e,t,n,r,a,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:g,pattern:h,validate:N,name:v,valueAsNumber:b,mount:j}=e._f,y=z(n,v);if(!j||t.has(v))return{};const S=o?o[0]:l,w=A=>{a&&S.reportValidity&&(S.setCustomValidity(Ce(A)?"":A||""),S.reportValidity())},k={},E=In(l),I=ft(l),M=E||I,$=(b||Fn(l))&&oe(l.value)&&oe(y)||Ct(l)&&l.value===""||y===""||Array.isArray(y)&&!y.length,_=Yo.bind(null,v,r,k),F=(A,T,P,K=Fe.maxLength,q=Fe.minLength)=>{const W=A?T:P;k[v]={type:A?K:q,message:W,ref:l,..._(A?K:q,W)}};if(i?!Array.isArray(y)||!y.length:d&&(!M&&($||we(y))||Ce(y)&&!y||I&&!Or(o).isValid||E&&!zr(o).isValid)){const{value:A,message:T}=ke(d)?{value:!!d,message:d}:Ke(d);if(A&&(k[v]={type:Fe.required,message:T,ref:S,..._(Fe.required,T)},!r))return w(T),k}if(!$&&(!we(m)||!we(g))){let A,T;const P=Ke(g),K=Ke(m);if(!we(y)&&!isNaN(y)){const q=l.valueAsNumber||y&&+y;we(P.value)||(A=q>P.value),we(K.value)||(T=q<K.value)}else{const q=l.valueAsDate||new Date(y),W=ae=>new Date(new Date().toDateString()+" "+ae),ee=l.type=="time",re=l.type=="week";ke(P.value)&&y&&(A=ee?W(y)>W(P.value):re?y>P.value:q>new Date(P.value)),ke(K.value)&&y&&(T=ee?W(y)<W(K.value):re?y<K.value:q<new Date(K.value))}if((A||T)&&(F(!!A,P.message,K.message,Fe.max,Fe.min),!r))return w(k[v].message),k}if((u||f)&&!$&&(ke(y)||i&&Array.isArray(y))){const A=Ke(u),T=Ke(f),P=!we(A.value)&&y.length>+A.value,K=!we(T.value)&&y.length<+T.value;if((P||K)&&(F(P,A.message,T.message),!r))return w(k[v].message),k}if(h&&!$&&ke(y)){const{value:A,message:T}=Ke(h);if(kt(A)&&!y.match(A)&&(k[v]={type:Fe.pattern,message:T,ref:l,..._(Fe.pattern,T)},!r))return w(T),k}if(N){if(je(N)){const A=await N(y,n),T=js(A,S);if(T&&(k[v]={...T,..._(Fe.validate,T.message)},!r))return w(T.message),k}else if(fe(N)){let A={};for(const T in N){if(!ve(A)&&!r)break;const P=js(await N[T](y,n),S,T);P&&(A={...P,..._(T,P.message)},w(P.message),r&&(k[v]=A))}if(!ve(A)&&(k[v]={ref:S,...A},!r))return k}}return w(!0),k};const ic={mode:Ae.onSubmit,reValidateMode:Ae.onChange,shouldFocusError:!0};function lc(e={}){let t={...ic,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:je(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},a=fe(t.defaultValues)||fe(t.values)?de(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:de(a),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let g={...m};const h={array:fs(),state:fs()},N=t.criteriaMode===Ae.all,v=x=>C=>{clearTimeout(u),u=setTimeout(x,C)},b=async x=>{if(!l.keepIsValid&&!t.disabled&&(m.isValid||g.isValid||x)){let C;t.resolver?(C=ve((await M()).errors),j()):C=await _(r,!0),C!==n.isValid&&h.state.next({isValid:C})}},j=(x,C)=>{!t.disabled&&(m.isValidating||m.validatingFields||g.isValidating||g.validatingFields)&&((x||Array.from(o.mount)).forEach(D=>{D&&(C?ie(n.validatingFields,D,C):ue(n.validatingFields,D))}),h.state.next({validatingFields:n.validatingFields,isValidating:!ve(n.validatingFields)}))},y=(x,C=[],D,R,O=!0,L=!0)=>{if(R&&D&&!t.disabled){if(l.action=!0,L&&Array.isArray(z(r,x))){const Y=D(z(r,x),R.argA,R.argB);O&&ie(r,x,Y)}if(L&&Array.isArray(z(n.errors,x))){const Y=D(z(n.errors,x),R.argA,R.argB);O&&ie(n.errors,x,Y),rc(n.errors,x)}if((m.touchedFields||g.touchedFields)&&L&&Array.isArray(z(n.touchedFields,x))){const Y=D(z(n.touchedFields,x),R.argA,R.argB);O&&ie(n.touchedFields,x,Y)}(m.dirtyFields||g.dirtyFields)&&(n.dirtyFields=Ze(a,i)),h.state.next({name:x,isDirty:A(x,C),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ie(i,x,C)},S=(x,C)=>{ie(n.errors,x,C),h.state.next({errors:n.errors})},w=x=>{n.errors=x,h.state.next({errors:n.errors,isValid:!1})},k=(x,C,D,R)=>{const O=z(r,x);if(O){const L=z(i,x,oe(D)?z(a,x):D);oe(L)||R&&R.defaultChecked||C?ie(i,x,C?L:ps(O._f)):K(x,L),l.mount&&!l.action&&b()}},E=(x,C,D,R,O)=>{let L=!1,Y=!1;const ne={name:x};if(!t.disabled){if(!D||R){(m.isDirty||g.isDirty)&&(Y=n.isDirty,n.isDirty=ne.isDirty=A(),L=Y!==ne.isDirty);const se=$e(z(a,x),C);Y=!!z(n.dirtyFields,x),se?ue(n.dirtyFields,x):ie(n.dirtyFields,x,!0),ne.dirtyFields=n.dirtyFields,L=L||(m.dirtyFields||g.dirtyFields)&&Y!==!se}if(D){const se=z(n.touchedFields,x);se||(ie(n.touchedFields,x,D),ne.touchedFields=n.touchedFields,L=L||(m.touchedFields||g.touchedFields)&&se!==D)}L&&O&&h.state.next(ne)}return L?ne:{}},I=(x,C,D,R)=>{const O=z(n.errors,x),L=(m.isValid||g.isValid)&&Ce(C)&&n.isValid!==C;if(t.delayError&&D?(d=v(()=>S(x,D)),d(t.delayError)):(clearTimeout(u),d=null,D?ie(n.errors,x,D):ue(n.errors,x)),(D?!$e(O,D):O)||!ve(R)||L){const Y={...R,...L&&Ce(C)?{isValid:C}:{},errors:n.errors,name:x};n={...n,...Y},h.state.next(Y)}},M=async x=>(j(x,!0),await t.resolver(i,t.context,Xo(x||o.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),$=async x=>{const{errors:C}=await M(x);if(j(x),x)for(const D of x){const R=z(C,D);R?ie(n.errors,D,R):ue(n.errors,D)}else n.errors=C;return C},_=async(x,C,D={valid:!0})=>{for(const R in x){const O=x[R];if(O){const{_f:L,...Y}=O;if(L){const ne=o.array.has(L.name),se=O._f&&Jo(O._f);se&&m.validatingFields&&j([L.name],!0);const ye=await ws(O,o.disabled,i,N,t.shouldUseNativeValidation&&!C,ne);if(se&&m.validatingFields&&j([L.name]),ye[L.name]&&(D.valid=!1,C||e.shouldUseNativeValidation))break;!C&&(z(ye,L.name)?ne?ac(n.errors,ye,L.name):ie(n.errors,L.name,ye[L.name]):ue(n.errors,L.name))}!ve(Y)&&await _(Y,C,D)}}return D.valid},F=()=>{for(const x of o.unMount){const C=z(r,x);C&&(C._f.refs?C._f.refs.every(D=>!qt(D)):!qt(C._f.ref))&&be(x)}o.unMount=new Set},A=(x,C)=>!t.disabled&&(x&&C&&ie(i,x,C),!$e(B(),a)),T=(x,C,D)=>cn(x,o,{...l.mount?i:oe(C)?a:ke(x)?{[x]:C}:C},D,C),P=x=>An(z(l.mount?i:a,x,t.shouldUnregister?z(a,x,[]):[])),K=(x,C,D={})=>{const R=z(r,x);let O=C;if(R){const L=R._f;L&&(!L.disabled&&ie(i,x,_r(C,L)),O=Ct(L.ref)&&we(C)?"":C,Lr(L.ref)?[...L.ref.options].forEach(Y=>Y.selected=O.includes(Y.value)):L.refs?ft(L.ref)?L.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(O)?Y.checked=!!O.find(ne=>ne===Y.value):Y.checked=O===Y.value||!!O)}):L.refs.forEach(Y=>Y.checked=Y.value===O):Fn(L.ref)?L.ref.value="":(L.ref.value=O,L.ref.type||h.state.next({name:x,values:de(i)})))}(D.shouldDirty||D.shouldTouch)&&E(x,O,D.shouldTouch,D.shouldDirty,!0),D.shouldValidate&&ae(x)},q=(x,C,D)=>{for(const R in C){if(!C.hasOwnProperty(R))return;const O=C[R],L=x+"."+R,Y=z(r,L);(o.array.has(x)||fe(O)||Y&&!Y._f)&&!We(O)?q(L,O,D):K(L,O,D)}},W=(x,C,D={})=>{const R=z(r,x),O=o.array.has(x),L=de(C);ie(i,x,L),O?(h.array.next({name:x,values:de(i)}),(m.isDirty||m.dirtyFields||g.isDirty||g.dirtyFields)&&D.shouldDirty&&h.state.next({name:x,dirtyFields:Ze(a,i),isDirty:A(x,L)})):R&&!R._f&&!we(L)?q(x,L,D):K(x,L,D),ys(x,o)?h.state.next({...n,name:x,values:de(i)}):h.state.next({name:l.mount?x:void 0,values:de(i)})},ee=async x=>{l.mount=!0;const C=x.target;let D=C.name,R=!0;const O=z(r,D),L=se=>{R=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||$e(se,z(i,D,se))},Y=gs(t.mode),ne=gs(t.reValidateMode);if(O){let se,ye;const Ue=C.type?ps(O._f):Er(x),Pe=x.type===Nt.BLUR||x.type===Nt.FOCUS_OUT,Wa=!ec(O._f)&&!t.resolver&&!z(n.errors,D)&&!O._f.deps||sc(Pe,z(n.touchedFields,D),n.isSubmitted,ne,Y),Mt=ys(D,o,Pe);ie(i,D,Ue),Pe?(!C||!C.readOnly)&&(O._f.onBlur&&O._f.onBlur(x),d&&d(0)):O._f.onChange&&O._f.onChange(x);const Tt=E(D,Ue,Pe),Ya=!ve(Tt)||Mt;if(!Pe&&h.state.next({name:D,type:x.type,values:de(i)}),Wa)return(m.isValid||g.isValid)&&(t.mode==="onBlur"?Pe&&b():Pe||b()),Ya&&h.state.next({name:D,...Mt?{}:Tt});if(!Pe&&Mt&&h.state.next({...n}),t.resolver){const{errors:Vn}=await M([D]);if(j([D]),L(Ue),R){const Ga=vs(n.errors,r,D),Un=vs(Vn,r,Ga.name||D);se=Un.error,D=Un.name,ye=ve(Vn)}}else j([D],!0),se=(await ws(O,o.disabled,i,N,t.shouldUseNativeValidation))[D],j([D]),L(Ue),R&&(se?ye=!1:(m.isValid||g.isValid)&&(ye=await _(r,!0)));R&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&ae(O._f.deps),I(D,ye,se,Tt))}},re=(x,C)=>{if(z(n.errors,C)&&x.focus)return x.focus(),1},ae=async(x,C={})=>{let D,R;const O=lt(x);if(t.resolver){const L=await $(oe(x)?x:O);D=ve(L),R=x?!O.some(Y=>z(L,Y)):D}else x?(R=(await Promise.all(O.map(async L=>{const Y=z(r,L);return await _(Y&&Y._f?{[L]:Y}:Y)}))).every(Boolean),!(!R&&!n.isValid)&&b()):R=D=await _(r);return h.state.next({...!ke(x)||(m.isValid||g.isValid)&&D!==n.isValid?{}:{name:x},...t.resolver||!x?{isValid:D}:{},errors:n.errors}),C.shouldFocus&&!R&&ot(r,re,x?O:o.mount),R},B=(x,C)=>{let D={...l.mount?i:a};return C&&(D=Tr(C.dirtyFields?n.dirtyFields:n.touchedFields,D)),oe(x)?D:ke(x)?z(D,x):x.map(R=>z(D,R))},Z=(x,C)=>({invalid:!!z((C||n).errors,x),isDirty:!!z((C||n).dirtyFields,x),error:z((C||n).errors,x),isValidating:!!z(n.validatingFields,x),isTouched:!!z((C||n).touchedFields,x)}),Q=x=>{x&&lt(x).forEach(C=>ue(n.errors,C)),h.state.next({errors:x?n.errors:{}})},H=(x,C,D)=>{const R=(z(r,x,{_f:{}})._f||{}).ref,O=z(n.errors,x)||{},{ref:L,message:Y,type:ne,...se}=O;ie(n.errors,x,{...se,...C,ref:R}),h.state.next({name:x,errors:n.errors,isValid:!1}),D&&D.shouldFocus&&R&&R.focus&&R.focus()},X=(x,C)=>je(x)?h.state.subscribe({next:D=>"values"in D&&x(T(void 0,C),D)}):T(x,C,!0),J=x=>h.state.subscribe({next:C=>{nc(x.name,C.name,x.exact)&&tc(C,x.formState||m,Ee,x.reRenderRoot)&&x.callback({values:{...i},...n,...C,defaultValues:a})}}).unsubscribe,Ne=x=>(l.mount=!0,g={...g,...x.formState},J({...x,formState:{...f,...x.formState}})),be=(x,C={})=>{for(const D of x?lt(x):o.mount)o.mount.delete(D),o.array.delete(D),C.keepValue||(ue(r,D),ue(i,D)),!C.keepError&&ue(n.errors,D),!C.keepDirty&&ue(n.dirtyFields,D),!C.keepTouched&&ue(n.touchedFields,D),!C.keepIsValidating&&ue(n.validatingFields,D),!t.shouldUnregister&&!C.keepDefaultValue&&ue(a,D);h.state.next({values:de(i)}),h.state.next({...n,...C.keepDirty?{isDirty:A()}:{}}),!C.keepIsValid&&b()},he=({disabled:x,name:C})=>{if(Ce(x)&&l.mount||x||o.disabled.has(C)){const O=o.disabled.has(C)!==!!x;x?o.disabled.add(C):o.disabled.delete(C),O&&l.mount&&!l.action&&b()}},Be=(x,C={})=>{let D=z(r,x);const R=Ce(C.disabled)||Ce(t.disabled);return ie(r,x,{...D||{},_f:{...D&&D._f?D._f:{ref:{name:x}},name:x,mount:!0,...C}}),o.mount.add(x),D?he({disabled:Ce(C.disabled)?C.disabled:t.disabled,name:x}):k(x,!0,C.value),{...R?{disabled:C.disabled||t.disabled}:{},...t.progressive?{required:!!C.required,min:rt(C.min),max:rt(C.max),minLength:rt(C.minLength),maxLength:rt(C.maxLength),pattern:rt(C.pattern)}:{},name:x,onChange:ee,onBlur:ee,ref:O=>{if(O){Be(x,C),D=z(r,x);const L=oe(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,Y=Go(L),ne=D._f.refs||[];if(Y?ne.find(se=>se===L):L===D._f.ref)return;ie(r,x,{_f:{...D._f,...Y?{refs:[...ne.filter(qt),L,...Array.isArray(z(a,x))?[{}]:[]],ref:{type:L.type,name:x}}:{ref:L}}}),k(x,!1,void 0,L)}else D=z(r,x,{}),D._f&&(D._f.mount=!1),(t.shouldUnregister||C.shouldUnregister)&&!(Fr(o.array,x)&&l.action)&&o.unMount.add(x)}}},Me=()=>t.shouldFocusError&&ot(r,re,o.mount),Te=x=>{Ce(x)&&(h.state.next({disabled:x}),ot(r,(C,D)=>{const R=z(r,D);R&&(C.disabled=R._f.disabled||x,Array.isArray(R._f.refs)&&R._f.refs.forEach(O=>{O.disabled=R._f.disabled||x}))},0,!1))},Le=(x,C)=>async D=>{let R;D&&(D.preventDefault&&D.preventDefault(),D.persist&&D.persist());let O=de(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:Y}=await M();j(),n.errors=L,O=de(Y)}else await _(r);if(o.disabled.size)for(const L of o.disabled)ue(O,L);if(ue(n.errors,"root"),ve(n.errors)){h.state.next({errors:{}});try{await x(O,D)}catch(L){R=L}}else C&&await C({...n.errors},D),Me(),setTimeout(Me);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(n.errors)&&!R,submitCount:n.submitCount+1,errors:n.errors}),R)throw R},Ve=(x,C={})=>{z(r,x)&&(oe(C.defaultValue)?W(x,de(z(a,x))):(W(x,C.defaultValue),ie(a,x,de(C.defaultValue))),C.keepTouched||ue(n.touchedFields,x),C.keepDirty||(ue(n.dirtyFields,x),n.isDirty=C.defaultValue?A(x,de(z(a,x))):A()),C.keepError||(ue(n.errors,x),m.isValid&&b()),h.state.next({...n}))},De=(x,C={})=>{const D=x?de(x):a,R=de(D),O=ve(x),L=O?a:R;if(C.keepDefaultValues||(a=D),!C.keepValues){if(C.keepDirtyValues){const Y=new Set([...o.mount,...Object.keys(Ze(a,i))]);for(const ne of Array.from(Y)){const se=z(n.dirtyFields,ne),ye=z(i,ne),Ue=z(L,ne);se&&!oe(ye)?ie(L,ne,ye):!se&&!oe(Ue)&&W(ne,Ue)}}else{if(Sn&&oe(x))for(const Y of o.mount){const ne=z(r,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Ct(se)){const ye=se.closest("form");if(ye){ye.reset();break}}}}if(C.keepFieldsRef)for(const Y of o.mount)W(Y,z(L,Y));else r={}}i=t.shouldUnregister?C.keepDefaultValues?de(a):{}:de(L),h.array.next({values:{...L}}),h.state.next({values:{...L}})}o={mount:C.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!C.keepIsValid||!!C.keepDirtyValues||!t.shouldUnregister&&!ve(L),l.watch=!!t.shouldUnregister,l.keepIsValid=!!C.keepIsValid,l.action=!1,C.keepErrors||(n.errors={}),h.state.next({submitCount:C.keepSubmitCount?n.submitCount:0,isDirty:O?!1:C.keepDirty?n.isDirty:!!(C.keepDefaultValues&&!$e(x,a)),isSubmitted:C.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:O?{}:C.keepDirtyValues?C.keepDefaultValues&&i?Ze(a,i):n.dirtyFields:C.keepDefaultValues&&x?Ze(a,x):C.keepDirty?n.dirtyFields:{},touchedFields:C.keepTouched?n.touchedFields:{},errors:C.keepErrors?n.errors:{},isSubmitSuccessful:C.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},te=(x,C)=>De(je(x)?x(i):x,{...t.resetOptions,...C}),me=(x,C={})=>{const D=z(r,x),R=D&&D._f;if(R){const O=R.refs?R.refs[0]:R.ref;O.focus&&setTimeout(()=>{O.focus(),C.shouldSelect&&je(O.select)&&O.select()})}},Ee=x=>{n={...n,...x}},xe={control:{register:Be,unregister:be,getFieldState:Z,handleSubmit:Le,setError:H,_subscribe:J,_runSchema:M,_updateIsValidating:j,_focusError:Me,_getWatch:T,_getDirty:A,_setValid:b,_setFieldArray:y,_setDisabledField:he,_setErrors:w,_getFieldArray:P,_reset:De,_resetDefaultValues:()=>je(t.defaultValues)&&t.defaultValues().then(x=>{te(x,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Te,_subjects:h,_proxyFormState:m,get _fields(){return r},get _formValues(){return i},get _state(){return l},set _state(x){l=x},get _defaultValues(){return a},get _names(){return o},set _names(x){o=x},get _formState(){return n},get _options(){return t},set _options(x){t={...t,...x}}},subscribe:Ne,trigger:ae,register:Be,handleSubmit:Le,watch:X,setValue:W,getValues:B,reset:te,resetField:Ve,clearErrors:Q,unregister:be,setError:H,setFocus:me,getFieldState:Z};return{...xe,formControl:xe}}function oc(e={}){const t=p.useRef(void 0),n=p.useRef(void 0),[r,a]=p.useState({isDirty:!1,isValidating:!1,isLoading:je(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:je(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!je(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=lc(e);t.current={...o,formState:r}}const i=t.current.control;return i._options=e,En(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}),reRenderRoot:!0});return a(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!==r.isDirty&&i._subjects.state.next({isDirty:l})}},[i,r.isDirty]),p.useEffect(()=>{var l;e.values&&!$e(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),n.current=e.values,a(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()}),t.current.formState=p.useMemo(()=>Mr(r,i),[i,r]),t.current}function cc(e,t=3){return e%1===0?e.toString():e.toFixed(t).replace(/\.?0+$/,"")}function dc(e,t="en-US",n="USD"){try{return new Intl.NumberFormat(t,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function uc(e="USD",t="en-US"){try{return new Intl.NumberFormat(t,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function fc(e){const t=e.replace(/[^\d.,-]/g,""),n=t.match(/,\d{1,2}$/);let r;n?r=t.replace(/\./g,"").replace(",","."):r=t.replace(/,/g,"");const a=parseFloat(r);return isNaN(a)?null:a}function mc(e,t,n=.001){const r=e-t,a=Math.abs(r)<=n;return{difference:r,isBalanced:a,isUnderAllocated:!a&&r>0,isOverAllocated:!a&&r<0}}function Mn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Mn();const hc={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Wt=()=>({id:Mn(),amount:0,glAccount:null,isTaxDeductible:!1}),Rr=({distribution:e,defaultDistribution:t,glAccounts:n=[],isLoadingGlAccounts:r=!1,onSearchGlAccounts:a,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:g=!1,labels:h,classNames:N={},"data-testid":v,control:b,name:j,rules:y})=>{const S={...hc,...h},w=b!==void 0&&j!==void 0,k=oc({defaultValues:{_internal:t||Wt()}}),E=qo({control:w?b:k.control,name:w?j:"_internal",rules:w?y:void 0}),[I,M]=p.useState(t||Wt()),$=w?E.field.value??Wt():e??I,_=w&&!!E.fieldState?.error,F=w&&(E.fieldState?.isTouched??!1),A=_||F,T=A&&(!$.amount||$.amount<=0),P=A&&!$.glAccount,[K,q]=p.useState($.glAccount?.name||""),W=p.useCallback(H=>{const X={...$,...H};w&&E.field.onChange(X),!w&&e===void 0&&M(X),i?.(X)},[$,e,i,w,E]),ee=p.useCallback(H=>{const X=H||0;W({amount:X}),l?.(X)},[W,l]),re=p.useCallback(H=>{q(H),a?.(H)},[a]),ae=p.useCallback(H=>{if(H===null){W({glAccount:null}),o?.(null);return}const J=n.find(Ne=>String(Ne.id)===String(H))||null;W({glAccount:J}),o?.(J)},[n,W,o]),B=p.useCallback(()=>{q(""),W({glAccount:null}),o?.(null)},[W,o]),Z=p.useCallback(H=>{W({isTaxDeductible:H}),d?.(H)},[W,d]),Q=p.useCallback(()=>{u?.()},[u]);return s.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"revenue-distribution-card",className:c.cn(N.base),children:s.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",N.body),children:[s.jsx("div",{className:c.cn("shrink-0",N.amountContainer),children:s.jsx(c.NumberInput,{"data-testid":`${v||"revenue-distribution-card"}-amount-input`,label:s.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,s.jsx(c.Tooltip,{content:S.amountTooltip,children:s.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:$.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:g,isInvalid:T,errorMessage:T?"Amount is required":void 0,minValue:0,step:.01,className:N.amountInput,startContent:s.jsx("div",{className:"pointer-events-none flex items-center",children:s.jsx("span",{className:"text-default-400 text-small",children:S.currencySymbol})})})}),s.jsx("div",{className:c.cn("grow",N.glAccountContainer),children:s.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:s.jsxs("span",{className:"flex items-center gap-1",children:[S.glAccount,s.jsx(c.Tooltip,{content:S.glAccountTooltip,children:s.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:r,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:$.glAccount?.name??K,selectedKey:$.glAccount?.id??null,isDisabled:g,isInvalid:P,errorMessage:P?"GL Account is required":void 0,listboxProps:{emptyContent:r?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:re,onSelectionChange:ae,onClear:B,className:N.glAccountInput,children:H=>s.jsx(c.AutocompleteItem,{textValue:H.name,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:H.name}),H.code&&s.jsx("span",{className:"text-xs text-default-400",children:H.code})]})},H.id)})}),s.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",N.taxDeductibleContainer),children:s.jsx(c.Checkbox,{radius:"full","data-testid":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:$.isTaxDeductible,onValueChange:Z,isDisabled:g||!m,className:N.taxDeductibleCheckbox,children:S.taxDeductible})}),s.jsx("div",{className:c.cn("shrink-0 pt-6",N.deleteContainer),children:s.jsx(U,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:g||!f,onPress:Q,startContent:s.jsx(V,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",N.deleteButton),children:S.deleteButton})})]})})};Rr.displayName="RevenueDistributionCard";const Br=({message:e="No distributions configured",icon:t="solar:document-text-outline",iconSize:n=48,showCard:r=!0,classNames:a={},renderEmpty:i})=>{if(i)return s.jsx(s.Fragment,{children:i()});const l=s.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",a.content),children:[s.jsx(V,{icon:t,width:n,className:c.cn("text-default-300 mb-4",a.icon)}),s.jsx("p",{className:c.cn("text-default-500 text-sm text-center",a.message),children:e})]});return r?s.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",a.base),children:s.jsx(c.CardBody,{children:l})}):s.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",a.base),children:l})};Br.displayName="RevenueDistributionEmpty";const xc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Vr=({error:e,labels:t,showCard:n=!0,color:r="danger",classNames:a={}})=>{const i={...xc,...t},l=s.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:r,title:i.title,description:e||i.description,className:a.alert});return n?s.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",a.base),children:s.jsx(c.CardBody,{children:l})}):s.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",a.base),children:l})};Vr.displayName="RevenueDistributionError";const Ur=({rows:e=1,showCard:t=!0,classNames:n={}})=>{const r=Array.from({length:e},(i,l)=>l),a=i=>s.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[s.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),s.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),s.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),s.jsxs("div",{className:"grow flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),s.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),s.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),s.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[s.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),s.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),s.jsx("div",{className:"shrink-0 pb-2",children:s.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return t?s.jsx("div",{className:c.cn("flex flex-col gap-3",n.base),children:r.map(i=>s.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:s.jsx(c.CardBody,{children:a(i)})},i))}):s.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",n.base),children:r.map(i=>a(i))})};Ur.displayName="RevenueDistributionSkeleton";function Ft({isOpen:e,labels:t,icon:n,isConfirming:r=!1,confirmColor:a="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return s.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:s.jsxs(c.ModalContent,{children:[s.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[n&&s.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:n}),s.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:t.title})]}),s.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:s.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:t.description})}),s.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[s.jsx(U,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:t.cancel}),s.jsx(U,{type:"button",size:"md",color:a,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",a==="danger"?"bg-danger-600":"bg-brand"),isLoading:r,onPress:f,children:t.confirm})]})]})})}const pc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function fn(e){return!e.fund&&Number(e.percentage||0)<=0}function gc({mode:e,assignments:t}){const n=t.filter(l=>!fn(l)),r=n.filter(l=>l.fund),a=r.reduce((l,o)=>l+Number(o.percentage||0),0),i=n.some(l=>!l.fund||Number(l.percentage||0)<=0);return r.length>=1&&!i&&Math.round(a*100)/100===100}const bc={title:"Payment assignment",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},Hr={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"},at={...Hr,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},yc={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"},vc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function jc(){return s.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[s.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),s.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),s.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),s.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const wc=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Nc=e=>e.fund!==null;function Cc({assignments:e,funds:t,labels:n,classNames:r,isSaving:a=!1,hasSavedAssignments:i=!1,isFundPickerOpen:l=!1,activeAssignmentId:o=null,modalPortalContainer:d,footer:u,onAssignmentsChange:f,onOpenFundPicker:m,onCloseFundPicker:g,onCollapseChange:h,onSave:N}){const[v,b]=p.useState(null),j=d??v??void 0,y={...bc,...n},S=e.filter(H=>!fn(H)),k=S.filter(Nc).length>0,E=p.useMemo(()=>e.filter(H=>!fn(H)).reduce((H,X)=>H+Number(X.percentage||0),0),[e]),I=Math.round(E*100)/100,M=S.some(H=>!H.fund||Number(H.percentage||0)<=0),$=k&&(I!==100||M),_=`${y.totalError} (${y.total} ${Number(E.toFixed(2))}%)`,F=gc({mode:"split",assignments:e}),A=k&&I>=100,[T,P]=p.useState(!1),[K,q]=p.useState(!1),W=s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(jc,{}),s.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title})]}),ee=(H,X)=>{f(e.map(J=>J.id===H?{...J,...X}:J))},re=()=>{A||f([...e,pc()])},ae=H=>{e.length<=1||f(e.filter(X=>X.id!==H))},B=()=>{if(!a){if(!F){q(!0);return}if(!i){N();return}P(!0)}},Z=()=>{P(!1),N()},Q=H=>{const X=o??e.find(J=>!J.fund)?.id??e[0]?.id;X&&(f(e.map(J=>J.id===X?{...J,fund:H}:J)),g())};return s.jsxs("div",{ref:b,className:c.cn("vvt-pa relative font-sans text-zinc-900",l&&!d&&"min-h-[560px]",r?.root),children:[s.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:c.cn("w-full gap-0 px-0",r?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",r?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:H=>h?.(!(H==="all"||Array.from(H).length>0)),children:s.jsx(c.AccordionItem,{"aria-label":y.title,title:W,children:s.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",r?.content),children:[s.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!k&&s.jsx(c.Alert,{icon:s.jsx(V,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Hr,color:"default",variant:"flat",title:y.emptySplit}),k&&s.jsx(kc,{assignments:e,labels:y,total:E,hasTotalError:K&&!F||$,validationMessage:_,onSelectFund:H=>m(H),onRemoveFund:ae,onPercentageChange:(H,X)=>ee(H,{percentage:wc(X)})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx(U,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50",startContent:s.jsx(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:A,onPress:()=>k?re():m(),children:y.assignSpecificFund}),s.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:a?void 0:s.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:a,onPress:B,children:y.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),l&&s.jsx(Sc,{funds:t,labels:y,selectedFundIds:e.map(H=>H.fund?.id).filter(Boolean),portalContainer:j,onSelect:Q,onClose:g}),s.jsx(Ft,{isOpen:T,labels:{title:y.modifyAssignedFundsTitle,description:s.jsxs(s.Fragment,{children:[s.jsx("p",{children:y.modifyAssignedFundsDescription}),s.jsx("p",{className:"mt-3",children:y.modifyAssignedFundsWarning})]}),cancel:y.modifyAssignedFundsCancel,confirm:y.modifyAssignedFundsConfirm},icon:s.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:j,shouldBlockScroll:!1,classNames:vc,onClose:()=>P(!1),onConfirm:Z})]})}function kc({assignments:e,labels:t,total:n,hasTotalError:r,validationMessage:a,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return s.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>s.jsxs("div",{className:"flex min-h-15 w-full items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[s.jsx("div",{className:c.cn("flex min-h-11 min-w-0 flex-1 items-center","gap-4"),children:d.fund?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),s.jsx(U,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(d.id),children:"Replace"})]}):s.jsx(U,{type:"button",size:"lg",variant:"light",radius:"full",className:"justify-start px-4 text-lg font-normal text-zinc-900",startContent:s.jsx(G.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:t.assignSpecificFund})}),s.jsx("label",{className:"flex w-48 flex-none items-center",children:s.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:s.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:yc})}),e.length>1&&s.jsx(U,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":t.removeFund,children:s.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),s.jsx(c.Alert,{icon:s.jsx(V,{icon:r?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:r?"warning":"success",variant:"flat",classNames:{...at,base:c.cn(at.base,r?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(at.iconWrapper,r?"text-warning-700":"text-success-700"),alertIcon:c.cn(at.alertIcon,r?"text-warning-700":"text-success-700"),title:c.cn(at.title,r?"text-warning-700":"text-success-700")},title:r?a:`${t.total} ${Number(n.toFixed(2))}%`})]})}function Sc({funds:e,labels:t,selectedFundIds:n,portalContainer:r,onSelect:a,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return s.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:r,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:s.jsxs(c.ModalContent,{className:"max-h-full",children:[s.jsx(c.ModalHeader,{className:"px-6 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:t.modalTitle}),s.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[s.jsx(c.Input,{variant:"bordered","aria-label":t.searchPlaceholder,value:l,placeholder:t.searchPlaceholder,onChange:u=>o(u.target.value),startContent:s.jsx(V,{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"}}),s.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900",children:[s.jsx("span",{children:t.glCode}),s.jsx("span",{children:t.accountName}),s.jsx("span",{children:t.actions})]}),d.length===0&&s.jsx("div",{className:"p-4 text-sm text-zinc-500",children:t.noFunds}),d.map(u=>s.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[s.jsx("span",{children:u.glCode}),s.jsx("span",{children:u.accountName}),s.jsx(U,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>a(u),children:t.select})]},u.id))]})]})]})})}function Ac(){return s.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:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),s.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),s.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),s.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[s.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),s.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),s.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const $c={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Dc({totalAmount:e,remainingBalance:t,amountReceived:n,currency:r="USD",locale:a="en-US",labels:i,className:l}){const o={...$c,...i},d=new Intl.NumberFormat(a,{style:"currency",currency:r});return s.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:s.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[s.jsx(Yt,{label:o.totalAmount,value:d.format(e)}),s.jsx(Yt,{label:o.remainingBalance,value:d.format(t)}),s.jsx(Yt,{label:o.amountReceived,value:d.format(n)})]})})}function Yt({label:e,value:t}){return s.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[s.jsx("span",{className:"font-medium text-zinc-700",children:e}),s.jsx("span",{className:"font-normal text-zinc-950",children:t})]})}const Ec={monthly:1,quarterly:3,annual:12},qr=e=>{const[t,n,r]=e.split("-").map(Number);return{year:t,month:n,day:r}},Fc=(e,t)=>new Date(e,t+1,0).getDate(),Ic=e=>{const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},Mc=(e,t)=>{const{year:n,month:r,day:a}=qr(e),i=r-1+t,l=n+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(a,Fc(l,o));return new Date(l,o,d)},Tc=(e,t)=>{const{year:n,month:r,day:a}=qr(e),i=new Date(n,r-1,a);return i.setDate(i.getDate()+t),i};function Wr(e,t){const n=Math.max(1,Math.floor(t.numberOfInstallments||1)),r=Math.round(e*100),a=Math.floor(r/n),i=r-a*n,l=Ec[t.frequency];return Array.from({length:n},(o,d)=>{const u=t.frequency==="weekly"?Tc(t.firstInstallmentDate,d*7):Mc(t.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:Ic(u),amount:(a+(d===0?i:0))/100}})}function Lc(e){return new Set(e.map((t,n)=>{const r=e[n+1]?.dueDate;return t.dueDate&&r&&t.dueDate>r?t.id:null}).filter(t=>!!t))}const Pc={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total cannot exceed donation amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Oc=["weekly","monthly","quarterly","annual"],_c=Array.from({length:31},(e,t)=>t+1),zc=["numberOfInstallments","frequency","firstInstallmentDate"],Rc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Ns=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),Yr=e=>Math.round(e*100)/100,Bc=(e,t)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(n)},It=e=>{if(!e)return null;try{return Pl(e)}catch{return null}},Vc=e=>It(e)?.day??1,Uc=(e,t)=>new Date(e,t,0).getDate(),Hc=(e,t)=>{const n=It(e);if(!n)return e;const r=Math.min(t,Uc(n.year,n.month));return n.set({day:r}).toString()},Cs=e=>{const t=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${t}`};function qc({mode:e,donationAmount:t,currency:n="USD",locale:r="en-US",installments:a,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=zc,startDate:g,labels:h,classNames:N,isSaving:v=!1,isModeSwitchDisabled:b=!1,onModeChange:j,onAutomaticSettingsChange:y,onInstallmentsChange:S,onSave:w}){const[k,E]=p.useState(null),[I,M]=p.useState(l),$={...Pc,...h},_=e??I,F=p.useMemo(()=>new Intl.NumberFormat(r,{style:"currency",currency:n}),[n,r]),A=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||g||"":g||i.firstInstallmentDate}),[i,m,g]),T=_==="automatic"?Wr(t,A):a,P=p.useMemo(()=>Yr(T.reduce((J,Ne)=>J+Number(Ne.amount||0),0)),[T]),K=_==="manual"&&P-t>.009,[q,W]=p.useState(!1),ee=o?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(G.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),s.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:$.title})]}):void 0,re=J=>{J!==_&&(e||M(J),j?.(J),J==="manual"&&a.length===0&&S([Ns()]))},ae=(J,Ne)=>{a.find(he=>he.id===J)?.status!=="paid"&&S(a.map(he=>he.id===J?{...he,...Ne}:he))},B=()=>{S([...a,Ns()])},Z=J=>{a.find(be=>be.id===J)?.status!=="paid"&&S(a.filter(be=>be.id!==J))},Q=()=>{if(!v){if(K){W(!0);return}w?.()}},H=()=>{W(!1),w?.()},X=s.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",N?.content),children:[f||u?s.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?s.jsx(Wc,{mode:_,labels:$,onModeChange:re,isDisabled:b,className:N?.tabs}):null,u?s.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:v?void 0:s.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:v,onPress:Q,children:$.saveInstallments}):null]}):null,s.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",N?.preview),children:[_==="automatic"&&s.jsx(Yc,{settings:A,inputs:m,labels:$,className:N?.controls,onSettingsChange:y}),T.length===0&&s.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:_==="automatic"?$.emptyAutomatic:$.emptyManual}),T.length>0&&s.jsx(Gc,{mode:_,installments:T,labels:$,formatter:F,locale:r,onUpdateInstallment:ae,onRemoveInstallment:Z}),_==="manual"&&s.jsx("div",{className:"flex flex-wrap gap-3",children:s.jsx(U,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:s.jsx(G.Plus,{className:"size-5",strokeWidth:2}),onPress:B,children:$.addInstallment})}),s.jsx(Qc,{total:P,donationAmount:t,hasTotalIncreaseWarning:K,mode:_,installments:T,formatter:F,labels:$,className:N?.summary})]})]});return s.jsxs("div",{ref:E,className:c.cn("vvt-ps relative font-sans text-zinc-900",N?.root),children:[d?s.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",N?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",N?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:s.jsx(c.AccordionItem,{"aria-label":$.title,title:ee,children:X},"installment-schedule")}):X,s.jsx(Ft,{isOpen:q,labels:{title:$.totalIncreaseConfirmationTitle,description:$.totalIncreaseConfirmationDescription,cancel:$.totalIncreaseConfirmationCancel,confirm:$.totalIncreaseConfirmationConfirm},icon:s.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:v,portalContainer:k??void 0,shouldBlockScroll:!1,classNames:Rc,onClose:()=>W(!1),onConfirm:H})]})}function Wc({mode:e,labels:t,className:n,isDisabled:r=!1,onModeChange:a}){return s.jsxs(c.Tabs,{"aria-label":t.title,selectedKey:e,isDisabled:r,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>a(i),children:[s.jsx(c.Tab,{title:t.automaticMode},"automatic"),s.jsx(c.Tab,{title:t.manualMode},"manual")]})}function Yc({settings:e,inputs:t,labels:n,className:r,onSettingsChange:a}){const i=l=>{if(l==="numberOfInstallments")return s.jsx("div",{className:"min-w-0",children:s.jsx(c.Input,{variant:"bordered",label:n.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;a({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return s.jsx("div",{className:"min-w-0",children:s.jsx(ze,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&a({...e,frequency:d})},children:Oc.map(o=>s.jsx(c.SelectItem,{textValue:n[o],children:n[o]},o))})},l);if(l==="dayOfMonth"){const o=String(Vc(e.firstInstallmentDate));return s.jsx("div",{className:"min-w-0",children:s.jsx(ze,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&a({...e,firstInstallmentDate:Hc(e.firstInstallmentDate,u)})},children:_c.map(d=>s.jsx(c.SelectItem,{textValue:Cs(d),children:Cs(d)},String(d)))})},l)}return s.jsx("div",{className:"min-w-0",children:s.jsx(Nn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:It(e.firstInstallmentDate),onChange:o=>a({...e,firstInstallmentDate:o?o.toString():""}),startContent:s.jsx(V,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return t.length===0?null:s.jsx("div",{className:c.cn("grid gap-4",r),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:t.map(i)})}function Gc({mode:e,installments:t,labels:n,formatter:r,locale:a,onUpdateInstallment:i,onRemoveInstallment:l}){const o=Lc(t),d=new Set(t.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));return e==="automatic"?s.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:s.jsx("div",{className:c.cn("flex flex-col gap-3",t.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:t.map((u,f)=>s.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{children:["#",f+1]}),s.jsx("span",{children:"▪"}),s.jsx("span",{children:Bc(u.dueDate,a)}),f===0&&t.length>1&&s.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),s.jsx("span",{className:"text-zinc-950",children:r.format(u.amount)})]},u.id))})}):s.jsx("div",{className:"flex flex-col gap-2",children:t.map((u,f)=>{const m=o.has(u.id),g=d.has(u.id);return s.jsx("div",{className:"flex w-full flex-col gap-1",children:s.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[s.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:f+1}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Nn,{variant:"bordered","aria-label":`${n.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:m,errorMessage:m?n.dateOrderError:void 0,value:It(u.dueDate),onChange:h=>i(u.id,{dueDate:h?h.toString():""})})}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(c.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:g,errorMessage:g?n.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:h=>i(u.id,{amount:Yr(Number(h.target.value||0))}),startContent:s.jsx("span",{className:"text-zinc-900",children:"$"})})}),s.jsx(Kc,{isDisabled:t.length<=1,isPaid:u.status==="paid",label:n.deleteInstallment,onRemove:()=>l(u.id)})]})},u.id)})})}function Kc({isDisabled:e,isPaid:t,label:n,onRemove:r}){const a=s.jsx(U,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||t,onPress:r,"aria-label":n,children:s.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return t?s.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:s.jsx("span",{className:"inline-flex",children:a})}):a}function Qc({total:e,donationAmount:t,hasTotalIncreaseWarning:n,mode:r,installments:a,formatter:i,labels:l,className:o}){const d=a.length,u=a[0]?.amount??0,f=a[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),g=Math.max(t-e,0),h=n?s.jsx("span",{children:l.totalIncreaseWarning}):r==="automatic"?m?s.jsxs("span",{children:["Saving will create ",s.jsx("strong",{children:d})," scheduled payment records:"," ",s.jsx("strong",{children:i.format(u)})," first charge and"," ",s.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):s.jsxs("span",{children:["Saving will create ",s.jsx("strong",{children:d})," scheduled payment records of"," ",s.jsx("strong",{children:i.format(u)})," each."]}):s.jsxs("span",{children:["Total scheduled: ",s.jsx("strong",{children:i.format(e)})," /"," ",s.jsx("strong",{children:i.format(t)}),"."]}),N=r==="automatic"?`Total: ${i.format(e)}`:n?`New total: ${i.format(e)}`:`${l.remaining}: ${i.format(g)}`;return s.jsx(c.Alert,{isClosable:!1,color:n?"warning":"default",variant:"flat",radius:"full",className:o,endContent:s.jsx("span",{className:"whitespace-nowrap",children:N}),title:h})}function Zc(){return s.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:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),s.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),s.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[s.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[s.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),s.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),s.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),s.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,t)=>s.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[s.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),s.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},t))})]})}const ks={paid:"bg-emerald-50 text-emerald-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"},Gr={paid:"Paid",schedule:"Schedule",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled"},Xc={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:s.jsxs(s.Fragment,{children:["Are you sure you want to delete this payment? ",s.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},Jc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},ed=[];function td({installments:e,currency:t,locale:n="en-US",showTitle:r=!0,showCard:a=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=ed,labels:d,isSaving:u=!1,onEditInstallments:f,onPayInstallment:m,onDeleteInstallment:g}){const[h,N]=p.useState(null),v={...Xc,...d},[b,j]=p.useState(""),y=new Intl.NumberFormat(n,{style:"currency",currency:t}),S=r?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(G.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),s.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:v.title})]}):void 0,w=p.useMemo(()=>{const E=b.trim().toLowerCase();return E?e.filter(I=>{const M=I.status??"schedule";return[I.id,I.amount,I.dueDate,Gt(I.dueDate,n),M,Gr[M]??M].join(" ").toLowerCase().includes(E)}):e},[n,e,b]),k=s.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[s.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[s.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:v.searchLabel}),s.jsx(c.Input,{variant:"bordered",size:"md",value:b,placeholder:v.searchPlaceholder,onChange:E=>j(E.target.value),startContent:s.jsx(V,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?s.jsx(U,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:s.jsx(V,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:v.editInstallments}):null]}),s.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",w.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:s.jsxs("div",{className:"flex flex-col gap-2",children:[w.map((E,I)=>{const M=E.status??"schedule";return s.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:s.jsxs(c.CardBody,{className:"gap-3 p-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-xs text-default-500",children:["#",I+1]}),s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${I+1}`})]}),s.jsx(Ss,{status:M})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-default-500",children:v.amount}),s.jsx("p",{className:"font-medium text-foreground",children:y.format(E.amount)})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"text-xs text-default-500",children:v.scheduledDate}),s.jsx("p",{className:"font-medium text-foreground",children:Gt(E.dueDate,n)})]})]}),s.jsx(As,{status:M,installment:E,labels:v,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:g})]})},E.id)}),w.length===0&&s.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:v.noInstallmentsFound})]})}),s.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",w.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:s.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-12"}),s.jsx("col",{}),s.jsx("col",{className:"w-24"}),s.jsx("col",{className:"w-36"}),s.jsx("col",{className:"w-36"}),s.jsx("col",{className:"w-44"})]}),s.jsx("thead",{children:s.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[s.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),s.jsx("th",{className:"px-2 py-3 font-medium",children:v.installmentId}),s.jsx("th",{className:"px-2 py-3 font-medium",children:v.amount}),s.jsx("th",{className:"px-2 py-3 font-medium",children:v.scheduledDate}),s.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:v.status}),s.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:v.actions})]})}),s.jsxs("tbody",{children:[w.map((E,I)=>{const M=E.status??"schedule";return s.jsxs("tr",{className:"text-zinc-500",children:[s.jsx("td",{className:"px-2 py-3",children:I+1}),s.jsx("td",{className:"overflow-hidden px-2 py-3",children:s.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${I+1}`})}),s.jsx("td",{className:"px-2 py-3",children:y.format(E.amount)}),s.jsx("td",{className:"px-2 py-3",children:Gt(E.dueDate,n)}),s.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:s.jsx(Ss,{status:M})}),s.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:s.jsx(As,{status:M,installment:E,labels:v,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:g})})]},E.id)}),w.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:v.noInstallmentsFound})})]})]})})]});return s.jsx("div",{ref:N,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:a?s.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:s.jsx(c.AccordionItem,{"aria-label":v.title,title:S,children:k},"installment-table")}):k})}function Ss({status:e}){return s.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",ks[e]??ks.schedule),startContent:s.jsx(sd,{status:e}),children:Gr[e]??e})}function As({status:e,installment:t,labels:n,portalContainer:r,showDelete:a,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e);return s.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?s.jsx(U,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:s.jsx(V,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(t),children:n.payNow}):null,s.jsx(nd,{isFulfilled:e==="paid",showDelete:a,labels:n,portalContainer:r,onDelete:()=>o(t.id)})]})}function nd({isFulfilled:e,showDelete:t,labels:n,portalContainer:r,onDelete:a}){const[i,l]=p.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[s.jsx(c.DropdownTrigger,{children:s.jsx(U,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:s.jsx(V,{icon:"solar:menu-dots-bold",className:"size-4"})})}),s.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&t&&!e&&l(!0)},children:[s.jsx(c.DropdownSection,{title:"Actions",showDivider:t,children:s.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:s.jsx(V,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),t?s.jsx(c.DropdownSection,{title:n.dangerZone,children:s.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:s.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),t?s.jsx(Ft,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:s.jsx(V,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:r,shouldBlockScroll:!1,classNames:Jc,onClose:()=>l(!1),onConfirm:()=>{l(!1),a()}}):null]})}function sd({status:e}){return e==="paid"?s.jsx(V,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?s.jsx(V,{icon:"solar:close-circle-bold",className:"size-3"}):s.jsx(V,{icon:"solar:calendar-outline",className:"size-3"})}function Gt(e,t){const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{month:"short",day:"numeric",year:"numeric"}).format(n)}const rd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},ad=({cards:e,locale:t,currency:n,listHeightClassName:r="",labels:a,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const g=Array.isArray(e)?e:[],[h,N]=p.useState(o),[v,b]=p.useState(l),j={...rd,...a};p.useEffect(()=>{N(o)},[o]);const y=w=>{if(w===h){d&&f?.(w);return}N(w),f?.(w)},S=w=>{b(w),u?.(w)};return s.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[s.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:h??""}),s.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:j.title}),i&&s.jsx(Xr,{title:j.renewalTitle,description:j.renewalDescription,value:v,onValueChange:S}),s.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",r===""?"flex-1":c.cn("shrink-0",r)),"data-testid":"membership-select-cards-list",children:g.map(w=>s.jsx(Kr,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:t,currency:n,isSelected:h===w.id,onSelect:y},w.id))})]})},Kr=({itemKey:e,name:t,type:n,price:r,locale:a="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:g,statusTone:h="default",className:N=""})=>{const v=new Intl.NumberFormat(a,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(r),b=!!d&&!f,j=m||g,y=()=>{b&&d?.(e)};return s.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:y,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",N),"data-testid":"item-card","data-selected":o,isDisabled:f,children:s.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[s.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[s.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:t}),n&&s.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:s.jsx("p",{className:"text-center",children:n})}),j&&s.jsx(c.Chip,{"data-testid":"item-card-status",color:h,size:"sm",variant:"flat",className:"px-2",children:j})]}),l&&s.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},$s="w-full bg-gray-100",Ds={variant:"light",color:"default"},Qr=({id:e,title:t,media:n,imageUrl:r,imageAlt:a,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:g=!1,isDisabled:h=!1,compact:N=!1,className:v="",bodyClassName:b="",footerClassName:j="",dataTestId:y})=>{const S=!!(d&&d.value),w=!!u?.label,k=g&&!!m&&!w,E=!k,I=w?{variant:u?.variant??Ds.variant,color:u?.color??Ds.color,size:u?.size??"sm",isDisabled:h||u?.isDisabled,startContent:u?.icon?s.jsx(V,{icon:u.icon,width:16}):void 0}:null,M=n??(r?s.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,$s,i),children:s.jsx(c.Image,{removeWrapper:!0,src:r,alt:a||t,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):s.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,$s,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:s.jsx(V,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return s.jsxs(c.Card,{"data-testid":y||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",v),isPressable:k,onPress:m,isDisabled:h,shadow:"sm",radius:"lg",children:[s.jsx("div",{children:M}),s.jsxs(c.CardBody,{className:c.cn("gap-3",N?"p-3":"p-4",b),children:[s.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",N?"text-sm":""),children:t}),o.length>0?s.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:o.map(($,_)=>s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(V,{icon:$.icon,className:"size-4 text-gray-400",width:16}),s.jsx("span",{children:$.label})]},`${$.label}-${_}`))}):null,(S||w)&&s.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",N?"pt-0.5":"",j),children:[S?s.jsxs("span",{className:c.cn("mr-auto text-gray-500",N?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&s.jsxs("span",{children:[d.label," "]}),s.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):s.jsx("span",{className:"ml-auto","aria-hidden":!0}),w&&E?s.jsx(U,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:I?.variant,color:I?.color,size:I?.size,startContent:I?.startContent,isDisabled:I?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?s.jsx("div",{className:"pt-1",children:f}):null]})]})};Qr.displayName="CatalogItemCard";const id={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},ld={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"},od={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"},cd={empty:"status",error:"alert",success:"status",loading:"status"},dd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function ud(e,t,n,r){if(t===!1)return null;if(e==="loading"&&t===void 0)return s.jsx(c.Spinner,{size:"lg",color:"primary",className:r.spinner});if(p.isValidElement(t))return s.jsx(s.Fragment,{children:t});const a=typeof t=="string"?t:id[e];return a?s.jsx(V,{icon:a,width:n,height:n,"aria-hidden":"true",className:r.icon}):null}function et({variant:e="empty",title:t,titleAs:n="p",description:r,icon:a,actions:i,role:l=cd[e],ariaLive:o=dd[e],iconSize:d=24,className:u,classNames:f={},"data-testid":m="feedback-state"}){const g=ud(e,a,d,f);return s.jsxs("div",{role:l,"aria-live":o,"data-variant":e,"data-testid":m,className:c.cn("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-12 text-center",ld[e],u,f.base),children:[g?s.jsx("span",{"aria-hidden":"true","data-testid":`${m}-icon`,className:c.cn("inline-flex size-12 items-center justify-center rounded-2xl",e==="success"&&"rounded-full",od[e],f.iconWrapper),children:g}):null,s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(n,{"data-testid":`${m}-title`,className:c.cn("text-base font-medium text-default-900",f.title),children:t}),r?s.jsx("p",{"data-testid":`${m}-description`,className:c.cn("max-w-sm text-sm text-default-600",f.description),children:r}):null]}),i?s.jsx("div",{"data-testid":`${m}-actions`,className:c.cn("mt-1 flex flex-wrap items-center justify-center gap-2",f.actions),children:i}):null]})}function Tn(e){return s.jsx(et,{...e,variant:"empty"})}function Ln(e){return s.jsx(et,{...e,variant:"error"})}function Pn(e){return s.jsx(et,{...e,variant:"loading"})}function Zr(e){return s.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Tn.displayName="EmptyState";Ln.displayName="ErrorState";Pn.displayName="LoadingState";Zr.displayName="SuccessState";const Xr=({title:e,value:t,description:n,onValueChange:r,className:a=""})=>{const i=p.useId();return s.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"justify-between gap-6":"justify-start",a),"data-testid":"toggle",children:[s.jsxs("div",{className:"flex flex-col items-start",children:[e&&s.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),n&&s.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),s.jsx(c.Switch,{id:i,isSelected:t,onValueChange:r,"data-testid":"toggle-switch"})]})},fd={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"},md=(e,t)=>new Intl.NumberFormat(e,{style:"currency",currency:t}),Jr=e=>Object.values(e).reduce((t,n)=>t+Object.values(n).reduce((r,a)=>r+Object.values(a).reduce((i,l)=>i+l.selectedQuantity,0),0),0),hd=e=>e.reduce((t,n)=>t+n.dates.reduce((r,a)=>r+a.tickets.reduce((i,l)=>i+l.max,0),0),0),On=e=>e.flatMap(t=>t.dates.flatMap(n=>n.tickets.map(r=>({exhibition:t,dateGroup:n,ticket:r})))),Es=(e,t,n)=>{const r={};let a=n?t??hd(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of On(e)){r[i.id]??={},r[i.id][l.id]??={};const d=n?Math.min(o.max,a):0;r[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},a-=d}return r},Fs=(e,t,n)=>`${e}::${t}::${n}`,xd=(e,t,n)=>{const r=Jr(t);for(const{exhibition:a,dateGroup:i,ticket:l}of On(e)){const o=t[a.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=n===void 0?l.max:Math.min(l.max,n-(r-o));if(d>0&&o<d)return!1}return!0},pd=({initialQuantity:e=1,minQuantity:t=1,maxQuantity:n=10,onChange:r,disabled:a=!1})=>{const i=Math.max(t,Math.min(n,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{a||i>=n||r?.(i+1)},g=()=>{a||i<=t||r?.(i-1)},h=w=>{if(a)return;o(w.target.value);const k=parseInt(w.target.value,10);isNaN(k)||r?.(Math.max(t,Math.min(n,k)))},N=w=>{const k=parseInt(w.target.value,10);if(u(!1),isNaN(k)){r?.(t);return}const E=Math.max(t,Math.min(n,k));E!==k?r?.(E):o(String(E))},v=i<=t,b=i>=n,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",y="bg-primary hover:bg-primary/80",S="bg-primary/40 cursor-not-allowed";return s.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[s.jsx("button",{type:"button",onClick:g,disabled:a||v,className:c.cn(j,a||v?S:y),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),s.jsx("input",{type:"number",value:f,onChange:h,onFocus:()=>u(!0),onBlur:N,disabled:a,min:t,max:n,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),s.jsx("button",{type:"button",onClick:m,disabled:a||b,className:c.cn(j,a||b?S:y),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},gd=({label:e,checked:t=!1,onChange:n,disabled:r=!1})=>{const a=()=>{r||n?.(!t)};return s.jsxs("button",{type:"button",onClick:a,disabled:r,role:"checkbox","aria-checked":t,"data-testid":"checkbox-button","data-checked":t,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",r&&"cursor-not-allowed opacity-60"),children:[s.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[s.jsx("input",{type:"checkbox",checked:t,onChange:()=>{},disabled:r,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),s.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",t?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:t&&s.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"})})]}),s.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},bd=({item:e,quantity:t,onChange:n,getTotalSelectedTickets:r,userMaxLimit:a,settings:i,labels:l})=>{const o=()=>{if(!r||a===void 0)return e.max;const m=r();return Math.min(e.max,a-(m-t))},d=i?.locale??"en-US",u=i?.currency??"USD",f=md(d,u);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[s.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[s.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?s.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),s.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?s.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:s.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,s.jsx("div",{className:"text-sm text-zinc-500",children:s.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[l.ticketsAllowedToRedeem," ",e.max]})})]}),s.jsx(pd,{initialQuantity:t,minQuantity:0,maxQuantity:o(),onChange:n})]}),e.membershipAlert?s.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:s.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]})},yd=({exhibitionId:e,dateGroup:t,isLast:n=!1,onQuantityChange:r,getTicketQuantity:a,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>s.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!n&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[s.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:t.date}),t.tickets.map((u,f)=>s.jsxs("div",{children:[s.jsx(bd,{item:u,quantity:a(e,t.id,u.id),onChange:m=>r(e,t.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<t.tickets.length-1?s.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),vd=({title:e,exhibition:t,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:a,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=t.dates.reduce((h,N)=>h+N.tickets.reduce((v,b)=>v+r(t.id,N.id,b.id),0),0),g=t.dates.some(h=>h.tickets.length>0);return s.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[s.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${t.id}`,"data-testid":"upgrade-ticket-header-button",children:s.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[s.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),s.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:s.jsx(V,{icon:"mdi:chevron-down"})})]})]})}),s.jsx("div",{id:`upgrade-items-${t.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&&s.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:g?t.dates.map((h,N)=>s.jsx(yd,{exhibitionId:t.id,dateGroup:h,isLast:N===t.dates.length-1,onQuantityChange:n,getTicketQuantity:r,getTotalSelectedTickets:a,userMaxLimit:i,settings:l,labels:o},h.id)):s.jsx("div",{className:"px-5 py-10 text-center",children:s.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},jd=({initialExpanded:e=!1,userMaxLimit:t,labels:n,settings:r,ticketSelectionData:a,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>a??[],[a]),d={...fd,...n},[u,f]=p.useState(()=>Es(o,t,!0)),m=p.useRef(!1),g=p.useMemo(()=>{const y=On(o).map(({exhibition:S,dateGroup:w,ticket:k})=>[Fs(S.id,w.id,k.id),k]);return new Map(y)},[o]),h=xd(o,u,t),N=(y,S,w)=>u[y]?.[S]?.[w]?.selectedQuantity??0,v=()=>Jr(u),b=(y,S,w,k)=>{const E=N(y,S,w),I=v()-E;if(t!==void 0&&I+k>t)return;const M=g.get(Fs(y,S,w));if(!M)return;const $={...u,[y]:{...u[y],[S]:{...u[y]?.[S],[w]:{id:w,selectedQuantity:k,originalPrice:M.originalPrice,discountedPrice:M.price}}}};f($),l?.($)},j=y=>{const S=Es(o,t,y);f(S),l?.(S)};return p.useEffect(()=>{!m.current&&h&&(l?.(u),m.current=!0)},[h,u,l]),s.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[s.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[s.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),s.jsx(gd,{label:d.selectAllButtonLabel,checked:h,onChange:j})]}),o.map(y=>s.jsx(vd,{title:y.exhibitionName,exhibition:y,onQuantityChange:b,getTicketQuantity:N,getTotalSelectedTickets:v,userMaxLimit:t,settings:r,labels:d,initialExpanded:e},y.id))]})},Kt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Qt=e=>{const t={};for(const n of e)n.type==="checkbox"?t[n.id]=[...n.selectedValues]:t[n.id]=n.selectedValue?[n.selectedValue]:[];return t},wd=(e,t)=>{const n={};for(const r of t){if(r.type==="checkbox"){n[r.id]=e[r.id]??[...r.selectedValues];continue}const a=e[r.id]??[];n[r.id]=a.length>0?a[0]:null}return n},Nd=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,ea=({triggerLabel:e,triggerAriaLabel:t,triggerIcon:n="solar:tuning-square-outline",triggerVariant:r="bordered",triggerColor:a="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:g,countAriaLabel:h,countDisplay:N="badge",confirmLabel:v=Kt.confirm,clearLabel:b=Kt.clear,isOpen:j,defaultOpen:y=!1,onOpenChange:S,isDisabled:w=!1,closeOnConfirm:k=!0,keepOpenAfterClear:E=!1})=>{const[I,M]=p.useState(y),[$,_]=p.useState(()=>Qt(u)),F=j??I,A=g??u.filter(B=>Nd(B)).length,T=B=>{B&&_(Qt(u)),j||M(B),S?.(B)},P=(B,Z)=>{_(Q=>({...Q,[B.id]:Z}))},K=(B,Z)=>{_(Q=>({...Q,[B.id]:Z?[Z]:[]}))},q=async()=>{_(Qt(u.map(B=>B.type==="checkbox"?{...B,selectedValues:[]}:{...B,selectedValue:null}))),await m(),E||T(!1)},W=async()=>{const B=wd($,u);await f(B),k&&T(!1)},ee=B=>{if(B.type==="checkbox")return s.jsx(c.CheckboxGroup,{label:B.label,value:$[B.id]??[],onValueChange:Q=>P(B,Q),children:B.options.map(Q=>s.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},B.id);const Z=$[B.id]?.[0]??"";return s.jsx(c.RadioGroup,{label:B.label,value:Z,onValueChange:Q=>K(B,Q||null),children:B.options.map(Q=>s.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},B.id)},re=p.useMemo(()=>A>0?h?.(A)||`${A} filters applied`:void 0,[h,A]),ae=p.useMemo(()=>A===0?e||Kt.noLabel:h?h(A):`${e} (${A})`,[A,e,h]);return s.jsx("div",{className:d,children:s.jsxs(c.Popover,{isOpen:F,onOpenChange:T,placement:"bottom-end",children:[s.jsx(c.PopoverTrigger,{children:s.jsxs(U,{isDisabled:w,variant:r,color:a,size:i,className:l,"aria-label":t,"aria-haspopup":"dialog","aria-expanded":F,children:[s.jsx(V,{icon:n,width:16}),s.jsx("span",{children:e}),N==="badge"&&A>0?s.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":re,children:A}):N==="summary"&&ae!==e?s.jsx("span",{className:"text-xs",children:ae}):null]})}),s.jsx(c.PopoverContent,{className:o,children:s.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(B=>ee(B)),s.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[s.jsx(U,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),s.jsx(U,{color:"primary",size:"sm",onPress:W,children:v})]})]})})]})})};ea.displayName="FilterPopover";const Cd="No sessions available for this date",kd=e=>e==="sold-out"||e==="closed"?"danger":"success",Sd=e=>{const t=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof t=="number"?`${t} left`:"Limited":typeof t=="number"?`${t} seats available`:"Available"},Is=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Ad=(e,t)=>t&&e.some(n=>n.date===t)?t:e[0]?.date??null,ta=({heading:e,subheading:t,days:n,selectedDate:r,onDateSelect:a,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=Cd,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:g,calendarSlot:h,dayGroupAriaLabel:N,sessionGridAriaLabel:v,className:b,headingClassName:j,subheadingClassName:y})=>{const S=Ad(n,r),w=n.find($=>$.date===S),k=i??n.map($=>({date:$.date,label:$.label})),E=w?.sessions??[],I=$=>$===S?"solid":"bordered",M=$=>{if(!Is($)){if($.id===l){o(null);return}o($.id)}};return s.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:[s.jsxs("header",{className:"flex flex-col gap-1",children:[s.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",j),children:e}),t?s.jsx("p",{className:c.cn("text-sm text-gray-700",y),children:t}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":N||"Session days",children:[k.map($=>s.jsx(U,{size:"sm",variant:I($.date),color:"default",className:c.cn("rounded-full",g),isDisabled:$.isDisabled,onPress:()=>{a($.date)},children:s.jsx("span",{children:$.label})},$.date)),h?s.jsx("div",{children:h}):null]}),s.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":v||"Sessions",children:[E.length===0?s.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,E.map($=>{const _=Is($),F=$.id===l;return s.jsx("li",{className:"rounded-xl",children:s.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{M($)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m($,{isSelected:F,isUnavailable:_}):_?`${$.startTime} ${$.endTime} sold out`:`${$.startTime} ${$.endTime} available`,children:s.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[s.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[$.startTime," – ",$.endTime]}),s.jsx(c.Chip,{size:"sm",color:f?f($):kd($.status),variant:"flat",children:u?u($):Sd($)})]})})},$.id)})]})]})};ta.displayName="SessionTimeline";const $d=(e,t)=>typeof e=="string"?s.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e||t||null,na=({title:e,subtitle:t,eyebrow:n,icon:r,initials:a,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header"})=>{const f=$d(r,a);return s.jsxs("header",{"data-testid":u,className:c.cn("flex flex-wrap items-start justify-between gap-4",o,d.base),children:[s.jsxs("div",{className:"flex items-center gap-4",children:[f?s.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,s.jsxs("div",{children:[n?s.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,s.jsx(l,{"data-testid":`${u}-title`,className:c.cn("text-3xl font-semibold text-gray-950",d.title),children:e}),t?s.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn("mt-1 text-sm text-gray-600",d.subtitle),children:t}):null]})]}),i?s.jsx("div",{"data-testid":`${u}-actions`,className:c.cn("flex flex-wrap items-center gap-2",d.actions),children:i}):null]})};na.displayName="PageHeader";const Dd={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},Ed={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"}},sa=({status:e,label:t,variant:n="flat",size:r="sm",color:a,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(n==="dot"){const d=Ed[e];return s.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:[s.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),t]})}return s.jsx(c.Chip,{color:a??Dd[e],variant:n,size:r,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),children:t})};sa.displayName="StatusChip";const Fd={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"},_n=({label:e,value:t,size:n="sm",className:r,"data-testid":a="key-value-chip"})=>s.jsxs("span",{"data-testid":a,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Fd[n],r),children:[s.jsx("span",{className:"font-medium text-default-400",children:e}),s.jsx("span",{className:"font-semibold text-default-700",children:t})]});_n.displayName="KeyValueChip";const ra=({columns:e,rows:t=6,label:n="Loading",barHeight:r=12,alignLastRight:a=!1,className:i,classNames:l={},"data-testid":o="table-skeleton"})=>s.jsxs("div",{role:"status","aria-busy":"true","data-testid":o,className:c.cn("w-full",i,l.base),children:[s.jsx("span",{className:"sr-only",children:n}),s.jsx("div",{"aria-hidden":"true",children:Array.from({length:t}).map((d,u)=>s.jsx("div",{"data-testid":`${o}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((f,m)=>{const g=m===e.length-1;return s.jsx("div",{className:c.cn(f==="fill"?"flex-1":"shrink-0",a&&g&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:s.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:r,width:f==="fill"?"60%":f}})},m)})},u))})]});ra.displayName="TableSkeleton";const aa="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",ia="px-4 text-[13.5px] text-acct-ink2 align-middle",la="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",oa="w-full",ca="border-t border-acct-border px-5 py-3.5",da=({columns:e,children:t,emptyContent:n,footer:r,ariaLabel:a,className:i,classNames:l={},"data-testid":o="admin-table"})=>s.jsxs("div",{className:c.cn(i,l.base),"data-testid":o,children:[s.jsxs(c.Table,{"aria-label":a,removeWrapper:!0,classNames:{table:c.cn(oa,l.table),th:c.cn(aa,l.th),tr:c.cn(la,l.tr),td:c.cn(ia,l.td)},children:[s.jsx(c.TableHeader,{columns:e,children:d=>s.jsx(c.TableColumn,{align:d.align==="right"?"end":"start",width:d.width,children:d.label},d.key)}),s.jsx(c.TableBody,{emptyContent:n,children:t})]}),r?s.jsx("div",{"data-testid":`${o}-footer`,className:c.cn(ca,l.footer),children:r}):null]});da.displayName="AdminTable";const Id={md:"w-[280px]",lg:"w-[360px]"},ua=({searchValue:e,onSearchChange:t,searchLabel:n,searchIcon:r,children:a,trailing:i,searchWidth:l="md",className:o,"data-testid":d="admin-toolbar"})=>s.jsxs("div",{role:"search","data-testid":d,className:c.cn("flex flex-wrap items-center gap-3 mb-4",o),children:[s.jsx(c.Input,{type:"search","aria-label":n,placeholder:n,value:e,onValueChange:t,startContent:r?s.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${d}-search`,variant:"bordered",radius:"none",classNames:{base:Id[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"}}),a,i?s.jsx("div",{className:"ml-auto",children:i}):null]});ua.displayName="AdminToolbar";function fa({items:e,value:t,onChange:n,ariaLabel:r,className:a,"data-testid":i="underline-tabs"}){return s.jsx(c.Tabs,{"aria-label":r,variant:"underlined",selectedKey:t,onSelectionChange:l=>n(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",a),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"},children:e.map(l=>s.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`},l.key))})}fa.displayName="UnderlineTabs";const ma="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",ha=["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(" "),xa="text-[13.5px] text-acct-ink",pa="bg-acct-page text-acct-muted cursor-default",ga="mt-[5px] text-xs text-acct-sub",ba="mt-[5px] text-xs text-acct-danger",ya=({label:e,value:t,onChange:n,placeholder:r,disabled:a=!1,readOnly:i=!1,mono:l=!1,autoFocus:o=!1,hint:d,invalid:u=!1,className:f,"data-testid":m="admin-text-field"})=>s.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e,value:t,placeholder:r,isDisabled:a,isReadOnly:i,autoFocus:o,isInvalid:u,description:!u&&d?d:void 0,errorMessage:u?d:void 0,onValueChange:n,"data-testid":m,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",f),label:ma,inputWrapper:ha,input:c.cn(xa,(l||i)&&"font-mono",i&&pa),description:ga,errorMessage:ba}});ya.displayName="AdminTextField";const Md={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},va=({actions:e,size:t="md",className:n,"data-testid":r="row-actions"})=>s.jsx("div",{role:"presentation","data-testid":r,className:c.cn("inline-flex gap-0.5",n),onClick:a=>a.stopPropagation(),children:e.map(a=>s.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a.onPress,isDisabled:a.disabled,"aria-label":a.label,title:a.label,"data-testid":`${r}-${a.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Md[t]),children:a.icon},a.key))});va.displayName="RowActions";const ja=({children:e,placeholder:t="Select…",onOpen:n,onClear:r,ariaLabel:a,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return s.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[s.jsxs(U,{variant:"light",radius:"none",disableAnimation:!0,onPress:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":a,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?s.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?s.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):s.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:t}),l?s.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&r?s.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r,isDisabled:d,"aria-label":`Clear ${a}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};ja.displayName="PickerRow";function wa(e,t,n){if(n<=0||t<=0||e<=0)return{from:0,to:0};const r=(e-1)*t+1;return r>n?{from:0,to:0}:{from:r,to:Math.min(n,e*t)}}const Na=({page:e,pageSize:t,total:n,unit:r,announce:a=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=wa(e,t,n),f=c.cn("font-semibold text-default-700",l.emphasis);return s.jsxs("p",{"data-testid":o,"aria-live":a?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",s.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",s.jsx("span",{"data-testid":`${o}-total`,className:f,children:n}),r?s.jsxs(s.Fragment,{children:[" ",r]}):null]})};Na.displayName="PaginationSummary";const Ca=({isLoading:e=!1,isError:t=!1,isEmpty:n=!1,loadingTitle:r="Loading…",loadingContent:a,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:g,emptyIcon:h,emptyActions:N,emptyContent:v,children:b,className:j,classNames:y={},"data-testid":S="list-panel"})=>{const w={base:c.cn("border-0 bg-transparent py-12",y.state)};let k;return e?k=a??s.jsx(Pn,{title:r,classNames:w,"data-testid":`${S}-loading`}):t?k=f??s.jsx(Ln,{title:i,description:l,classNames:w,"data-testid":`${S}-error`,actions:u??(d?s.jsx(U,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):n?k=v??s.jsx(Tn,{title:m,description:g,icon:h,actions:N,classNames:w,"data-testid":`${S}-empty`}):k=b,s.jsx("section",{"data-testid":S,className:c.cn("rounded-xl bg-white p-2 shadow-sm",j,y.base),children:k})};Ca.displayName="ListPanel";const Td=350,Ld={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}"},Zt=(e,t)=>Object.entries(t).reduce((n,[r,a])=>n.replace(`{${r}}`,a),e),Pd=({dueAmount:e,received:t,defaultReceived:n=null,onChange:r,locale:a="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...Ld,...i},g=kn(e.currency,a),h=t!==void 0,[N,v]=p.useState(n??null),b=h?t:N,j=p.useMemo(()=>{const T=typeof b=="number"&&Number.isFinite(b)?b:0,P=an(T,e.value,e.currency,a);return{received:T,change:P>0?P:0,isValid:T>=e.value&&T>0}},[b,e.value,e.currency,a]),y=p.useCallback(T=>{const P=T.currentTarget;requestAnimationFrame(()=>{P.isConnected&&P.select()})},[]),S=p.useCallback(T=>{if(l)return;const P=T.replace(/[^\d.,]/g,"").replace(",","."),K=P===""?null:Number.parseFloat(P),q=K===null||Number.isNaN(K)?null:K;if(q!==null&&o!==void 0&&q>o)return;h||v(q);const W=typeof q=="number"&&Number.isFinite(q)?q:0,ee=an(W,e.value,e.currency,a);r?.({received:W,change:ee>0?ee:0,isValid:W>=e.value&&W>0})},[h,l,e.value,e.currency,a,r,o]),w=b==null?"":String(b),k=j.isValid&&j.change>0,E=!j.isValid&&j.received>0,I=Re(j.change,a,e.currency),M=Re(e.value,a,e.currency),[$,_]=p.useState(""),F=p.useRef(null);p.useEffect(()=>{F.current&&clearTimeout(F.current);const T=k?Zt(m.changeMessageTemplate,{change:I}):"",P=k?Td:0;return F.current=setTimeout(()=>_(T),P),()=>{F.current&&clearTimeout(F.current)}},[k,I,m.changeMessageTemplate]);const A=`${f}-received`;return s.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[s.jsx(c.Input,{id:A,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:T=>S(T.target.value),onFocus:y,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:E,errorMessage:E?Zt(m.insufficientMessageTemplate,{due:M}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),k&&s.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:Zt(m.changeMessageTemplate,{change:I}),icon:s.jsx(V,{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"}}),s.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},Od={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Ms=()=>{const e=new Date,t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},ka=({dueAmount:e,value:t,defaultValue:n,onChange:r,labels:a,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":g="check-tender-form"})=>{const h={...Od,...a},N=t!==void 0,[v,b]=p.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Ms()}),[j,y]=p.useState(!!n?.checkNumber),S=p.useMemo(()=>N?{checkNumber:t?.checkNumber??"",bankName:t?.bankName??"",date:t?.date??Ms()}:v,[N,t,v]),w=p.useCallback(F=>{N||b(F);const A=F.checkNumber.trim(),T={amount:e.value,checkNumber:A,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:A.length>0&&e.value>0};r?.(T)},[N,e.value,i,r]),k=p.useCallback(F=>A=>{o||(F==="checkNumber"&&A.length>0&&y(!0),w({...S,[F]:A}))},[S,w,o]),E=p.useCallback(()=>{o||y(!0)},[o]),I=j&&S.checkNumber.trim()==="",M=`${g}-check-number`,$=`${g}-bank-name`,_=`${g}-date`;return s.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":g,children:[s.jsx(c.Input,{id:M,label:h.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:F=>k("checkNumber")(F.target.value),onBlur:E,placeholder:h.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:I,errorMessage:I?h.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${g}-check-number-input`}),!l&&s.jsx(c.Input,{id:$,label:h.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:F=>k("bankName")(F.target.value),placeholder:h.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${g}-bank-name-input`}),!i&&s.jsx(c.Input,{id:_,label:h.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:F=>k("date")(F.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${g}-date-input`,className:"sm:col-span-2"})]})};ka.displayName="CheckTenderForm";const _d={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},zd=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Sa=({dueAmount:e,methodOptions:t=zd,value:n,defaultValue:r,onChange:a,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={..._d,...i},m=n!==void 0,[g,h]=p.useState({method:r?.method??"",reference:r?.reference??""}),N=p.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:g,[m,n,g]),v=p.useCallback(k=>t.find(E=>E.value===k)?.label??"",[t]),b=p.useCallback(k=>{m||h(k);const E=v(k.method),I={amount:e.value,method:k.method,description:E,reference:k.reference.trim()||void 0,isValid:k.method!==""};a?.(I)},[m,e.value,a,v]),j=p.useCallback(k=>{if(o)return;const E=typeof k=="string"?k:Array.from(k)[0]?.toString()??"";b({...N,method:E})},[N,b,o]),y=p.useCallback(k=>{o||b({...N,reference:k})},[N,b,o]),S=`${u}-method`,w=`${u}-reference`;return s.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[s.jsx(ze,{id:S,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:N.method?[N.method]:[],onSelectionChange:j,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:t.map(k=>s.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${k.value}`,children:k.label},k.value))}),l&&s.jsx(c.Input,{id:w,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:N.reference,onChange:k=>y(k.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Sa.displayName="OtherTenderForm";const Rd={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Bd={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Vd={pending:"warning",recorded:"success",failed:"danger"},Ud=e=>e==="pending"||e==="recorded",Hd=e=>`#${e+1}`,Aa=({total:e,tenders:t,onRemove:n,locale:r="en-US",labels:a,hideCollectedList:i=!1,className:l,"data-testid":o="split-payment-summary"})=>{const d={...Rd,...a},{collected:u,remaining:f,isComplete:m}=p.useMemo(()=>{const h=t.reduce((v,b)=>Ud(b.status)?v+b.amount:v,0),N=Math.max(e.value-h,0);return{collected:h,remaining:N,isComplete:h>=e.value&&e.value>0}},[t,e.value]),g=h=>h==="pending"?d.statusPending:h==="recorded"?d.statusRecorded:d.statusFailed;return s.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":o,children:[s.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${o}-remaining-banner`,children:[s.jsx("div",{className:"text-sm text-default-600",children:m?d.completeLabel:d.remainingLabel}),s.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${o}-remaining-amount`,children:Re(m?u:f,r,e.currency)})]}),!i&&t.length>0&&s.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${o}-collected-list`,children:[s.jsx("h3",{className:"text-base font-semibold",children:d.collectedHeading}),t.map((h,N)=>s.jsx(qd,{index:N,tender:h,locale:r,currency:e.currency,removable:!!n&&h.status!=="recorded",onRemove:n?()=>n(h.id):void 0,statusLabel:g(h.status),removeAriaLabel:d.removeAriaLabel,recordedTooltip:d.removeTooltipForRecorded,dataTestId:`${o}-row-${N}`},h.id))]})]})};Aa.displayName="SplitPaymentSummary";const qd=({index:e,tender:t,locale:n,currency:r,removable:a,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?s.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!a,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(a?"text-default-700 hover:bg-default-200":"text-default-300"),children:s.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return s.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:[s.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:Hd(e)}),s.jsx(V,{icon:Bd[t.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:t.label}),s.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:Re(t.amount,n,r)}),s.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Vd[t.status],startContent:t.status==="recorded"?s.jsx(V,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):t.status==="failed"?s.jsx(V,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(a?f:s.jsx(c.Tooltip,{content:d,placement:"left",children:s.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},Wd=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(d.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(R,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(K.ZoomIn,{size:16})})})]})}function Do({editor:e,isDisabled:n=!1}){const[s,a]=x.useState(!1),[r,i]=x.useState(""),[o,l]=x.useState(""),[c,u]=x.useState(!1),f=e.isActive("link"),h=m=>{if(m){const{from:v,to:j}=e.state.selection,b=e.isActive("link");let w="";if(b){const S=e.schema.marks.link,N=e.state.doc.resolve(v),k=Zn.getMarkRange(N,S);k&&(w=e.state.doc.textBetween(k.from,k.to,""))}else w=e.state.doc.textBetween(v,j,"");const y=e.getAttributes("link").href||"";i(w),l(y),u(b)}a(m)},g=()=>{if(o.trim()){const{from:m,to:v}=e.state.selection,j=e.schema.marks.link,b=e.state.doc.resolve(m),w=Zn.getMarkRange(b,j),y=w?.from??m,S=w?.to??v,N=e.state.doc.textBetween(y,S,"");r.trim()&&r!==N?e.chain().focus().setTextSelection({from:y,to:S}).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(d.Popover,{isOpen:s,onOpenChange:h,placement:"bottom",children:[t.jsx(d.PopoverTrigger,{children:t.jsx(R,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(K.Link,{size:16})})}),t.jsx(d.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(d.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(d.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:m=>l(m.target.value),onKeyDown:m=>m.key==="Enter"&&g(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(R,{size:"sm",color:"primary",onPress:g,isDisabled:!o.trim(),children:c?"Update":"Apply"})]})})]})}function Eo({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(d.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 Ca(e,n){const s=x.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(l=>ut(l)))).forEach(l=>{const c=Le[l];if(c)try{const u=c.canExecute?.(e)??!0,f=c.isActive?.(e)??!1;i[l]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=x.useState(s);return x.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(n.map(c=>ut(c)))).forEach(c=>{const u=Le[c];if(u)try{const f=u.canExecute?.(e)??!0,h=u.isActive?.(e)??!1;o[c]={isActive:h,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${c}`,f),o[c]={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 ka(e,n){const s=x.useCallback((o,l)=>{if(!e)return;const c=Le[o];if(c)try{c.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=x.useCallback(o=>{s(o)},[s]),r=x.useCallback((o,l)=>{if(!e)return!1;const c=Le[o];try{return c?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=x.useCallback((o,l)=>{if(!e)return!1;const c=Le[o];try{return c?.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 Fo(e=pe.default){const[n,s]=x.useState(e),a=x.useCallback((l=pe.step)=>{s(c=>Math.min(pe.max,c+l))},[]),r=x.useCallback((l=pe.step)=>{s(c=>Math.max(pe.min,c-l))},[]),i=x.useCallback(()=>{s(pe.default)},[]),o=x.useCallback(l=>{const c=Math.max(pe.min,Math.min(pe.max,l));s(c)},[]);return{zoom:n,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=pe.min,isMaxZoom:n>=pe.max,isDefaultZoom:n===pe.default}}const Mo=["bold","italic","strike","underline","code"];function Lo({editor:e,modifiers:n,onToolbarAction:s}){const a=Ca(e,n),{toggleModifier:r}=ka(e,s);if(!e)return null;const i=n.map(o=>ut(o)).filter(o=>Mo.includes(o));return i.length===0?null:t.jsx(Eo,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],c=Qe(o);return t.jsx(qe,{icon:c,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function Io({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Ca(e,n),{toggleModifier:c,executeCommand:u}=ka(e,o);if(!e)return null;const f=n.map(M=>ut(M)),h=f.some(M=>["bold","italic","strike","underline","code"].includes(M)),g=f.some(M=>["textColor","highlight"].includes(M)),m=f.includes("heading"),v=f.includes("textAlign"),j=f.some(M=>["bulletList","orderedList","taskList"].includes(M)),b=f.includes("blockquote"),w=f.includes("codeBlock"),y=f.includes("link"),S=f.includes("horizontalRule"),N=f.some(M=>["undo","redo"].includes(M)),k=s!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[h&&t.jsxs(t.Fragment,{children:[t.jsx(Lo,{editor:e,modifiers:n,onToolbarAction:o}),(g||m||v||j||b||w||y||S||N||k)&&t.jsx(He,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(gs,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(gs,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(m||v||j||b||w||y||S||N||k)&&t.jsx(He,{})]}),m&&t.jsxs(t.Fragment,{children:[t.jsx(vo,{editor:e}),(v||j||b||w||y||S||N||k)&&t.jsx(He,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(M=>{const L=So[M],A=e.isActive({textAlign:M});return t.jsx(qe,{icon:L,label:`Align ${M}`,isActive:A,onClick:()=>u("textAlign",{type:"textAlign",alignment:M})},M)})}),(j||b||w||y||S||N||k)&&t.jsx(He,{})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(jo,{editor:e,types:f.filter(M=>["bulletList","orderedList","taskList"].includes(M))}),(b||w||y||S||N||k)&&t.jsx(He,{})]}),(b||w||y||S)&&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:()=>c("blockquote")}),w&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>c("codeBlock")}),y&&t.jsx(Do,{editor:e,isDisabled:l.link?.isDisabled}),S&&t.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>c("horizontalRule")})]}),(N||k)&&t.jsx(He,{})]}),N&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>c("undo")}),f.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>c("redo")})]}),k&&t.jsx(He,{})]}),k&&t.jsx(Ao,{zoom:s,onZoomChange:M=>{a?.(M),o?.({type:"zoom",modifier:`${M}%`})}})]})})}const st={bold:{category:"mark",extension:li.Bold,priority:100},italic:{category:"mark",extension:oi.Italic,priority:100},strike:{category:"mark",extension:ci.Strike,priority:100},underline:{category:"mark",extension:di.Underline,priority:100},code:{category:"mark",extension:ui.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:hi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:pi.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:bi.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:yi.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:Ni.CodeBlock,priority:100},blockquote:{category:"node",extension:Ci.Blockquote,priority:100},horizontalRule:{category:"node",extension:ki.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Si.HardBreak,priority:100},undo:{category:"extension",extension:Xn.History,priority:50},redo:{category:"extension",extension:Xn.History,priority:50},textAlign:{category:"extension",extension:$i.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}},To=[Ai.Document,Di.Text,gi.Paragraph,xi.TextStyle.configure({HTMLAttributes:{}}),wi.ListItem.configure({HTMLAttributes:{}}),ji.TaskItem.configure({nested:!0}),Ei.Dropcursor,Fi.Gapcursor];function Po(e){const n=[],s=new Set,a=new Set;To.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 c=st[l];c?.requiredExtensions&&c.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c||c.extension===null)return;const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;n.push(f),s.add(l),a.add(u)}),r.forEach(l=>{if(s.has(l))return;const c=st[l];if(!c){console.warn(`Extension config not found for modifier: ${l}`);return}if(c.extension===null){s.add(l);return}const u=c.extension.name;if(a.has(u)){s.add(l);return}const f=c.defaultOptions?c.extension.configure(c.defaultOptions):c.extension;n.push(f),s.add(l),a.add(u)}),n.sort((l,c)=>{const u=Object.values(st).find(m=>m?.extension?.name===l.name),f=Object.values(st).find(m=>m?.extension?.name===c.name),h=u?.priority??100;return(f?.priority??100)-h})}const Sa={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"]},_o={h1:`font-size: ${ce.fontSize["4xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h2:`font-size: ${ce.fontSize["2xl"]}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h3:`font-size: ${ce.fontSize.xl}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h4:`font-size: ${ce.fontSize.lg}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h5:`font-size: ${ce.fontSize.base}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,h6:`font-size: ${ce.fontSize.sm}; font-weight: ${ce.fontWeight.semibold}; line-height: ${ce.lineHeight.tight}; margin: ${le.md} 0 ${le.sm} 0;`,p:`min-height: ${ce.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${le.xl}; margin: ${le.md} 0;`,li:`display: list-item; margin: ${le.xs} 0;`,strong:`font-weight: ${ce.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ce.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ce.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${le.sm}; color: ${ge.neutral.gray[100]}; font-family: ${ce.fontFamily.mono}; margin: ${le.lg} 0; padding: 0.75rem ${le.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${le.lg} 0; padding-left: ${le.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${le.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.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;"},Oo={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 Ro(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(Oo)){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(_o)){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 zo=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=hn.useCurrentEditor();return t.jsx(Io,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},Bo=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=hn.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"]})]})},on=x.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:c=Sa.full,variant:u="bordered",initialContent:f,content:h,onContentChange:g,onUpdate:m,onToolbarAction:v,isReadOnly:j=!1,isDisabled:b=!1,includeInlineStyles:w=!0,...y}=e,{zoom:S,setZoom:N}=Fo(),k=ps.lineHeight,E=s*k,M=r?void 0:a*k,L=x.useMemo(()=>Po(c),[c]),{Component:A,label:O,shouldLabelBeOutside:F,getBaseProps:$,getLabelProps:I,getInputWrapperProps:P}=d.useInput({...y,variant:u,ref:n,isMultiline:!0}),G=O?t.jsx("label",{...I(),children:O}):null,q=x.useCallback(({editor:W})=>{const ee=W.getHTML(),ae=w?Ro(ee):ee,re=W.getJSON(),U=W.getText(),Z=U.length,Q=U.split(/\s+/).filter(X=>X.length>0).length,H={html:ae,json:re,text:U,characters:Z,words:Q};if(g?.(H),m?.(H),"onChange"in y&&typeof y.onChange=="function"){const X={target:{value:ae},currentTarget:{value:ae}};y.onChange(X)}},[g,m,y,w]);return t.jsxs(A,{...$(),children:[F?G:null,t.jsx("div",{...P(),className:d.cn(P().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:M?`${M+ps.toolbarHeight}px`:void 0,overflow:M?"auto":void 0},children:t.jsx(hn.EditorProvider,{editable:!j&&!b,slotBefore:l?t.jsx(zo,{modifiers:c,zoom:S,onZoomChange:N,onToolbarAction:v}):void 0,slotAfter:t.jsx(Bo,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${S}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:h||f||e.defaultValue||"",onUpdate:q})})]})});on.displayName="TipTapEditor";const $a=x.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(on,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(on,{...r,variant:a,ref:n}))});$a.displayName="RichTextArea";function Vo(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 bs=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],Uo={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Aa=({presetAmounts:e=bs,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:c=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:h=2,desktopColumns:g=3,isDisabled:m=!1,buttonVariant:v="bordered",buttonColor:j="default",inputVariant:b="bordered",size:w="md",className:y="",showCard:S=!0})=>{const N={...Uo,...f},k=Array.isArray(e)?e:bs,E={2:"grid-cols-2",3:"grid-cols-3"},M={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},L=`${E[h]} ${M[g]}`,[A,O]=kn(n,s,a),[F,$]=x.useState(""),[I,P]=x.useState(!1),[G,q]=x.useState(0),W=x.useCallback(Z=>{if(m)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};O(Q),$(""),P(!1),q(H=>H+1),r?.(Q)},[m,O,r]),ee=x.useCallback(Z=>{if(m)return;if($(Z!==void 0?String(Z):""),r){O(null);return}if(Z===void 0||isNaN(Z)){O(null);return}O({amount:Z,isCustom:!0})},[m,O,r]),ae=x.useCallback(()=>{if(m)return;const Z=F!==""?parseFloat(F):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[m,F,r]),re=x.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),U=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[N.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:N.title}),k.length>0&&t.jsx("div",{className:d.cn("grid gap-3",L),"data-testid":"donation-amounts-presets",children:k.map(Z=>{const Q=A!==null&&!A.isCustom&&A.presetId===Z.id;return t.jsx(R,{color:Q?"primary":j,variant:Q?"solid":v,className:"w-full",onPress:()=>W(Z),isDisabled:m,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||Vo(Z.amount,o,i)},Z.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(d.NumberInput,{placeholder:N.customAmountPlaceholder,"aria-label":N.customAmountAriaLabel,onInput:r?()=>{O(null),P(!0)}:void 0,variant:b,radius:"full",size:w,minValue:c,maxValue:u,step:.01,formatOptions:re,value:F!==""?parseFloat(F):void 0,onValueChange:ee,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-${G}`:A?.isCustom===!1?A.presetId:"custom"),r&&t.jsx(R,{color:"primary",variant:"solid",radius:"full",size:w,className:"shrink-0",onPress:ae,isDisabled:m||!I,"data-testid":"donation-amounts-add-button",children:N.addDonationButton})]})]});return S?t.jsx(d.Card,{className:d.cn("w-full",y),"data-testid":"donation-amounts-card",children:t.jsx(d.CardBody,{children:U})}):t.jsx("div",{className:d.cn("w-full",y),"data-testid":"donation-amounts-plain",children:U})};Aa.displayName="DonationAmounts";const Ho=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`},qo=e=>{switch(e){case"warning":return K.Clock;case"error":return K.AlertCircle;case"success":return K.CheckCircle;default:return K.Clock}},Wo=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"}},Da=x.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:c,position:u="fixed",autoStart:f=!0,formatTime:h=Ho,className:g,...m},v)=>{const[j,b]=kn(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),w=x.useRef(null),y=x.useRef(!1);x.useEffect(()=>()=>{w.current&&clearInterval(w.current)},[]),x.useEffect(()=>{if(!f||j<=0){w.current&&(clearInterval(w.current),w.current=null);return}return w.current=setInterval(()=>{b(E=>E<=1?(w.current&&(clearInterval(w.current),w.current=null),y.current||(y.current=!0,a?.()),0):E-1)},1e3),()=>{w.current&&(clearInterval(w.current),w.current=null)}},[f,j,b,a]),x.useEffect(()=>{j>0&&(y.current=!1)},[j]);const S=c||qo(r),N=Wo(i),k={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:v,role:"banner","aria-live":"polite","aria-label":`${o} ${h(j)}`,"data-testid":"expire-cart-timer",className:d.cn("w-full text-white z-50",N,k[u],g),...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:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(S,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children: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: ${h(j)}`,"data-testid":"expire-cart-timer-value",children:h(j)})})]})})})});Da.displayName="ExpireCartTimer";const qt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(V,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),Yo=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:c=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:h})=>{const[g,m]=x.useState(!1),[v,j]=x.useState(!1),b=x.useRef(null);return x.useEffect(()=>{const w=()=>{if(b.current){const y=b.current.scrollHeight>b.current.clientHeight;j(y)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[o]),t.jsxs(d.Card,{className:d.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(d.CardHeader,{className:d.cn("pt-2 pb-0 flex-col items-start",c?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&s&&t.jsx("div",{className:d.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(d.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:d.cn("font-semibold text-gray-800",c?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(d.CardBody,{className:d.cn("space-y-3",c?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:d.cn("font-semibold text-base text-gray-700",c?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(qt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(qt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(qt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),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:d.cn("text-sm text-gray-700 leading-relaxed transition-all",c?"text-xs":"",!g&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!g&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||g)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(R,{onPress:()=>m(!g),variant:"light",className:d.cn("text-primary",f),size:c?"sm":"md",startContent:t.jsx(V,{icon:g?"solar:eye-closed-linear":"solar:eye-linear",width:c?16:20}),"data-testid":"event-details-toggle-description",children:g?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function cn(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 Ko(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 Go={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"},Ke=e=>typeof e=="number"&&!isNaN(e),Nt=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:c=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:h=!0,showDescription:g=!0,showPeopleCount:m=!0,showPrice:v=!0,priceDisplay:j,classNames:b={},"data-testid":w,selectedColor:y="default",compact:S=!1,isSoldOut:N,isMaxReached:k,isRuleBlocked:E,statusTone:M="default",statusLabel:L,disabledReason:A,disabled:O})=>{const F=x.useMemo(()=>({...Go,...o}),[o]),[$,I]=x.useState(s),P=n!==void 0?n:$,G=!!(c||O),q=S||!!e.compact,W=x.useMemo(()=>typeof N=="boolean"?N:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ke(e.totalTicketsSold)||!Ke(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[N,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),ee=x.useMemo(()=>typeof k=="boolean"?k:typeof e.isMaxReached=="boolean"?e.isMaxReached:W||!Ke(e.ticketsAllowed)?!1:P>=e.ticketsAllowed-(e.totalTicketsSold??0),[k,e.isMaxReached,W,e.ticketsAllowed,e.totalTicketsSold,P]),ae=x.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),re=A||e.disabledReason,U=G||W||ae,Z=te=>{if(U||te>0&&ee)return;const me=Math.max(0,P+te);n===void 0&&I(me),a?.(e.id,me)},Q=x.useMemo(()=>{if(W)return"soldOut";if(ae)return"ruleBlocked";if(G)return"disabled"},[W,ae,G]),H=x.useMemo(()=>M||(W||ae?"danger":ee?"warning":"default"),[M,W,ae,ee]),X=x.useMemo(()=>{if(Q)return Q==="ruleBlocked"?L||re||F.ruleBlocked:Q==="soldOut"?L||re||F.soldOut:Q==="disabled"?L||re||F.disabled:L||F.maxReached},[Q,L,re,F]),J={soldOut:"danger",ruleBlocked:H,disabled:"default",maxReached:"warning"},Ce={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},be=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:d.cn("text-base font-medium",q&&"text-sm",b.name),children:e.name}),he=()=>{if(!v)return null;const te=j?.price??e.price,me=j?.originalPrice,Fe=cn(te,i,r);if(l?.renderPrice)return l.renderPrice(te,Fe,e);if(Ke(me)&&Ke(te)&&me>te){const xe=cn(me,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:d.cn("flex items-center gap-2 mt-1",q&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",xe,", discounted price ",Fe]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:d.cn("text-gray-400 line-through text-sm",q&&"text-xs",b.originalPrice),children:xe}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:d.cn("text-primary text-base font-semibold",q&&"text-sm",b.discountedPrice),children:Fe})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:d.cn("text-primary text-base mt-1",q&&"text-sm mt-0.5",b.price),children:Fe})},Be=()=>!g||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:d.cn("mb-4 text-sm text-gray-700 leading-relaxed",q&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Te=()=>{if(!m||!Ke(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?F.person:F.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,te,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:d.cn("text-sm text-gray-600 flex items-center mt-2",q&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(V,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Pe=()=>{const te=P===0||U,me=ee||U;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:P,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:me,isDisabled:U}):t.jsxs("div",{className:d.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(R,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(V,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:d.cn("min-w-[2rem] text-center font-medium",q&&"text-sm"),children:P}),t.jsx(R,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:me,variant:u,color:P>0?y:f,radius:"full",isIconOnly:!0,size:q?"md":"sm","aria-label":"Increase quantity",children:t.jsx(V,{icon:"gravity-ui:plus",width:16})})]})},_e=(te,me)=>l?.renderDisabledState?l.renderDisabledState(te,me):te==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(me):te==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(me):t.jsx(d.Chip,{"data-testid":Ce[te],color:J[te],variant:te==="maxReached"?"flat":"solid",className:d.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&b.soldOut,te==="maxReached"&&b.maxReachedAlert,q&&"h-8"),startContent:t.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:me})}),Ve=t.jsxs("div",{className:d.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",q?"gap-1":"gap-2"),children:[t.jsxs("div",{className:d.cn("h-full col-span-2",U||ee?"opacity-50 pointer-events-none select-none":""),children:[be(),he(),t.jsxs("div",{className:d.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",q?"mb-1":"mb-2"),children:[Te(),Be()]})]}),t.jsx("div",{className:d.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",q&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:Q&&X?_e(Q,X):Pe()})]}),Ee=ee&&!W&&!ae&&!G?t.jsx($e.motion.div,{className:d.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:_e("maxReached",X||F.maxReached)}):null;return h?t.jsxs(d.Card,{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx(d.CardBody,{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),t.jsx($e.AnimatePresence,{children:Ee&&t.jsx(d.CardFooter,{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]}):t.jsxs("div",{className:d.cn("w-full",q&&b.compact,b.base),"data-testid":w||`offer-card-${e.id}`,children:[t.jsx("div",{className:d.cn("pt-1 pb-0",q?"pb-0.5":"",b.body),children:Ve}),t.jsx($e.AnimatePresence,{children:Ee&&t.jsx("div",{className:d.cn("w-full mt-0 pt-0",q?"pt-1":"",b.footer),children:Ee})})]})};Nt.displayName="OfferCard";const Ea=({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(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:t.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:d.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(V,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:d.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:d.cn("text-lg",r.message),children:e})]});return a?t.jsx(d.Card,{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:t.jsx(d.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:d.cn("w-full",r.base),children:o})};Ea.displayName="OfferCardEmpty";const Qo={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Fa=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...Qo,...n},o=t.jsx(d.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(d.Card,{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:t.jsx(d.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:d.cn("w-full",r.base),children:o})};Fa.displayName="OfferCardError";const Zo={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ma=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=Zo[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:d.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(d.Card,{"data-testid":`offer-card-skeleton-${i}`,className:d.cn("w-full",s.card),children:[t.jsx(d.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(d.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(d.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(d.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(d.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(d.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(d.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(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(d.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ma.displayName="OfferCardSkeleton";const La={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ia={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"}}},Xo={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ta=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:c,slots:u,isDisabled:f=!1,buttonVariant:h="bordered",buttonColor:g="default",showCard:m=!0,animated:v=!0,gap:j=2,compact:b=!1,classNames:w={}})=>{const[y,S]=x.useState(a),N=s!==void 0?s:y,k=x.useCallback((F,$)=>{const I={...N,[F]:Math.max(0,$)};s===void 0&&S(I),r?.(I),i?.(F,I[F])},[N,s,r,i]),E=[...e].sort((F,$)=>(F.position??0)-($.position??0)),M=F=>{const $=n?n(F):F,I=(N??{})[$.id]||0;return{offer:$,quantity:I,onQuantityChange:k,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b}},L=Xo[j],A=d.cn("grid mx-auto pt-2",L,w.base),O=F=>{const $=M(F);return t.jsx(Nt,{offer:$.offer,quantity:$.quantity,onQuantityChange:$.onQuantityChange,currency:$.currency,locale:$.locale,labels:$.labels,slots:$.slots,isDisabled:$.isDisabled,buttonVariant:$.buttonVariant,buttonColor:$.buttonColor,showCard:$.showCard,compact:$.compact,classNames:w.card},$.offer.id)};return v?t.jsx($e.motion.div,{"data-testid":"offer-card-list",className:A,variants:La,initial:"hidden",animate:"show",children:t.jsx($e.AnimatePresence,{children:E.map(F=>{const $=M(F);return t.jsx($e.motion.div,{"data-testid":`offer-card-list-item-${$.offer.id}`,className:w.cardWrapper,variants:Ia,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Nt,{offer:$.offer,quantity:$.quantity,onQuantityChange:k,currency:o,locale:l,labels:c,slots:u,isDisabled:f,buttonVariant:h,buttonColor:g,showCard:m,compact:b||$.offer.compact,classNames:w.card})},$.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:A,children:E.map(O)})};Ta.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,Ne=e=>e==null;const Pa=e=>typeof e=="object";var fe=e=>!Ne(e)&&!Array.isArray(e)&&Pa(e)&&!We(e),_a=e=>fe(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,Jo=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Oa=(e,n)=>e.has(Jo(n)),ec=e=>{const n=e.constructor&&e.constructor.prototype;return fe(n)&&n.hasOwnProperty("isPrototypeOf")},An=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function de(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(An&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(fe(e)&&ec(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=de(e[r]));return a}var Ft=e=>/^\w*$/.test(e),oe=e=>e===void 0,Dn=e=>Array.isArray(e)?e.filter(Boolean):[],En=e=>Dn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,n,s)=>{if(!n||!fe(e))return s;const a=(Ft(n)?[n]:En(n)).reduce((r,i)=>Ne(r)?r:r[i],e);return oe(a)||a===e?oe(e[n])?s:e[n]:a},ke=e=>typeof e=="boolean",je=e=>typeof e=="function",ie=(e,n,s)=>{let a=-1;const r=Ft(n)?[n]:En(n),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let c=s;if(a!==o){const u=e[l];c=fe(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const Ct={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ae={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Me={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ra=x.createContext(null);Ra.displayName="HookFormControlContext";const Fn=()=>x.useContext(Ra);var za=(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]!==Ae.all&&(n._proxyFormState[o]=!a||Ae.all),s&&(s[o]=!0),e[o]}});return r};const Mn=typeof window<"u"?x.useLayoutEffect:x.useEffect;function tc(e){const n=Fn(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[o,l]=x.useState(s._formState),c=x.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Mn(()=>s._subscribe({name:r,formState:c.current,exact:i,callback:u=>{!a&&l({...s._formState,...u})}}),[r,a,i]),x.useEffect(()=>{c.current.isValid&&s._setValid(!0)},[s]),x.useMemo(()=>za(o,s,c.current,!1),[o,s])}var Se=e=>typeof e=="string",dn=(e,n,s,a,r)=>Se(e)?(a&&n.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),z(s,i))):(a&&(n.watchAll=!0),s),un=e=>Ne(e)||!Pa(e);function De(e,n,s=new WeakSet){if(un(e)||un(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)||fe(o)&&fe(l)||Array.isArray(o)&&Array.isArray(l)?!De(o,l,s):!Object.is(o,l))return!1}}return!0}function nc(e){const n=Fn(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},c=x.useRef(r),u=x.useRef(l),f=x.useRef(void 0),h=x.useRef(s),g=x.useRef(a);u.current=l;const[m,v]=x.useState(()=>{const N=s._getWatch(a,c.current);return u.current?u.current(N):N}),j=x.useCallback(N=>{const k=dn(a,s._names,N||s._formValues,!1,c.current);return u.current?u.current(k):k},[s._formValues,s._names,a]),b=x.useCallback(N=>{if(!i){const k=dn(a,s._names,N||s._formValues,!1,c.current);if(u.current){const E=u.current(k);De(E,f.current)||(v(E),f.current=E)}else v(k)}},[s._formValues,s._names,i,a]);Mn(()=>((h.current!==s||!De(g.current,a))&&(h.current=s,g.current=a,b()),s._subscribe({name:a,formState:{values:!0},exact:o,callback:N=>{b(N.values)}})),[s,o,a,b]),x.useEffect(()=>s._removeUnmounted());const w=h.current!==s,y=g.current,S=x.useMemo(()=>{if(i)return null;const N=!w&&!De(y,a);return w||N?j():null},[i,w,a,y,j]);return S!==null?S:m}function sc(e){const n=Fn(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=Oa(r._names.array,s),u=x.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,o)),[r,s,o]),f=nc({control:r,name:s,defaultValue:u,exact:l}),h=tc({control:r,name:s,exact:l}),g=x.useRef(e),m=x.useRef(void 0),v=x.useRef(r.register(s,{...e.rules,value:f,...ke(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const j=x.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(h.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(h.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(h.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(h.validatingFields,s)},error:{enumerable:!0,get:()=>z(h.errors,s)}}),[h,s]),b=x.useCallback(N=>v.current.onChange({target:{value:_a(N),name:s},type:Ct.CHANGE}),[s]),w=x.useCallback(()=>v.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Ct.BLUR}),[s,r._formValues]),y=x.useCallback(N=>{const k=z(r._fields,s);k&&k._f&&N&&(k._f.ref={focus:()=>je(N.focus)&&N.focus(),select:()=>je(N.select)&&N.select(),setCustomValidity:E=>je(N.setCustomValidity)&&N.setCustomValidity(E),reportValidity:()=>je(N.reportValidity)&&N.reportValidity()})},[r._fields,s]),S=x.useMemo(()=>({name:s,value:f,...ke(a)||h.disabled?{disabled:h.disabled||a}:{},onChange:b,onBlur:w,ref:y}),[s,a,h.disabled,b,w,y,f]);return x.useEffect(()=>{const N=r._options.shouldUnregister||i,k=m.current;k&&k!==s&&!c&&r.unregister(k),r.register(s,{...g.current.rules,...ke(g.current.disabled)?{disabled:g.current.disabled}:{}});const E=(M,L)=>{const A=z(r._fields,M);A&&A._f&&(A._f.mount=L)};if(E(s,!0),N){const M=de(z(r._options.defaultValues,s,g.current.defaultValue));ie(r._defaultValues,s,M),oe(z(r._formValues,s))&&ie(r._formValues,s,M)}return!c&&r.register(s),m.current=s,()=>{(c?N&&!r._state.action:N)?r.unregister(s):E(s,!1)}},[s,r,c,i]),x.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),x.useMemo(()=>({field:S,formState:h,fieldState:j}),[S,h,j])}const ac=x.createContext(null);ac.displayName="HookFormContext";var rc=(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],ys=()=>{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 Ba(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&fe(r)&&i){const o=Ba(r,i);fe(o)&&(s[a]=o)}else e[a]&&(s[a]=i)}return s}var ve=e=>fe(e)&&!Object.keys(e).length,Ln=e=>e.type==="file",kt=e=>{if(!An)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Va=e=>e.type==="select-multiple",In=e=>e.type==="radio",ic=e=>In(e)||ft(e),Wt=e=>kt(e)&&e.isConnected;function lc(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=oe(e)?a++:e[n[a++]];return e}function oc(e){for(const n in e)if(e.hasOwnProperty(n)&&!oe(e[n]))return!1;return!0}function ue(e,n){const s=Array.isArray(n)?n:Ft(n)?[n]:En(n),a=s.length===1?e:lc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(fe(a)&&ve(a)||Array.isArray(a)&&oc(a))&&ue(e,s.slice(0,-1)),e}var cc=e=>{for(const n in e)if(je(e[n]))return!0;return!1};function Ua(e){return Array.isArray(e)||fe(e)&&!cc(e)}function fn(e,n={}){for(const s in e){const a=e[s];Ua(a)?(n[s]=Array.isArray(a)?[]:{},fn(a,n[s])):oe(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=fn(n));for(const a in e){const r=e[a];if(Ua(r))oe(n)||un(s[a])?s[a]=fn(r,Array.isArray(r)?[]:{}):Ze(r,Ne(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!De(r,i)}}return s}const vs={value:!1,isValid:!1},js={value:!0,isValid:!0};var Ha=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!oe(e[0].attributes.value)?oe(e[0].value)||e[0].value===""?js:{value:e[0].value,isValid:!0}:js:vs}return vs},qa=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>oe(e)?e:n?e===""?NaN:e&&+e:s&&Se(e)?new Date(e):a?a(e):e;const ws={isValid:!1,value:null};var Wa=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,ws):ws;function Ns(e){const n=e.ref;return Ln(n)?n.files:In(n)?Wa(e.refs).value:Va(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?Ha(e.refs).value:qa(oe(n.value)?e.ref.value:n.value,e)}var dc=(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}},St=e=>e instanceof RegExp,at=e=>oe(e)?e:St(e)?e.source:fe(e)?St(e.value)?e.value.source:e.value:e,Cs=e=>({isOnSubmit:!e||e===Ae.onSubmit,isOnBlur:e===Ae.onBlur,isOnChange:e===Ae.onChange,isOnAll:e===Ae.all,isOnTouch:e===Ae.onTouched});const ks="AsyncFunction";var uc=e=>!!e&&!!e.validate&&!!(je(e.validate)&&e.validate.constructor.name===ks||fe(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===ks)),fc=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ss=(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(fe(l)&&ot(l,n))break}}};function $s(e,n,s){const a=z(e,s);if(a||Ft(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 mc=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return ve(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(o=>n[o]===(!a||Ae.all))},hc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),xc=(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,pc=(e,n)=>!Dn(z(e,n)).length&&ue(e,n),gc=(e,n,s)=>{const a=lt(z(e,s));return ie(a,"root",n[s]),ie(e,s,a),e};function As(e,n,s="validate"){if(Se(e)||Array.isArray(e)&&e.every(Se)||ke(e)&&!e)return{type:s,message:Se(e)?e:"",ref:n}}var Ge=e=>fe(e)&&!St(e)?e:{value:e,message:""},Ds=async(e,n,s,a,r,i)=>{const{ref:o,refs:l,required:c,maxLength:u,minLength:f,min:h,max:g,pattern:m,validate:v,name:j,valueAsNumber:b,mount:w}=e._f,y=z(s,j);if(!w||n.has(j))return{};const S=l?l[0]:o,N=$=>{r&&S.reportValidity&&(S.setCustomValidity(ke($)?"":$||""),S.reportValidity())},k={},E=In(o),M=ft(o),L=E||M,A=(b||Ln(o))&&oe(o.value)&&oe(y)||kt(o)&&o.value===""||y===""||Array.isArray(y)&&!y.length,O=rc.bind(null,j,a,k),F=($,I,P,G=Me.maxLength,q=Me.minLength)=>{const W=$?I:P;k[j]={type:$?G:q,message:W,ref:o,...O($?G:q,W)}};if(i?!Array.isArray(y)||!y.length:c&&(!L&&(A||Ne(y))||ke(y)&&!y||M&&!Ha(l).isValid||E&&!Wa(l).isValid)){const{value:$,message:I}=Se(c)?{value:!!c,message:c}:Ge(c);if($&&(k[j]={type:Me.required,message:I,ref:S,...O(Me.required,I)},!a))return N(I),k}if(!A&&(!Ne(h)||!Ne(g))){let $,I;const P=Ge(g),G=Ge(h);if(!Ne(y)&&!isNaN(y)){const q=o.valueAsNumber||y&&+y;Ne(P.value)||($=q>P.value),Ne(G.value)||(I=q<G.value)}else{const q=o.valueAsDate||new Date(y),W=re=>new Date(new Date().toDateString()+" "+re),ee=o.type=="time",ae=o.type=="week";Se(P.value)&&y&&($=ee?W(y)>W(P.value):ae?y>P.value:q>new Date(P.value)),Se(G.value)&&y&&(I=ee?W(y)<W(G.value):ae?y<G.value:q<new Date(G.value))}if(($||I)&&(F(!!$,P.message,G.message,Me.max,Me.min),!a))return N(k[j].message),k}if((u||f)&&!A&&(Se(y)||i&&Array.isArray(y))){const $=Ge(u),I=Ge(f),P=!Ne($.value)&&y.length>+$.value,G=!Ne(I.value)&&y.length<+I.value;if((P||G)&&(F(P,$.message,I.message),!a))return N(k[j].message),k}if(m&&!A&&Se(y)){const{value:$,message:I}=Ge(m);if(St($)&&!y.match($)&&(k[j]={type:Me.pattern,message:I,ref:o,...O(Me.pattern,I)},!a))return N(I),k}if(v){if(je(v)){const $=await v(y,s),I=As($,S);if(I&&(k[j]={...I,...O(Me.validate,I.message)},!a))return N(I.message),k}else if(fe(v)){let $={};for(const I in v){if(!ve($)&&!a)break;const P=As(await v[I](y,s),S,I);P&&($={...P,...O(I,P.message)},N(P.message),a&&(k[j]=$))}if(!ve($)&&(k[j]={ref:S,...$},!a))return k}}return N(!0),k};const bc={mode:Ae.onSubmit,reValidateMode:Ae.onChange,shouldFocusError:!0};function yc(e={}){let n={...bc,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:je(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=fe(n.defaultValues)||fe(n.values)?de(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:de(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},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={...f};let g={...h};const m={array:ys(),state:ys()},v=n.criteriaMode===Ae.all,j=p=>C=>{clearTimeout(u),u=setTimeout(p,C)},b=async p=>{if(!o.keepIsValid&&!n.disabled&&(h.isValid||g.isValid||p)){let C;n.resolver?(C=ve((await L()).errors),w()):C=await O(a,!0),C!==s.isValid&&m.state.next({isValid:C})}},w=(p,C)=>{!n.disabled&&(h.isValidating||h.validatingFields||g.isValidating||g.validatingFields)&&((p||Array.from(l.mount)).forEach(D=>{D&&(C?ie(s.validatingFields,D,C):ue(s.validatingFields,D))}),m.state.next({validatingFields:s.validatingFields,isValidating:!ve(s.validatingFields)}))},y=(p,C=[],D,B,_=!0,T=!0)=>{if(B&&D&&!n.disabled){if(o.action=!0,T&&Array.isArray(z(a,p))){const Y=D(z(a,p),B.argA,B.argB);_&&ie(a,p,Y)}if(T&&Array.isArray(z(s.errors,p))){const Y=D(z(s.errors,p),B.argA,B.argB);_&&ie(s.errors,p,Y),pc(s.errors,p)}if((h.touchedFields||g.touchedFields)&&T&&Array.isArray(z(s.touchedFields,p))){const Y=D(z(s.touchedFields,p),B.argA,B.argB);_&&ie(s.touchedFields,p,Y)}(h.dirtyFields||g.dirtyFields)&&(s.dirtyFields=Ze(r,i)),m.state.next({name:p,isDirty:$(p,C),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else ie(i,p,C)},S=(p,C)=>{ie(s.errors,p,C),m.state.next({errors:s.errors})},N=p=>{s.errors=p,m.state.next({errors:s.errors,isValid:!1})},k=(p,C,D,B)=>{const _=z(a,p);if(_){const T=z(i,p,oe(D)?z(r,p):D);oe(T)||B&&B.defaultChecked||C?ie(i,p,C?T:Ns(_._f)):G(p,T),o.mount&&!o.action&&b()}},E=(p,C,D,B,_)=>{let T=!1,Y=!1;const ne={name:p};if(!n.disabled){if(!D||B){(h.isDirty||g.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=$(),T=Y!==ne.isDirty);const se=De(z(r,p),C);Y=!!z(s.dirtyFields,p),se?ue(s.dirtyFields,p):ie(s.dirtyFields,p,!0),ne.dirtyFields=s.dirtyFields,T=T||(h.dirtyFields||g.dirtyFields)&&Y!==!se}if(D){const se=z(s.touchedFields,p);se||(ie(s.touchedFields,p,D),ne.touchedFields=s.touchedFields,T=T||(h.touchedFields||g.touchedFields)&&se!==D)}T&&_&&m.state.next(ne)}return T?ne:{}},M=(p,C,D,B)=>{const _=z(s.errors,p),T=(h.isValid||g.isValid)&&ke(C)&&s.isValid!==C;if(n.delayError&&D?(c=j(()=>S(p,D)),c(n.delayError)):(clearTimeout(u),c=null,D?ie(s.errors,p,D):ue(s.errors,p)),(D?!De(_,D):_)||!ve(B)||T){const Y={...B,...T&&ke(C)?{isValid:C}:{},errors:s.errors,name:p};s={...s,...Y},m.state.next(Y)}},L=async p=>(w(p,!0),await n.resolver(i,n.context,dc(p||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),A=async p=>{const{errors:C}=await L(p);if(w(p),p)for(const D of p){const B=z(C,D);B?ie(s.errors,D,B):ue(s.errors,D)}else s.errors=C;return C},O=async(p,C,D={valid:!0})=>{for(const B in p){const _=p[B];if(_){const{_f:T,...Y}=_;if(T){const ne=l.array.has(T.name),se=_._f&&uc(_._f);se&&h.validatingFields&&w([T.name],!0);const ye=await Ds(_,l.disabled,i,v,n.shouldUseNativeValidation&&!C,ne);if(se&&h.validatingFields&&w([T.name]),ye[T.name]&&(D.valid=!1,C||e.shouldUseNativeValidation))break;!C&&(z(ye,T.name)?ne?gc(s.errors,ye,T.name):ie(s.errors,T.name,ye[T.name]):ue(s.errors,T.name))}!ve(Y)&&await O(Y,C,D)}}return D.valid},F=()=>{for(const p of l.unMount){const C=z(a,p);C&&(C._f.refs?C._f.refs.every(D=>!Wt(D)):!Wt(C._f.ref))&&be(p)}l.unMount=new Set},$=(p,C)=>!n.disabled&&(p&&C&&ie(i,p,C),!De(U(),r)),I=(p,C,D)=>dn(p,l,{...o.mount?i:oe(C)?r:Se(p)?{[p]:C}:C},D,C),P=p=>Dn(z(o.mount?i:r,p,n.shouldUnregister?z(r,p,[]):[])),G=(p,C,D={})=>{const B=z(a,p);let _=C;if(B){const T=B._f;T&&(!T.disabled&&ie(i,p,qa(C,T)),_=kt(T.ref)&&Ne(C)?"":C,Va(T.ref)?[...T.ref.options].forEach(Y=>Y.selected=_.includes(Y.value)):T.refs?ft(T.ref)?T.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(_)?Y.checked=!!_.find(ne=>ne===Y.value):Y.checked=_===Y.value||!!_)}):T.refs.forEach(Y=>Y.checked=Y.value===_):Ln(T.ref)?T.ref.value="":(T.ref.value=_,T.ref.type||m.state.next({name:p,values:de(i)})))}(D.shouldDirty||D.shouldTouch)&&E(p,_,D.shouldTouch,D.shouldDirty,!0),D.shouldValidate&&re(p)},q=(p,C,D)=>{for(const B in C){if(!C.hasOwnProperty(B))return;const _=C[B],T=p+"."+B,Y=z(a,T);(l.array.has(p)||fe(_)||Y&&!Y._f)&&!We(_)?q(T,_,D):G(T,_,D)}},W=(p,C,D={})=>{const B=z(a,p),_=l.array.has(p),T=de(C);ie(i,p,T),_?(m.array.next({name:p,values:de(i)}),(h.isDirty||h.dirtyFields||g.isDirty||g.dirtyFields)&&D.shouldDirty&&m.state.next({name:p,dirtyFields:Ze(r,i),isDirty:$(p,T)})):B&&!B._f&&!Ne(T)?q(p,T,D):G(p,T,D),Ss(p,l)?m.state.next({...s,name:p,values:de(i)}):m.state.next({name:o.mount?p:void 0,values:de(i)})},ee=async p=>{o.mount=!0;const C=p.target;let D=C.name,B=!0;const _=z(a,D),T=se=>{B=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||De(se,z(i,D,se))},Y=Cs(n.mode),ne=Cs(n.reValidateMode);if(_){let se,ye;const Ue=C.type?Ns(_._f):_a(p),Oe=p.type===Ct.BLUR||p.type===Ct.FOCUS_OUT,ai=!fc(_._f)&&!n.resolver&&!z(s.errors,D)&&!_._f.deps||xc(Oe,z(s.touchedFields,D),s.isSubmitted,ne,Y),It=Ss(D,l,Oe);ie(i,D,Ue),Oe?(!C||!C.readOnly)&&(_._f.onBlur&&_._f.onBlur(p),c&&c(0)):_._f.onChange&&_._f.onChange(p);const Tt=E(D,Ue,Oe),ri=!ve(Tt)||It;if(!Oe&&m.state.next({name:D,type:p.type,values:de(i)}),ai)return(h.isValid||g.isValid)&&(n.mode==="onBlur"?Oe&&b():Oe||b()),ri&&m.state.next({name:D,...It?{}:Tt});if(!Oe&&It&&m.state.next({...s}),n.resolver){const{errors:Gn}=await L([D]);if(w([D]),T(Ue),B){const ii=$s(s.errors,a,D),Qn=$s(Gn,a,ii.name||D);se=Qn.error,D=Qn.name,ye=ve(Gn)}}else w([D],!0),se=(await Ds(_,l.disabled,i,v,n.shouldUseNativeValidation))[D],w([D]),T(Ue),B&&(se?ye=!1:(h.isValid||g.isValid)&&(ye=await O(a,!0)));B&&(_._f.deps&&(!Array.isArray(_._f.deps)||_._f.deps.length>0)&&re(_._f.deps),M(D,ye,se,Tt))}},ae=(p,C)=>{if(z(s.errors,C)&&p.focus)return p.focus(),1},re=async(p,C={})=>{let D,B;const _=lt(p);if(n.resolver){const T=await A(oe(p)?p:_);D=ve(T),B=p?!_.some(Y=>z(T,Y)):D}else p?(B=(await Promise.all(_.map(async T=>{const Y=z(a,T);return await O(Y&&Y._f?{[T]:Y}:Y)}))).every(Boolean),!(!B&&!s.isValid)&&b()):B=D=await O(a);return m.state.next({...!Se(p)||(h.isValid||g.isValid)&&D!==s.isValid?{}:{name:p},...n.resolver||!p?{isValid:D}:{},errors:s.errors}),C.shouldFocus&&!B&&ot(a,ae,p?_:l.mount),B},U=(p,C)=>{let D={...o.mount?i:r};return C&&(D=Ba(C.dirtyFields?s.dirtyFields:s.touchedFields,D)),oe(p)?D:Se(p)?z(D,p):p.map(B=>z(D,B))},Z=(p,C)=>({invalid:!!z((C||s).errors,p),isDirty:!!z((C||s).dirtyFields,p),error:z((C||s).errors,p),isValidating:!!z(s.validatingFields,p),isTouched:!!z((C||s).touchedFields,p)}),Q=p=>{p&&lt(p).forEach(C=>ue(s.errors,C)),m.state.next({errors:p?s.errors:{}})},H=(p,C,D)=>{const B=(z(a,p,{_f:{}})._f||{}).ref,_=z(s.errors,p)||{},{ref:T,message:Y,type:ne,...se}=_;ie(s.errors,p,{...se,...C,ref:B}),m.state.next({name:p,errors:s.errors,isValid:!1}),D&&D.shouldFocus&&B&&B.focus&&B.focus()},X=(p,C)=>je(p)?m.state.subscribe({next:D=>"values"in D&&p(I(void 0,C),D)}):I(p,C,!0),J=p=>m.state.subscribe({next:C=>{hc(p.name,C.name,p.exact)&&mc(C,p.formState||h,Fe,p.reRenderRoot)&&p.callback({values:{...i},...s,...C,defaultValues:r})}}).unsubscribe,Ce=p=>(o.mount=!0,g={...g,...p.formState},J({...p,formState:{...f,...p.formState}})),be=(p,C={})=>{for(const D of p?lt(p):l.mount)l.mount.delete(D),l.array.delete(D),C.keepValue||(ue(a,D),ue(i,D)),!C.keepError&&ue(s.errors,D),!C.keepDirty&&ue(s.dirtyFields,D),!C.keepTouched&&ue(s.touchedFields,D),!C.keepIsValidating&&ue(s.validatingFields,D),!n.shouldUnregister&&!C.keepDefaultValue&&ue(r,D);m.state.next({values:de(i)}),m.state.next({...s,...C.keepDirty?{isDirty:$()}:{}}),!C.keepIsValid&&b()},he=({disabled:p,name:C})=>{if(ke(p)&&o.mount||p||l.disabled.has(C)){const _=l.disabled.has(C)!==!!p;p?l.disabled.add(C):l.disabled.delete(C),_&&o.mount&&!o.action&&b()}},Be=(p,C={})=>{let D=z(a,p);const B=ke(C.disabled)||ke(n.disabled);return ie(a,p,{...D||{},_f:{...D&&D._f?D._f:{ref:{name:p}},name:p,mount:!0,...C}}),l.mount.add(p),D?he({disabled:ke(C.disabled)?C.disabled:n.disabled,name:p}):k(p,!0,C.value),{...B?{disabled:C.disabled||n.disabled}:{},...n.progressive?{required:!!C.required,min:at(C.min),max:at(C.max),minLength:at(C.minLength),maxLength:at(C.maxLength),pattern:at(C.pattern)}:{},name:p,onChange:ee,onBlur:ee,ref:_=>{if(_){Be(p,C),D=z(a,p);const T=oe(_.value)&&_.querySelectorAll&&_.querySelectorAll("input,select,textarea")[0]||_,Y=ic(T),ne=D._f.refs||[];if(Y?ne.find(se=>se===T):T===D._f.ref)return;ie(a,p,{_f:{...D._f,...Y?{refs:[...ne.filter(Wt),T,...Array.isArray(z(r,p))?[{}]:[]],ref:{type:T.type,name:p}}:{ref:T}}}),k(p,!1,void 0,T)}else D=z(a,p,{}),D._f&&(D._f.mount=!1),(n.shouldUnregister||C.shouldUnregister)&&!(Oa(l.array,p)&&o.action)&&l.unMount.add(p)}}},Te=()=>n.shouldFocusError&&ot(a,ae,l.mount),Pe=p=>{ke(p)&&(m.state.next({disabled:p}),ot(a,(C,D)=>{const B=z(a,D);B&&(C.disabled=B._f.disabled||p,Array.isArray(B._f.refs)&&B._f.refs.forEach(_=>{_.disabled=B._f.disabled||p}))},0,!1))},_e=(p,C)=>async D=>{let B;D&&(D.preventDefault&&D.preventDefault(),D.persist&&D.persist());let _=de(i);if(m.state.next({isSubmitting:!0}),n.resolver){const{errors:T,values:Y}=await L();w(),s.errors=T,_=de(Y)}else await O(a);if(l.disabled.size)for(const T of l.disabled)ue(_,T);if(ue(s.errors,"root"),ve(s.errors)){m.state.next({errors:{}});try{await p(_,D)}catch(T){B=T}}else C&&await C({...s.errors},D),Te(),setTimeout(Te);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(s.errors)&&!B,submitCount:s.submitCount+1,errors:s.errors}),B)throw B},Ve=(p,C={})=>{z(a,p)&&(oe(C.defaultValue)?W(p,de(z(r,p))):(W(p,C.defaultValue),ie(r,p,de(C.defaultValue))),C.keepTouched||ue(s.touchedFields,p),C.keepDirty||(ue(s.dirtyFields,p),s.isDirty=C.defaultValue?$(p,de(z(r,p))):$()),C.keepError||(ue(s.errors,p),h.isValid&&b()),m.state.next({...s}))},Ee=(p,C={})=>{const D=p?de(p):r,B=de(D),_=ve(p),T=_?r:B;if(C.keepDefaultValues||(r=D),!C.keepValues){if(C.keepDirtyValues){const Y=new Set([...l.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),ye=z(i,ne),Ue=z(T,ne);se&&!oe(ye)?ie(T,ne,ye):!se&&!oe(Ue)&&W(ne,Ue)}}else{if(An&&oe(p))for(const Y of l.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(kt(se)){const ye=se.closest("form");if(ye){ye.reset();break}}}}if(C.keepFieldsRef)for(const Y of l.mount)W(Y,z(T,Y));else a={}}i=n.shouldUnregister?C.keepDefaultValues?de(r):{}:de(T),m.array.next({values:{...T}}),m.state.next({values:{...T}})}l={mount:C.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!h.isValid||!!C.keepIsValid||!!C.keepDirtyValues||!n.shouldUnregister&&!ve(T),o.watch=!!n.shouldUnregister,o.keepIsValid=!!C.keepIsValid,o.action=!1,C.keepErrors||(s.errors={}),m.state.next({submitCount:C.keepSubmitCount?s.submitCount:0,isDirty:_?!1:C.keepDirty?s.isDirty:!!(C.keepDefaultValues&&!De(p,r)),isSubmitted:C.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:_?{}:C.keepDirtyValues?C.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:C.keepDefaultValues&&p?Ze(r,p):C.keepDirty?s.dirtyFields:{},touchedFields:C.keepTouched?s.touchedFields:{},errors:C.keepErrors?s.errors:{},isSubmitSuccessful:C.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(p,C)=>Ee(je(p)?p(i):p,{...n.resetOptions,...C}),me=(p,C={})=>{const D=z(a,p),B=D&&D._f;if(B){const _=B.refs?B.refs[0]:B.ref;_.focus&&setTimeout(()=>{_.focus(),C.shouldSelect&&je(_.select)&&_.select()})}},Fe=p=>{s={...s,...p}},xe={control:{register:Be,unregister:be,getFieldState:Z,handleSubmit:_e,setError:H,_subscribe:J,_runSchema:L,_updateIsValidating:w,_focusError:Te,_getWatch:I,_getDirty:$,_setValid:b,_setFieldArray:y,_setDisabledField:he,_setErrors:N,_getFieldArray:P,_reset:Ee,_resetDefaultValues:()=>je(n.defaultValues)&&n.defaultValues().then(p=>{te(p,n.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:Pe,_subjects:m,_proxyFormState:h,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(p){o=p},get _defaultValues(){return r},get _names(){return l},set _names(p){l=p},get _formState(){return s},get _options(){return n},set _options(p){n={...n,...p}}},subscribe:Ce,trigger:re,register:Be,handleSubmit:_e,watch:X,setValue:W,getValues:U,reset:te,resetField:Ve,clearErrors:Q,unregister:be,setError:H,setFocus:me,getFieldState:Z};return{...xe,formControl:xe}}function vc(e={}){const n=x.useRef(void 0),s=x.useRef(void 0),[a,r]=x.useState({isDirty:!1,isValidating:!1,isLoading:je(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:je(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!je(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=yc(e);n.current={...l,formState:a}}const i=n.current.control;return i._options=e,Mn(()=>{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]),x.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),x.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),x.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),x.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),x.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),x.useEffect(()=>{var o;e.values&&!De(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]),x.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=x.useMemo(()=>za(a,i),[i,a]),n.current}function jc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function wc(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 Nc(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 Cc(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 kc(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 Tn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Tn();const Sc={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Yt=()=>({id:Tn(),amount:0,glAccount:null,isTaxDeductible:!1}),Ya=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:c,onDelete:u,canDelete:f=!0,canEditTaxDeductible:h=!0,isDisabled:g=!1,labels:m,classNames:v={},"data-testid":j,control:b,name:w,rules:y})=>{const S={...Sc,...m},N=b!==void 0&&w!==void 0,k=vc({defaultValues:{_internal:n||Yt()}}),E=sc({control:N?b:k.control,name:N?w:"_internal",rules:N?y:void 0}),[M,L]=x.useState(n||Yt()),A=N?E.field.value??Yt():e??M,O=N&&!!E.fieldState?.error,F=N&&(E.fieldState?.isTouched??!1),$=O||F,I=$&&(!A.amount||A.amount<=0),P=$&&!A.glAccount,[G,q]=x.useState(A.glAccount?.name||""),W=x.useCallback(H=>{const X={...A,...H};N&&E.field.onChange(X),!N&&e===void 0&&L(X),i?.(X)},[A,e,i,N,E]),ee=x.useCallback(H=>{const X=H||0;W({amount:X}),o?.(X)},[W,o]),ae=x.useCallback(H=>{q(H),r?.(H)},[r]),re=x.useCallback(H=>{if(H===null){W({glAccount:null}),l?.(null);return}const J=s.find(Ce=>String(Ce.id)===String(H))||null;W({glAccount:J}),l?.(J)},[s,W,l]),U=x.useCallback(()=>{q(""),W({glAccount:null}),l?.(null)},[W,l]),Z=x.useCallback(H=>{W({isTaxDeductible:H}),c?.(H)},[W,c]),Q=x.useCallback(()=>{u?.()},[u]);return t.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":j||"revenue-distribution-card",className:d.cn(v.base),children:t.jsxs(d.CardBody,{className:d.cn("flex flex-row flex-nowrap items-start gap-4",v.body),children:[t.jsx("div",{className:d.cn("shrink-0",v.amountContainer),children:t.jsx(d.NumberInput,{"data-testid":`${j||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.amount,t.jsx(d.Tooltip,{content:S.amountTooltip,children:t.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:A.amount||void 0,onValueChange:ee,labelPlacement:"outside",placeholder:S.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:g,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:v.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:S.currencySymbol})})})}),t.jsx("div",{className:d.cn("grow",v.glAccountContainer),children:t.jsx(d.Autocomplete,{"data-testid":`${j||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[S.glAccount,t.jsx(d.Tooltip,{content:S.glAccountTooltip,children:t.jsx(V,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:A.glAccount?.name??G,selectedKey:A.glAccount?.id??null,isDisabled:g,isInvalid:P,errorMessage:P?"GL Account is required":void 0,listboxProps:{emptyContent:a?S.searching:S.noGlAccountsFound},placeholder:S.glAccountPlaceholder,onInputChange:ae,onSelectionChange:re,onClear:U,className:v.glAccountInput,children:H=>t.jsx(d.AutocompleteItem,{textValue:H.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:H.name}),H.code&&t.jsx("span",{className:"text-xs text-default-400",children:H.code})]})},H.id)})}),t.jsx("div",{className:d.cn("shrink-0 pt-6 flex items-center",v.taxDeductibleContainer),children:t.jsx(d.Checkbox,{radius:"full","data-testid":`${j||"revenue-distribution-card"}-tax-deductible`,isSelected:A.isTaxDeductible,onValueChange:Z,isDisabled:g||!h,className:v.taxDeductibleCheckbox,children:S.taxDeductible})}),t.jsx("div",{className:d.cn("shrink-0 pt-6",v.deleteContainer),children:t.jsx(R,{"data-testid":`${j||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:g||!f,onPress:Q,startContent:t.jsx(V,{icon:"solar:trash-bin-trash-linear",width:16}),className:d.cn("text-danger",v.deleteButton),children:S.deleteButton})})]})})};Ya.displayName="RevenueDistributionCard";const Ka=({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:d.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(V,{icon:n,width:s,className:d.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:d.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:t.jsx(d.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:d.cn("w-full",r.base),children:o})};Ka.displayName="RevenueDistributionEmpty";const $c={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},Ga=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...$c,...n},o=t.jsx(d.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(d.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:t.jsx(d.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:d.cn("w-full",r.base),children:o})};Ga.displayName="RevenueDistributionError";const Qa=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:d.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(d.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(d.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(d.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(d.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(d.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(d.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(d.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(d.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(d.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(d.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:d.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};Qa.displayName="RevenueDistributionSkeleton";function Mt({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:c,onClose:u,onConfirm:f}){return t.jsx(d.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...c,base:d.cn("max-w-[440px] rounded-3xl",c?.base),closeButton:d.cn("right-5 top-5 text-zinc-500",c?.closeButton)},onOpenChange:h=>!h&&u(),children:t.jsxs(d.ModalContent,{children:[t.jsxs(d.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:d.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(d.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(d.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(R,{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(R,{type:"button",size:"md",color:r,radius:"full",className:d.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const Ac=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function mn(e){return!e.fund&&Number(e.percentage||0)<=0}function Dc({mode:e,assignments:n}){const s=n.filter(o=>!mn(o)),a=s.filter(o=>o.fund),r=a.reduce((o,l)=>o+Number(l.percentage||0),0),i=s.some(o=>!o.fund||Number(o.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Ec={title:"Payment assignment",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},Za={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={...Za,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Fc={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"},Mc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Lc(){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 Ic=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Tc=e=>e.fund!==null;function Pc({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,isFundPickerOpen:o=!1,activeAssignmentId:l=null,modalPortalContainer:c,footer:u,onAssignmentsChange:f,onOpenFundPicker:h,onCloseFundPicker:g,onCollapseChange:m,onSave:v}){const[j,b]=x.useState(null),w=c??j??void 0,y={...Ec,...s},S=e.filter(H=>!mn(H)),k=S.filter(Tc).length>0,E=x.useMemo(()=>e.filter(H=>!mn(H)).reduce((H,X)=>H+Number(X.percentage||0),0),[e]),M=Math.round(E*100)/100,L=S.some(H=>!H.fund||Number(H.percentage||0)<=0),A=k&&(M!==100||L),O=`${y.totalError} (${y.total} ${Number(E.toFixed(2))}%)`,F=Dc({mode:"split",assignments:e}),$=k&&M>=100,[I,P]=x.useState(!1),[G,q]=x.useState(!1),W=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lc,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title})]}),ee=(H,X)=>{f(e.map(J=>J.id===H?{...J,...X}:J))},ae=()=>{$||f([...e,Ac()])},re=H=>{e.length<=1||f(e.filter(X=>X.id!==H))},U=()=>{if(!r){if(!F){q(!0);return}if(!i){v();return}P(!0)}},Z=()=>{P(!1),v()},Q=H=>{const X=l??e.find(J=>!J.fund)?.id??e[0]?.id;X&&(f(e.map(J=>J.id===X?{...J,fund:H}:J)),g())};return t.jsxs("div",{ref:b,className:d.cn("vvt-pa relative font-sans text-zinc-900",o&&!c&&"min-h-[560px]",a?.root),children:[t.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:d.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:d.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:H=>m?.(!(H==="all"||Array.from(H).length>0)),children:t.jsx(d.AccordionItem,{"aria-label":y.title,title:W,children:t.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!k&&t.jsx(d.Alert,{icon:t.jsx(V,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:Za,color:"default",variant:"flat",title:y.emptySplit}),k&&t.jsx(_c,{assignments:e,labels:y,total:E,hasTotalError:G&&!F||A,validationMessage:O,onSelectFund:H=>h(H),onRemoveFund:re,onPercentageChange:(H,X)=>ee(H,{percentage:Ic(X)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(R,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50",startContent:t.jsx(K.Plus,{className:"size-5",strokeWidth:2}),isDisabled:$,onPress:()=>k?ae():h(),children:y.assignSpecificFund}),t.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:t.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:U,children:y.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),o&&t.jsx(Oc,{funds:n,labels:y,selectedFundIds:e.map(H=>H.fund?.id).filter(Boolean),portalContainer:w,onSelect:Q,onClose:g}),t.jsx(Mt,{isOpen:I,labels:{title:y.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:y.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:y.modifyAssignedFundsWarning})]}),cancel:y.modifyAssignedFundsCancel,confirm:y.modifyAssignedFundsConfirm},icon:t.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:w,shouldBlockScroll:!1,classNames:Mc,onClose:()=>P(!1),onConfirm:Z})]})}function _c({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((c,u)=>t.jsxs("div",{className:"flex min-h-15 w-full items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:d.cn("flex min-h-11 min-w-0 flex-1 items-center","gap-4"),children:c.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[c.fund.glCode," - ",c.fund.accountName]}),t.jsx(R,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(c.id),children:"Replace"})]}):t.jsx(R,{type:"button",size:"lg",variant:"light",radius:"full",className:"justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(c.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex w-48 flex-none items-center",children:t.jsx(d.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(c.percentage||""),onChange:f=>l(c.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Fc})}),e.length>1&&t.jsx(R,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:d.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(c.id),"aria-label":n.removeFund,children:t.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},c.id)),t.jsx(d.Alert,{icon:t.jsx(V,{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:d.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:d.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:d.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:d.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function Oc({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=x.useState(""),c=e.filter(u=>{if(s.includes(u.id))return!1;const f=o.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(d.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(d.ModalContent,{className:"max-h-full",children:[t.jsx(d.ModalHeader,{className:"px-6 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(d.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(d.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:o,placeholder:n.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(V,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:[t.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),c.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),c.map(u=>t.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[t.jsx("span",{children:u.glCode}),t.jsx("span",{children:u.accountName}),t.jsx(R,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function Rc(){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(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(d.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(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(d.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const zc={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Bc({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...zc,...i},c=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:d.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(Kt,{label:l.totalAmount,value:c.format(e)}),t.jsx(Kt,{label:l.remainingBalance,value:c.format(n)}),t.jsx(Kt,{label:l.amountReceived,value:c.format(s)})]})})}function Kt({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const Vc={monthly:1,quarterly:3,annual:12},Xa=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},Uc=(e,n)=>new Date(e,n+1,0).getDate(),Hc=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},qc=(e,n)=>{const{year:s,month:a,day:r}=Xa(e),i=a-1+n,o=s+Math.floor(i/12),l=(i%12+12)%12,c=Math.min(r,Uc(o,l));return new Date(o,l,c)},Wc=(e,n)=>{const{year:s,month:a,day:r}=Xa(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function Ja(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=Vc[n.frequency];return Array.from({length:s},(l,c)=>{const u=n.frequency==="weekly"?Wc(n.firstInstallmentDate,c*7):qc(n.firstInstallmentDate,c*(o??1));return{id:crypto.randomUUID(),dueDate:Hc(u),amount:(r+(c===0?i:0))/100}})}function Yc(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))}const Kc={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total cannot exceed donation amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Gc=["weekly","monthly","quarterly","annual"],Qc=Array.from({length:31},(e,n)=>n+1),Zc=["numberOfInstallments","frequency","firstInstallmentDate"],Xc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Es=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),er=e=>Math.round(e*100)/100,Jc=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},Lt=e=>{if(!e)return null;try{return Kl(e)}catch{return null}},ed=e=>Lt(e)?.day??1,td=(e,n)=>new Date(e,n,0).getDate(),nd=(e,n)=>{const s=Lt(e);if(!s)return e;const a=Math.min(n,td(s.year,s.month));return s.set({day:a}).toString()},Fs=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 sd({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:c=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:h=Zc,startDate:g,labels:m,classNames:v,isSaving:j=!1,isModeSwitchDisabled:b=!1,onModeChange:w,onAutomaticSettingsChange:y,onInstallmentsChange:S,onSave:N}){const[k,E]=x.useState(null),[M,L]=x.useState(o),A={...Kc,...m},O=e??M,F=x.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),$=x.useMemo(()=>({...i,firstInstallmentDate:h.includes("firstInstallmentDate")?i.firstInstallmentDate:h.includes("dayOfMonth")?i.firstInstallmentDate||g||"":g||i.firstInstallmentDate}),[i,h,g]),I=O==="automatic"?Ja(n,$):r,P=x.useMemo(()=>er(I.reduce((J,Ce)=>J+Number(Ce.amount||0),0)),[I]),G=O==="manual"&&P-n>.009,[q,W]=x.useState(!1),ee=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:A.title})]}):void 0,ae=J=>{J!==O&&(e||L(J),w?.(J),J==="manual"&&r.length===0&&S([Es()]))},re=(J,Ce)=>{r.find(he=>he.id===J)?.status!=="paid"&&S(r.map(he=>he.id===J?{...he,...Ce}:he))},U=()=>{S([...r,Es()])},Z=J=>{r.find(be=>be.id===J)?.status!=="paid"&&S(r.filter(be=>be.id!==J))},Q=()=>{if(!j){if(G){W(!0);return}N?.()}},H=()=>{W(!1),N?.()},X=t.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.content),children:[f||u?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(ad,{mode:O,labels:A,onModeChange:ae,isDisabled:b,className:v?.tabs}):null,u?t.jsx(R,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:j?void 0:t.jsx(V,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:j,onPress:Q,children:A.saveInstallments}):null]}):null,t.jsxs("div",{className:d.cn("flex w-full flex-col gap-4",v?.preview),children:[O==="automatic"&&t.jsx(rd,{settings:$,inputs:h,labels:A,className:v?.controls,onSettingsChange:y}),I.length===0&&t.jsx(d.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:O==="automatic"?A.emptyAutomatic:A.emptyManual}),I.length>0&&t.jsx(id,{mode:O,installments:I,labels:A,formatter:F,locale:a,onUpdateInstallment:re,onRemoveInstallment:Z}),O==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(R,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(K.Plus,{className:"size-5",strokeWidth:2}),onPress:U,children:A.addInstallment})}),t.jsx(od,{total:P,donationAmount:n,hasTotalIncreaseWarning:G,mode:O,installments:I,formatter:F,labels:A,className:v?.summary})]})]});return t.jsxs("div",{ref:E,className:d.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:[c?t.jsx(d.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:d.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:d.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(d.AccordionItem,{"aria-label":A.title,title:ee,children:X},"installment-schedule")}):X,t.jsx(Mt,{isOpen:q,labels:{title:A.totalIncreaseConfirmationTitle,description:A.totalIncreaseConfirmationDescription,cancel:A.totalIncreaseConfirmationCancel,confirm:A.totalIncreaseConfirmationConfirm},icon:t.jsx(V,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:j,portalContainer:k??void 0,shouldBlockScroll:!1,classNames:Xc,onClose:()=>W(!1),onConfirm:H})]})}function ad({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(d.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:d.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(d.Tab,{title:n.automaticMode},"automatic"),t.jsx(d.Tab,{title:n.manualMode},"manual")]})}function rd({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(d.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 c=l.target.value;r({...e,numberOfInstallments:c===""?0:Math.max(1,Number(c))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Ie,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const c=Array.from(l)[0];typeof c=="string"&&r({...e,frequency:c})},children:Gc.map(l=>t.jsx(d.SelectItem,{textValue:s[l],children:s[l]},l))})},o);if(o==="dayOfMonth"){const l=String(ed(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Ie,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:c=>{const u=Number(Array.from(c)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:nd(e.firstInstallmentDate,u)})},children:Qc.map(c=>t.jsx(d.SelectItem,{textValue:Fs(c),children:Fs(c)},String(c)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Cn,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:Lt(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(V,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return n.length===0?null:t.jsx("div",{className:d.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function id({mode:e,installments:n,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:o}){const l=Yc(n),c=new Set(n.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:d.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((u,f)=>t.jsxs("div",{className:d.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",f+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Jc(u.dueDate,r)}),f===0&&n.length>1&&t.jsx(d.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:a.format(u.amount)})]},u.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,f)=>{const h=l.has(u.id),g=c.has(u.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:f+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Cn,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:h,errorMessage:h?s.dateOrderError:void 0,value:Lt(u.dueDate),onChange:m=>i(u.id,{dueDate:m?m.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(d.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:g,errorMessage:g?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:m=>i(u.id,{amount:er(Number(m.target.value||0))}),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}),t.jsx(ld,{isDisabled:n.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>o(u.id)})]})},u.id)})})}function ld({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(R,{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(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(d.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 od({total:e,donationAmount:n,hasTotalIncreaseWarning:s,mode:a,installments:r,formatter:i,labels:o,className:l}){const c=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,h=c>1&&Math.round(u*100)!==Math.round(f*100),g=Math.max(n-e,0),m=s?t.jsx("span",{children:o.totalIncreaseWarning}):a==="automatic"?h?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:c})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:c})," 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)}),"."]}),v=a==="automatic"?`Total: ${i.format(e)}`:s?`New total: ${i.format(e)}`:`${o.remaining}: ${i.format(g)}`;return t.jsx(d.Alert,{isClosable:!1,color:s?"warning":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:v}),title:m})}function cd(){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(d.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(d.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(d.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(d.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(d.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(d.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(d.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(d.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(d.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const Ms={paid:"bg-emerald-50 text-emerald-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"},tr={paid:"Paid",schedule:"Schedule",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled"},dd={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},ud={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},fd=[];function md({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=fd,labels:c,isSaving:u=!1,onEditInstallments:f,onPayInstallment:h,onDeleteInstallment:g}){const[m,v]=x.useState(null),j={...dd,...c},[b,w]=x.useState(""),y=new Intl.NumberFormat(s,{style:"currency",currency:n}),S=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(K.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title})]}):void 0,N=x.useMemo(()=>{const E=b.trim().toLowerCase();return E?e.filter(M=>{const L=M.status??"schedule";return[M.id,M.amount,M.dueDate,Gt(M.dueDate,s),L,tr[L]??L].join(" ").toLowerCase().includes(E)}):e},[s,e,b]),k=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:j.searchLabel}),t.jsx(d.Input,{variant:"bordered",size:"md",value:b,placeholder:j.searchPlaceholder,onChange:E=>w(E.target.value),startContent:t.jsx(V,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(R,{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(V,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:j.editInstallments}):null]}),t.jsx("div",{className:d.cn("hidden [@container(max-width:767px)]:block",N.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((E,M)=>{const L=E.status??"schedule";return t.jsx(d.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(d.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",M+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${M+1}`})]}),t.jsx(Ls,{status:L})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:j.amount}),t.jsx("p",{className:"font-medium text-foreground",children:y.format(E.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:j.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Gt(E.dueDate,s)})]})]}),t.jsx(Is,{status:L,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})]})},E.id)}),N.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:j.noInstallmentsFound})]})}),t.jsx("div",{className:d.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",N.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:"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:j.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:j.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:j.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:j.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:j.actions})]})}),t.jsxs("tbody",{children:[N.map((E,M)=>{const L=E.status??"schedule";return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:M+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${M+1}`})}),t.jsx("td",{className:"px-2 py-3",children:y.format(E.amount)}),t.jsx("td",{className:"px-2 py-3",children:Gt(E.dueDate,s)}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(Ls,{status:L})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Is,{status:L,installment:E,labels:j,portalContainer:m??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:g})})]},E.id)}),N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:j.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(d.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(d.AccordionItem,{"aria-label":j.title,title:S,children:k},"installment-table")}):k})}function Ls({status:e}){return t.jsx(d.Chip,{size:"md",radius:"lg",className:d.cn("justify-center px-4",Ms[e]??Ms.schedule),startContent:t.jsx(xd,{status:e}),children:tr[e]??e})}function Is({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const c=!i.includes(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[c?t.jsx(R,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(V,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(n),children:s.payNow}):null,t.jsx(hd,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>l(n.id)})]})}function hd({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,o]=x.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(d.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(d.DropdownTrigger,{children:t.jsx(R,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(V,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(d.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(d.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(d.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(V,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(d.DropdownSection,{title:s.dangerZone,children:t.jsx(d.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(V,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Mt,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(V,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:ud,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function xd({status:e}){return e==="paid"?t.jsx(V,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(V,{icon:"solar:close-circle-bold",className:"size-3"}):t.jsx(V,{icon:"solar:calendar-outline",className:"size-3"})}function Gt(e,n){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const pd={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},gd=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:c=!0,onRenewalChange:u,onCardSelect:f,className:h=""})=>{const g=Array.isArray(e)?e:[],[m,v]=x.useState(l),[j,b]=x.useState(o),w={...pd,...r};x.useEffect(()=>{v(l)},[l]);const y=N=>{if(N===m){c&&f?.(N);return}v(N),f?.(N)},S=N=>{b(N),u?.(N)};return t.jsxs("div",{className:d.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",h),"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(rr,{title:w.renewalTitle,description:w.renewalDescription,value:j,onValueChange:S}),t.jsx("div",{className:d.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":d.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:g.map(N=>t.jsx(nr,{itemKey:N.id,name:N.name,type:N.type,price:N.price,locale:n,currency:s,isSelected:m===N.id,onSelect:y},N.id))})]})},nr=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:c,compact:u=!1,isDisabled:f=!1,disabledReason:h,statusLabel:g,statusTone:m="default",className:v=""})=>{const j=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!c&&!f,w=h||g,y=()=>{b&&c?.(e)};return t.jsx(d.Card,{shadow:"none",isPressable:!!c,onPress:y,className:d.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",v),"data-testid":"item-card","data-selected":l,isDisabled:f,children:t.jsxs("div",{className:d.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:d.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(d.Chip,{"data-testid":"item-card-status",color:m,size:"sm",variant:"flat",className:"px-2",children:w})]}),o&&t.jsx("p",{className:d.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:j})]})})},Ts="w-full bg-gray-100",Ps={variant:"light",color:"default"},sr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:c,action:u,footer:f,onPress:h,isPressable:g=!1,isDisabled:m=!1,compact:v=!1,className:j="",bodyClassName:b="",footerClassName:w="",dataTestId:y})=>{const S=!!(c&&c.value),N=!!u?.label,k=g&&!!h&&!N,E=!k,M=N?{variant:u?.variant??Ps.variant,color:u?.color??Ps.color,size:u?.size??"sm",isDisabled:m||u?.isDisabled,startContent:u?.icon?t.jsx(V,{icon:u.icon,width:16}):void 0}:null,L=s??(a?t.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,Ts,i),children:t.jsx(d.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:d.cn("relative overflow-hidden rounded-xl",o,Ts,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(V,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(d.Card,{"data-testid":y||`catalog-item-card-${e??"item"}`,className:d.cn("w-full overflow-hidden",j),isPressable:k,onPress:h,isDisabled:m,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),t.jsxs(d.CardBody,{className:d.cn("gap-3",v?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:d.cn("line-clamp-2 text-base font-semibold text-gray-900",v?"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((A,O)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(V,{icon:A.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:A.label})]},`${A.label}-${O}`))}):null,(S||N)&&t.jsxs("div",{className:d.cn("flex items-center justify-end gap-2 pt-1 text-sm",v?"pt-0.5":"",w),children:[S?t.jsxs("span",{className:d.cn("mr-auto text-gray-500",v?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[c?.label&&t.jsxs("span",{children:[c.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:c?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),N&&E?t.jsx(R,{className:d.cn("rounded-full",u?.className),onPress:u?.onPress,variant:M?.variant,color:M?.color,size:M?.size,startContent:M?.startContent,isDisabled:M?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};sr.displayName="CatalogItemCard";const bd={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},yd={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"},vd={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"},jd={empty:"status",error:"alert",success:"status",loading:"status"},wd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Nd(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(d.Spinner,{size:"lg",color:"primary",className:a.spinner});if(x.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:bd[e];return r?t.jsx(V,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",title:n,titleAs:s="p",description:a,icon:r,actions:i,role:o=jd[e],ariaLive:l=wd[e],iconSize:c=24,className:u,classNames:f={},"data-testid":h="feedback-state"}){const g=Nd(e,r,c,f);return t.jsxs("div",{role:o,"aria-live":l,"data-variant":e,"data-testid":h,className:d.cn("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-12 text-center",yd[e],u,f.base),children:[g?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:d.cn("inline-flex size-12 items-center justify-center rounded-2xl",e==="success"&&"rounded-full",vd[e],f.iconWrapper),children:g}):null,t.jsxs("div",{className:"flex flex-col items-center gap-1",children:[t.jsx(s,{"data-testid":`${h}-title`,className:d.cn("text-base font-medium text-default-900",f.title),children:n}),a?t.jsx("p",{"data-testid":`${h}-description`,className:d.cn("max-w-sm text-sm text-default-600",f.description),children:a}):null]}),i?t.jsx("div",{"data-testid":`${h}-actions`,className:d.cn("mt-1 flex flex-wrap items-center justify-center gap-2",f.actions),children:i}):null]})}function Pn(e){return t.jsx(et,{...e,variant:"empty"})}function _n(e){return t.jsx(et,{...e,variant:"error"})}function On(e){return t.jsx(et,{...e,variant:"loading"})}function ar(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Pn.displayName="EmptyState";_n.displayName="ErrorState";On.displayName="LoadingState";ar.displayName="SuccessState";const rr=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=x.useId();return t.jsxs("div",{className:d.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(d.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Cd={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"},kd=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),ir=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),Sd=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),Rn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),_s=(e,n,s)=>{const a={};let r=s?n??Sd(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of Rn(e)){a[i.id]??={},a[i.id][o.id]??={};const c=s?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:c,originalPrice:l.originalPrice,discountedPrice:l.price},r-=c}return a},Os=(e,n,s)=>`${e}::${n}::${s}`,$d=(e,n,s)=>{const a=ir(n);for(const{exhibition:r,dateGroup:i,ticket:o}of Rn(e)){const l=n[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,c=s===void 0?o.max:Math.min(o.max,s-(a-l));if(c>0&&l<c)return!1}return!0},Ad=({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]=x.useState(()=>String(i)),[c,u]=x.useState(!1),f=c?o:String(i),h=()=>{r||i>=s||a?.(i+1)},g=()=>{r||i<=n||a?.(i-1)},m=N=>{if(r)return;l(N.target.value);const k=parseInt(N.target.value,10);isNaN(k)||a?.(Math.max(n,Math.min(s,k)))},v=N=>{const k=parseInt(N.target.value,10);if(u(!1),isNaN(k)){a?.(n);return}const E=Math.max(n,Math.min(s,k));E!==k?a?.(E):l(String(E))},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",y="bg-primary hover:bg-primary/80",S="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:g,disabled:r||j,className:d.cn(w,r||j?S:y),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:m,onFocus:()=>u(!0),onBlur:v,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:h,disabled:r||b,className:d.cn(w,r||b?S:y),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},Dd=({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:d.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:d.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})]})},Ed=({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 h=a();return Math.min(e.max,r-(h-n))},c=i?.locale??"en-US",u=i?.currency??"USD",f=kd(c,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Ad,{initialQuantity:n,minQuantity:0,maxQuantity:l(),onChange:s})]}),e.membershipAlert?t.jsx(d.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]})},Fd=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c})=>t.jsxs("div",{className:d.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(Ed,{item:u,quantity:r(e,n.id,u.id),onChange:h=>a(e,n.id,u.id,h),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:c}),f<n.tickets.length-1?t.jsx(d.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Md=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:c=!1})=>{const[u,f]=x.useState(c),h=n.dates.reduce((m,v)=>m+v.tickets.reduce((j,b)=>j+a(n.id,v.id,b.id),0),0),g=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:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[h," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:d.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(V,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:d.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:g?n.dates.map((m,v)=>t.jsx(Fd,{exhibitionId:n.id,dateGroup:m,isLast:v===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},m.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})})})})]})},Ld=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=x.useMemo(()=>r??[],[r]),c={...Cd,...s},[u,f]=x.useState(()=>_s(l,n,!0)),h=x.useRef(!1),g=x.useMemo(()=>{const y=Rn(l).map(({exhibition:S,dateGroup:N,ticket:k})=>[Os(S.id,N.id,k.id),k]);return new Map(y)},[l]),m=$d(l,u,n),v=(y,S,N)=>u[y]?.[S]?.[N]?.selectedQuantity??0,j=()=>ir(u),b=(y,S,N,k)=>{const E=v(y,S,N),M=j()-E;if(n!==void 0&&M+k>n)return;const L=g.get(Os(y,S,N));if(!L)return;const A={...u,[y]:{...u[y],[S]:{...u[y]?.[S],[N]:{id:N,selectedQuantity:k,originalPrice:L.originalPrice,discountedPrice:L.price}}}};f(A),o?.(A)},w=y=>{const S=_s(l,n,y);f(S),o?.(S)};return x.useEffect(()=>{!h.current&&m&&(o?.(u),h.current=!0)},[m,u,o]),t.jsxs("div",{className:d.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:c.ticketSelectionTitle}),t.jsx(Dd,{label:c.selectAllButtonLabel,checked:m,onChange:w})]}),l.map(y=>t.jsx(Md,{title:y.exhibitionName,exhibition:y,onQuantityChange:b,getTicketQuantity:v,getTotalSelectedTickets:j,userMaxLimit:n,settings:a,labels:c,initialExpanded:e},y.id))]})},Qt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Zt=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},Id=(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},Td=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,lr=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:c,sections:u,onConfirm:f,onClear:h,appliedCount:g,countAriaLabel:m,countDisplay:v="badge",confirmLabel:j=Qt.confirm,clearLabel:b=Qt.clear,isOpen:w,defaultOpen:y=!1,onOpenChange:S,isDisabled:N=!1,closeOnConfirm:k=!0,keepOpenAfterClear:E=!1})=>{const[M,L]=x.useState(y),[A,O]=x.useState(()=>Zt(u)),F=w??M,$=g??u.filter(U=>Td(U)).length,I=U=>{U&&O(Zt(u)),w||L(U),S?.(U)},P=(U,Z)=>{O(Q=>({...Q,[U.id]:Z}))},G=(U,Z)=>{O(Q=>({...Q,[U.id]:Z?[Z]:[]}))},q=async()=>{O(Zt(u.map(U=>U.type==="checkbox"?{...U,selectedValues:[]}:{...U,selectedValue:null}))),await h(),E||I(!1)},W=async()=>{const U=Id(A,u);await f(U),k&&I(!1)},ee=U=>{if(U.type==="checkbox")return t.jsx(d.CheckboxGroup,{label:U.label,value:A[U.id]??[],onValueChange:Q=>P(U,Q),children:U.options.map(Q=>t.jsx(d.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id);const Z=A[U.id]?.[0]??"";return t.jsx(d.RadioGroup,{label:U.label,value:Z,onValueChange:Q=>G(U,Q||null),children:U.options.map(Q=>t.jsx(d.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},U.id)},ae=x.useMemo(()=>$>0?m?.($)||`${$} filters applied`:void 0,[m,$]),re=x.useMemo(()=>$===0?e||Qt.noLabel:m?m($):`${e} (${$})`,[$,e,m]);return t.jsx("div",{className:c,children:t.jsxs(d.Popover,{isOpen:F,onOpenChange:I,placement:"bottom-end",children:[t.jsx(d.PopoverTrigger,{children:t.jsxs(R,{isDisabled:N,variant:a,color:r,size:i,className:o,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(V,{icon:s,width:16}),t.jsx("span",{children:e}),v==="badge"&&$>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":ae,children:$}):v==="summary"&&re!==e?t.jsx("span",{className:"text-xs",children:re}):null]})}),t.jsx(d.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(U=>ee(U)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(R,{variant:"light",color:"default",size:"sm",onPress:q,children:b}),t.jsx(R,{color:"primary",size:"sm",onPress:W,children:j})]})]})})]})})};lr.displayName="FilterPopover";const Pd="No sessions available for this date",_d=e=>e==="sold-out"||e==="closed"?"danger":"success",Od=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"},Rs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Rd=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,or=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:c=Pd,statusLabel:u,statusTone:f,sessionAriaLabel:h,dayButtonClassName:g,calendarSlot:m,dayGroupAriaLabel:v,sessionGridAriaLabel:j,className:b,headingClassName:w,subheadingClassName:y})=>{const S=Rd(s,a),N=s.find(A=>A.date===S),k=i??s.map(A=>({date:A.date,label:A.label})),E=N?.sessions??[],M=A=>A===S?"solid":"bordered",L=A=>{if(!Rs(A)){if(A.id===o){l(null);return}l(A.id)}};return t.jsxs("section",{className:d.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:d.cn("text-base font-semibold text-gray-900",w),children:e}),n?t.jsx("p",{className:d.cn("text-sm text-gray-700",y),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":v||"Session days",children:[k.map(A=>t.jsx(R,{size:"sm",variant:M(A.date),color:"default",className:d.cn("rounded-full",g),isDisabled:A.isDisabled,onPress:()=>{r(A.date)},children:t.jsx("span",{children:A.label})},A.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:[E.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:c}):null,E.map(A=>{const O=Rs(A),F=A.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(d.Card,{shadow:"sm",radius:"lg",isPressable:!O,onPress:()=>{L(A)},"aria-disabled":O,"aria-pressed":O?void 0:F,className:d.cn("w-full",O?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":h?h(A,{isSelected:F,isUnavailable:O}):O?`${A.startTime} ${A.endTime} sold out`:`${A.startTime} ${A.endTime} available`,children:t.jsxs(d.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[A.startTime," – ",A.endTime]}),t.jsx(d.Chip,{size:"sm",color:f?f(A):_d(A.status),variant:"flat",children:u?u(A):Od(A)})]})})},A.id)})]})]})};or.displayName="SessionTimeline";const zd=(e,n)=>typeof e=="string"?t.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,cr=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:c={},"data-testid":u="page-header"})=>{const f=zd(a,r);return t.jsxs("header",{"data-testid":u,className:d.cn("flex flex-wrap items-start justify-between gap-4",l,c.base),children:[t.jsxs("div",{className:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:d.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",c.iconWrapper),children:f}):null,t.jsxs("div",{children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:d.cn("text-brand text-sm font-medium uppercase tracking-wide",c.eyebrow),children:s}):null,t.jsx(o,{"data-testid":`${u}-title`,className:d.cn("text-3xl font-semibold text-gray-950",c.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:d.cn("mt-1 text-sm text-gray-600",c.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:d.cn("flex flex-wrap items-center gap-2",c.actions),children:i}):null]})};cr.displayName="PageHeader";const Bd={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},Vd={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"}},dr=({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 c=Vd[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:d.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:c.fg,backgroundColor:c.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}return t.jsx(d.Chip,{color:r??Bd[e],variant:s,size:a,startContent:i,"data-testid":l,"data-status":e,className:d.cn("font-medium",o),children:n})};dr.displayName="StatusChip";const Ud={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"},zn=({label:e,value:n,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>t.jsxs("span",{"data-testid":r,className:d.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Ud[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})]});zn.displayName="KeyValueChip";const ur=({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:d.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((c,u)=>t.jsx("div",{"data-testid":`${l}-row`,className:d.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",o.row),children:e.map((f,h)=>{const g=h===e.length-1;return t.jsx("div",{className:d.cn(f==="fill"?"flex-1":"shrink-0",r&&g&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:t.jsx("div",{className:d.cn("animate-pulse rounded bg-default-200",o.bar),style:{height:a,width:f==="fill"?"60%":f}})},h)})},u))})]});ur.displayName="TableSkeleton";const fr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",mr="px-4 text-[13.5px] text-acct-ink2 align-middle",hr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",xr="w-full",pr="border-t border-acct-border px-5 py-3.5",gr=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:o={},"data-testid":l="admin-table"})=>t.jsxs("div",{className:d.cn(i,o.base),"data-testid":l,children:[t.jsxs(d.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:d.cn(xr,o.table),th:d.cn(fr,o.th),tr:d.cn(hr,o.tr),td:d.cn(mr,o.td)},children:[t.jsx(d.TableHeader,{columns:e,children:c=>t.jsx(d.TableColumn,{align:c.align==="right"?"end":"start",width:c.width,children:c.label},c.key)}),t.jsx(d.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${l}-footer`,className:d.cn(pr,o.footer),children:a}):null]});gr.displayName="AdminTable";const Hd={md:"w-[280px]",lg:"w-[360px]"},br=({searchValue:e,onSearchChange:n,searchLabel:s,searchIcon:a,children:r,trailing:i,searchWidth:o="md",className:l,"data-testid":c="admin-toolbar"})=>t.jsxs("div",{role:"search","data-testid":c,className:d.cn("flex flex-wrap items-center gap-3 mb-4",l),children:[t.jsx(d.Input,{type:"search","aria-label":s,placeholder:s,value:e,onValueChange:n,startContent:a?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:a}):void 0,"data-testid":`${c}-search`,variant:"bordered",radius:"none",classNames:{base:Hd[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"}}),r,i?t.jsx("div",{className:"ml-auto",children:i}):null]});br.displayName="AdminToolbar";function yr({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(d.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:o=>s(String(o)),"data-testid":i,classNames:{base:d.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"},children:e.map(o=>t.jsx(d.Tab,{title:o.label,"data-testid":`${i}-${o.key}`},o.key))})}yr.displayName="UnderlineTabs";const vr="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",jr=["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(" "),wr="text-[13.5px] text-acct-ink",Nr="bg-acct-page text-acct-muted cursor-default",Cr="mt-[5px] text-xs text-acct-sub",kr="mt-[5px] text-xs text-acct-danger",Sr=({label:e,value:n,onChange:s,placeholder:a,disabled:r=!1,readOnly:i=!1,mono:o=!1,autoFocus:l=!1,hint:c,invalid:u=!1,className:f,"data-testid":h="admin-text-field"})=>t.jsx(d.Input,{labelPlacement:e?"outside":void 0,label:e,value:n,placeholder:a,isDisabled:r,isReadOnly:i,autoFocus:l,isInvalid:u,description:!u&&c?c:void 0,errorMessage:u?c:void 0,onValueChange:s,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:d.cn("w-full",f),label:vr,inputWrapper:jr,input:d.cn(wr,(o||i)&&"font-mono",i&&Nr),description:Cr,errorMessage:kr}});Sr.displayName="AdminTextField";const qd={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},$r=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:d.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(R,{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:d.cn("text-acct-sub data-[hover=true]:bg-acct-hair",qd[n]),children:r.icon},r.key))});$r.displayName="RowActions";const Ar=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:c=!1,className:u,"data-testid":f="picker-row"})=>{const h=e!=null;return t.jsxs("div",{"data-testid":f,className:d.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",c?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(R,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:c,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,h?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]}),h&&a?t.jsx(R,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:c,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Ar.displayName="PickerRow";function Dr(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 Er=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,className:i,classNames:o={},"data-testid":l="pagination-summary"})=>{const{from:c,to:u}=Dr(e,n,s),f=d.cn("font-semibold text-default-700",o.emphasis);return t.jsxs("p",{"data-testid":l,"aria-live":r?"polite":void 0,className:d.cn("text-sm text-default-500",i,o.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${l}-range`,className:f,children:c===0?0:`${c}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${l}-total`,className:f,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};Er.displayName="PaginationSummary";const Fr=({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:c,errorActions:u,errorContent:f,emptyTitle:h="Nothing here yet",emptyDescription:g,emptyIcon:m,emptyActions:v,emptyContent:j,children:b,className:w,classNames:y={},"data-testid":S="list-panel"})=>{const N={base:d.cn("border-0 bg-transparent py-12",y.state)};let k;return e?k=r??t.jsx(On,{title:a,classNames:N,"data-testid":`${S}-loading`}):n?k=f??t.jsx(_n,{title:i,description:o,classNames:N,"data-testid":`${S}-error`,actions:u??(c?t.jsx(R,{color:"primary",variant:"flat",onPress:c,children:l}):void 0)}):s?k=j??t.jsx(Pn,{title:h,description:g,icon:m,actions:v,classNames:N,"data-testid":`${S}-empty`}):k=b,t.jsx("section",{"data-testid":S,className:d.cn("rounded-xl bg-white p-2 shadow-sm",w,y.base),children:k})};Fr.displayName="ListPanel";const Wd=350,Yd={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}"},Xt=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),Kd=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,autoFocus:c=!1,className:u,"data-testid":f="cash-tender-form"})=>{const h={...Yd,...i},g=$n(e.currency,r),m=n!==void 0,[v,j]=x.useState(s??null),b=m?n:v,w=x.useMemo(()=>{const I=typeof b=="number"&&Number.isFinite(b)?b:0,P=ln(I,e.value,e.currency,r);return{received:I,change:P>0?P:0,isValid:I>=e.value&&I>0}},[b,e.value,e.currency,r]),y=x.useCallback(I=>{const P=I.currentTarget;requestAnimationFrame(()=>{P.isConnected&&P.select()})},[]),S=x.useCallback(I=>{if(o)return;const P=I.replace(/[^\d.,]/g,"").replace(",","."),G=P===""?null:Number.parseFloat(P),q=G===null||Number.isNaN(G)?null:G;if(q!==null&&l!==void 0&&q>l)return;m||j(q);const W=typeof q=="number"&&Number.isFinite(q)?q:0,ee=ln(W,e.value,e.currency,r);a?.({received:W,change:ee>0?ee:0,isValid:W>=e.value&&W>0})},[m,o,e.value,e.currency,r,a,l]),N=b==null?"":String(b),k=w.isValid&&w.change>0,E=!w.isValid&&w.received>0,M=we(w.change,r,e.currency),L=we(e.value,r,e.currency),[A,O]=x.useState(""),F=x.useRef(null);x.useEffect(()=>{F.current&&clearTimeout(F.current);const I=k?Xt(h.changeMessageTemplate,{change:M}):"",P=k?Wd:0;return F.current=setTimeout(()=>O(I),P),()=>{F.current&&clearTimeout(F.current)}},[k,M,h.changeMessageTemplate]);const $=`${f}-received`;return t.jsxs("div",{className:d.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(d.Input,{id:$,label:h.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:N,onChange:I=>S(I.target.value),onFocus:y,placeholder:h.receivedPlaceholder,isDisabled:o,isInvalid:E,errorMessage:E?Xt(h.insufficientMessageTemplate,{due:L}):void 0,variant:"bordered",radius:"lg",autoFocus:c,"data-testid":`${f}-received-input`}),k&&t.jsx(d.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:h.changeLabel,description:Xt(h.changeMessageTemplate,{change:M}),icon:t.jsx(V,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:A})]})},Gd={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},zs=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Mr=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:c=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:h,"data-testid":g="check-tender-form"})=>{const m={...Gd,...r},v=n!==void 0,[j,b]=x.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??zs()}),[w,y]=x.useState(!!s?.checkNumber),S=x.useMemo(()=>v?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??zs()}:j,[v,n,j]),N=x.useCallback(F=>{v||b(F);const $=F.checkNumber.trim(),I={amount:e.value,checkNumber:$,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:$.length>0&&e.value>0};a?.(I)},[v,e.value,i,a]),k=x.useCallback(F=>$=>{l||(F==="checkNumber"&&$.length>0&&y(!0),N({...S,[F]:$}))},[S,N,l]),E=x.useCallback(()=>{l||y(!0)},[l]),M=w&&S.checkNumber.trim()==="",L=`${g}-check-number`,A=`${g}-bank-name`,O=`${g}-date`;return t.jsxs("div",{className:d.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",h),"data-testid":g,children:[t.jsx(d.Input,{id:L,label:m.checkNumberLabel,labelPlacement:"outside",type:"text",value:S.checkNumber,onChange:F=>k("checkNumber")(F.target.value),onBlur:E,placeholder:m.checkNumberPlaceholder,maxLength:c,isRequired:!0,isInvalid:M,errorMessage:M?m.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${g}-check-number-input`}),!o&&t.jsx(d.Input,{id:A,label:m.bankNameLabel,labelPlacement:"outside",type:"text",value:S.bankName,onChange:F=>k("bankName")(F.target.value),placeholder:m.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-bank-name-input`}),!i&&t.jsx(d.Input,{id:O,label:m.dateLabel,labelPlacement:"outside",type:"date",value:S.date,onChange:F=>k("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${g}-date-input`,className:"sm:col-span-2"})]})};Mr.displayName="CheckTenderForm";const Qd={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Zd=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Lr=({dueAmount:e,methodOptions:n=Zd,value:s,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:c,"data-testid":u="other-tender-form"})=>{const f={...Qd,...i},h=s!==void 0,[g,m]=x.useState({method:a?.method??"",reference:a?.reference??""}),v=x.useMemo(()=>h?{method:s?.method??"",reference:s?.reference??""}:g,[h,s,g]),j=x.useCallback(k=>n.find(E=>E.value===k)?.label??"",[n]),b=x.useCallback(k=>{h||m(k);const E=j(k.method),M={amount:e.value,method:k.method,description:E,reference:k.reference.trim()||void 0,isValid:k.method!==""};r?.(M)},[h,e.value,r,j]),w=x.useCallback(k=>{if(l)return;const E=typeof k=="string"?k:Array.from(k)[0]?.toString()??"";b({...v,method:E})},[v,b,l]),y=x.useCallback(k=>{l||b({...v,reference:k})},[v,b,l]),S=`${u}-method`,N=`${u}-reference`;return t.jsxs("div",{className:d.cn("flex flex-col gap-3",c),"data-testid":u,children:[t.jsx(Ie,{id:S,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:v.method?[v.method]:[],onSelectionChange:w,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(k=>t.jsx(d.SelectItem,{"data-testid":`${u}-method-option-${k.value}`,children:k.label},k.value))}),o&&t.jsx(d.Input,{id:N,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:v.reference,onChange:k=>y(k.target.value),placeholder:f.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Lr.displayName="OtherTenderForm";const Xd={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Jd={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},eu={pending:"warning",recorded:"success",failed:"danger"},tu=e=>e==="pending"||e==="recorded",nu=e=>`#${e+1}`,Ir=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:o,"data-testid":l="split-payment-summary"})=>{const c={...Xd,...r},{collected:u,remaining:f,isComplete:h}=x.useMemo(()=>{const m=n.reduce((j,b)=>tu(b.status)?j+b.amount:j,0),v=Math.max(e.value-m,0);return{collected:m,remaining:v,isComplete:m>=e.value&&e.value>0}},[n,e.value]),g=m=>m==="pending"?c.statusPending:m==="recorded"?c.statusRecorded:c.statusFailed;return t.jsxs("div",{className:d.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:h?c.completeLabel:c.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${l}-remaining-amount`,children:we(h?u:f,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:c.collectedHeading}),n.map((m,v)=>t.jsx(su,{index:v,tender:m,locale:a,currency:e.currency,removable:!!s&&m.status!=="recorded",onRemove:s?()=>s(m.id):void 0,statusLabel:g(m.status),removeAriaLabel:c.removeAriaLabel,recordedTooltip:c.removeTooltipForRecorded,dataTestId:`${l}-row-${v}`},m.id))]})]})};Ir.displayName="SplitPaymentSummary";const su=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:c,dataTestId:u})=>{const f=i?t.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:d.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(V,{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:nu(e)}),t.jsx(V,{icon:Jd[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:we(n.amount,s,a)}),t.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:eu[n.status],startContent:n.status==="recorded"?t.jsx(V,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(V,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),f&&(r?f:t.jsx(d.Tooltip,{content:c,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":c,children:f})}))]})},au=`
17
17
  @keyframes pp-modal-in {
18
18
  from { opacity: 0; transform: scale(0.96); }
19
19
  to { opacity: 1; transform: scale(1); }
@@ -38,5 +38,5 @@ ${n}${r}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,$a=p.forwardRef(({children:e,relativeOverlayRoot:t=!0,className:n,style:r,"data-testid":a="modal-shell"},i)=>s.jsxs(s.Fragment,{children:[s.jsx("style",{children:Wd}),s.jsx("div",{ref:i,"data-testid":a,style:r,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",t&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));$a.displayName="ModalShell";const Da=({title:e,onClose:t,closeLabel:n="Close",actions:r,className:a,"data-testid":i="modal-shell-header"})=>s.jsxs("header",{className:c.cn("flex items-center justify-between",a),"data-testid":i,children:[s.jsx("h2",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),s.jsxs("div",{className:"flex items-center gap-2",children:[r,t&&s.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:t,"aria-label":n,"data-testid":`${i}-close`,children:s.jsx(V,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Da.displayName="ModalShellHeader";const Ea=({children:e,columns:t=2,className:n,"data-testid":r="modal-shell-footer"})=>s.jsx("footer",{className:c.cn("mt-2 gap-3",t===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",n),"data-testid":r,children:e});Ea.displayName="ModalShellFooter";const Yd={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Gd={1:"grid-cols-1",2:"grid-cols-2"},Xt=e=>typeof e=="string"?s.jsx(V,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Fa=({options:e,selectedKey:t,onSelect:n,heading:r,ariaLabel:a="Select an option",columnsDesktop:i=3,columnsMobile:l=2,className:o,"data-testid":d="tile-select"})=>{const u=e.find(f=>f.key===t);return s.jsxs("div",{className:c.cn("flex flex-col gap-3",o),"data-testid":d,children:[r&&s.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:r}),s.jsx("div",{className:"md:hidden",children:s.jsx(ze,{"aria-label":r?void 0:a,"aria-labelledby":r?`${d}-heading`:void 0,selectedKeys:t?[t]:[],onSelectionChange:f=>{const g=Array.from(f)[0];typeof g=="string"&&n(g)},placeholder:a,variant:"bordered",radius:"lg","data-testid":`${d}-mobile-select`,startContent:u?s.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Xt(u.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(f=>s.jsx(c.SelectItem,{isDisabled:f.isDisabled,startContent:s.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Xt(f.icon)}),"data-testid":f["data-testid"]??`${d}-${f.key}-mobile`,children:f.label},f.key))})}),s.jsx("div",{role:"group","aria-labelledby":r?`${d}-heading`:void 0,"aria-label":r?void 0:a,className:c.cn("hidden md:grid gap-3",Gd[l],Yd[i]),children:e.map(f=>{const m=t===f.key;return s.jsxs(U,{variant:"bordered",radius:"lg","aria-pressed":m,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>n(f.key),"data-testid":f["data-testid"]??`${d}-${f.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",m?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[s.jsx("span",{"aria-hidden":"true",children:Xt(f.icon)}),s.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Fa.displayName="TileSelect";const Kd={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Ia=({total:e,label:t,locale:n="en-US",variant:r="subtle",className:a,"data-testid":i="payment-total-banner"})=>{const l=Kd[r];return s.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,a),children:[s.jsx("div",{className:"text-sm text-default-600",children:t}),s.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:Re(e.value,n,e.currency)})]})};Ia.displayName="PaymentTotalBanner";const Qd={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Ma=({title:e,subtitle:t,backdrop:n="white",exiting:r=!1,className:a,"data-testid":i="loading-overlay"})=>s.jsxs("div",{role:"status","aria-live":r?"off":"polite","aria-hidden":r||void 0,"data-testid":i,"data-state":r?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Qd[n],r?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",a),children:[s.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]"}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),t&&s.jsx("div",{className:"mt-1 text-sm text-default-600",children:t})]})]});Ma.displayName="LoadingOverlay";const zn=({cashChange:e,label:t="Cash to return",secondaryLine:n,locale:r="en-US",onDismiss:a,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 s.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:[s.jsx(V,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),s.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:t}),s.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:Re(e.value,r,e.currency)}),n&&s.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),a&&s.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:a,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:s.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};zn.displayName="PaymentCashChangeBanner";const Ta=({title:e,subtitle:t,emailLine:n,confirmationEmail:r,cashChange:a,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(a&&a.value>0);return s.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[s.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:s.jsx(V,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),s.jsx("p",{className:"text-default-700",children:t}),n&&r&&s.jsxs("p",{className:"text-default-700",children:[n,s.jsx("br",{}),s.jsx("strong",{className:"font-semibold",children:r})]})]}),m&&a&&s.jsx(zn,{cashChange:a,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&s.jsx(U,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Ta.displayName="PaymentSuccessView";const La=({heading:e,amountLabel:t,value:n,defaultValue:r,onChange:a,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:d,autoFocus:u,maxAmount:f,className:m,"data-testid":g="payment-sub-amount-input"})=>{const h=`${g}-input`,N=p.useCallback(b=>{if(f!==void 0){const j=Number.parseFloat(b.replace(",","."));if(Number.isFinite(j)&&j>f)return}a?.(b)},[f,a]),v=p.useCallback(b=>{const j=b.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]);return s.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",m),"data-testid":g,children:[s.jsx("h3",{className:"text-lg font-semibold","data-testid":`${g}-heading`,children:e}),s.jsx(c.Input,{id:h,label:t,labelPlacement:"outside",type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:n,defaultValue:r,onChange:b=>N(b.target.value),onFocus:v,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:o?d:void 0,variant:"bordered",radius:"lg","aria-invalid":o||void 0,autoFocus:u,"data-testid":`${g}-field`})]})};La.displayName="PaymentSubAmountInput";const Zd={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"}},Xd=e=>typeof e=="string"?s.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e,Pa=({isOpen:e,title:t,confirmLabel:n,onConfirm:r,onOpenChange:a,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:g=!1,icon:h,"data-testid":N="confirm-dialog"})=>{const v=i??l??null,b=Zd[d],j=g?null:Xd(h??b.icon);return s.jsx(c.Modal,{isOpen:e,onOpenChange:y=>a?.(y),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":N,children:s.jsxs(c.ModalContent,{role:"alertdialog",children:[s.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[j?s.jsx("div",{"aria-hidden":"true","data-testid":`${N}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:j}):null,s.jsx("span",{"data-testid":`${N}-title`,className:"text-lg font-semibold text-zinc-950",children:t})]}),v!==null?s.jsx(c.ModalBody,{"data-testid":`${N}-body`,className:"gap-0 p-0",children:typeof v=="string"?s.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):null,s.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[s.jsx(U,{variant:"bordered",color:"default",radius:"full",onPress:()=>a?.(!1),isDisabled:u,"data-testid":`${N}-dismiss`,className:"w-full sm:flex-1",children:o}),s.jsx(U,{color:b.confirmColor,variant:"solid",radius:"full",onPress:r,isLoading:u,"data-testid":`${N}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};Pa.displayName="ConfirmDialog";const Jd=60,eu=(e,t,n=Jd)=>t?e>n:e<-n,Oa=(e,t)=>Math.max(0,Math.min(e,t)),tu=160,nu=(e,t,n=tu)=>Math.min(e,Math.max(0,t-n)),su=(e,t,n)=>Oa(e-t,n),ru=(e,t,n)=>e!==null?Oa(e,n):t?n:0,au=e=>e?"":"transition-[height] duration-300 ease-out",iu=e=>({onDrag:(t,n)=>{const r=e.open?e.fullHeight:0;e.setDragHeight(su(r,n?.offset?.y??0,e.fullHeight))},onDragEnd:(t,n)=>{eu(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,t)=>Re(e.value,t,e.currency),Rn=({item:e,locale:t,onRemove:n,removeAriaLabel:r,showRemoveButton:a=!0})=>{const i=!!e.children&&e.children.length>0,l=!!n&&a;return s.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[typeof e.quantity=="number"&&s.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,s.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),s.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&s.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)}),l&&s.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-${e.id}`,onPress:()=>n(e.id),children:s.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&s.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[s.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),s.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&s.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[s.jsx(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),s.jsx("span",{children:e.dateRange.from}),s.jsx(V,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),s.jsx("span",{children:e.dateRange.to})]}),e.details?.map((o,d)=>s.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:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.icon,s.jsx("span",{className:"truncate",children:o.label})]}),(o.value!=null||o.tooltip!=null)&&s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.value!=null&&s.jsx("span",{className:c.cn("whitespace-nowrap",o.valueTone==="primary"&&"font-medium text-primary"),children:o.value}),o.tooltip!=null&&s.jsx(c.Tooltip,{content:o.tooltip,children:s.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${o.key??d}`,className:"flex shrink-0 items-center",children:s.jsx(V,{icon:"lucide:info",width:16,height:16,className:c.cn(o.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},o.key??d)),i&&s.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(o=>s.jsx(Rn,{item:o,locale:t,onRemove:n,removeAriaLabel:r,showRemoveButton:a},o.id))})]})};Rn.displayName="SummaryItemRow";const _a=({fee:e,locale:t,className:n})=>s.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),children:[s.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:[s.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&&s.jsx("span",{className:"size-2 rounded-full bg-primary"})}),s.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),s.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,t)})]});_a.displayName="SummaryServiceFeeRow";const Bn=({row:e,locale:t,emphasized:n,onRemove:r,removeAriaLabel:a,showRemoveButton:i=!0})=>{const l=!!r&&i&&!!e.id,o=s.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,t)});return s.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[s.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c.cn(n?"text-xl font-semibold leading-7":"text-base"),children:e.label}),l?s.jsxs("div",{className:"flex shrink-0 items-center",children:[o,s.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>r(e.id),children:s.jsx(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):o]})};Bn.displayName="SummaryTotalsLineRow";const za=({pricesInLabel:e,currency:t,items:n,serviceFee:r,rows:a,locale:i,onRemoveItem:l,removeAriaLabel:o,showRemoveButton:d,emptyState:u,classNames:f})=>{const m=(n?.length??0)>0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[s.jsx("span",{children:e}),t!=null&&s.jsx("span",{children:t})]}),m?s.jsx("div",{className:c.cn("flex flex-col gap-4",f.items),children:n.map(g=>s.jsx(Rn,{item:g,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:d},g.id))}):s.jsx("div",{"data-testid":"summary-empty",children:u}),r&&s.jsxs(s.Fragment,{children:[s.jsx(c.Divider,{className:"bg-default-200"}),s.jsx(_a,{fee:r,locale:i,className:f.serviceFee})]}),a&&a.length>0&&s.jsx("div",{className:c.cn("flex flex-col gap-4",f.totalsRows),children:a.map((g,h)=>s.jsx(Bn,{row:g,locale:i,emphasized:h===0},g.key))})]})};za.displayName="SummaryBody";const Ra=({total:e,locale:t,className:n})=>s.jsxs("div",{"data-testid":"summary-total",className:c.cn("flex items-center justify-between text-xl font-semibold leading-7 text-foreground",n),children:[s.jsx("span",{children:e.label??"Total"}),s.jsx("span",{"data-testid":"summary-total-amount",className:"whitespace-nowrap text-xl font-semibold leading-7",children:Ye(e.amount,t)})]});Ra.displayName="SummaryGrandTotalRow";const Ba=({secondaryTotal:e,locale:t,className:n})=>s.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),children:[s.jsx("span",{children:e.label}),s.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,t)})]});Ba.displayName="SummarySecondaryTotalRow";const St=({action:e,disabledByLoading:t,className:n,testId:r="summary-cta"})=>s.jsx(U,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":r,isLoading:e.isLoading,isDisabled:e.isDisabled||t,onPress:e.onPress,endContent:s.jsx(V,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});St.displayName="SummaryPrimaryCta";const Va=({title:e,total:t,secondaryTotal:n,locale:r,open:a,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>s.jsx("h2",{children:s.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":a,"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:[s.jsxs("span",{"aria-hidden":!a,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[s.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),s.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:s.jsx(V,{icon:"lucide:x",width:20,height:20})})]}),s.jsxs("span",{"aria-hidden":a,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[s.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[s.jsx("span",{children:t.label??"Total"}),s.jsx("span",{className:"whitespace-nowrap",children:Ye(t.amount,r)})]}),n&&s.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[s.jsx("span",{children:n.label}),s.jsx("span",{className:"whitespace-nowrap",children:Ye(n.amount,r)})]})]})]})});Va.displayName="SummaryCollapseHeader";const Ua=({cart:e,ariaLabel:t,onPress:n,className:r})=>s.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":t,onClick:n,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",r),children:[s.jsx(V,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&s.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})]});Ua.displayName="SummaryCartButton";const Ha=({open:e,progress:t,dragging:n,primaryAction:r,isLoading:a,cart:i,cartAriaLabel:l,ctaCaption:o,onToggleOpen:d,classNames:u})=>s.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",u.mobileBar),children:[s.jsx(c.Divider,{className:"bg-default-200"}),s.jsxs("div",{className:"grid",children:[s.jsxs("div",{"aria-hidden":e,style:{opacity:1-t},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&s.jsx(Ua,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),r&&s.jsx(St,{action:r,disabledByLoading:a,className:c.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),r&&s.jsx("div",{"aria-hidden":!e,style:{opacity:t},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:s.jsx(St,{action:r,disabledByLoading:a,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&s.jsx("div",{children:o})]});Ha.displayName="SummaryActionBar";const lu="(max-width: 767px)",ou=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,cu=(e=lu)=>{const[t,n]=p.useState(()=>ou(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e),a=()=>n(r.matches);return a(),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),t},qa=({title:e="Summary",pricesInLabel:t="Prices are in",currency:n,locale:r="en-US",items:a,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:m,isOpen:g,onToggleOpen:h,defaultOpen:N=!1,primaryAction:v,isLoading:b=!1,onRemoveItem:j,showRemoveButton:y,ctaCaption:S,variant:w,cart:k,emptyState:E,labels:I,classNames:M={},"data-testid":$="summary",className:_})=>{const F=I?.removeAriaLabel??"Remove item",A=I?.removePostTotalRowAriaLabel??"Remove applied code",T=I?.toggleAriaLabel??"Toggle summary",P=I?.cartAriaLabel??"View cart",K=cu(),W=m??(w??(K?"mobile":"main"))==="mobile",[ee,re]=p.useState(N),ae=g!==void 0,B=!W||(ae?g:ee),Z=p.useCallback(()=>{ae||re(xe=>!xe),h?.()},[ae,h]),[Q,H]=p.useState(0),[X,J]=p.useState(null),Ne=p.useRef(null),be=p.useRef(null),he=p.useCallback(()=>{const xe=Ne.current;xe&&H(nu(xe.scrollHeight,window.innerHeight))},[]),Be=p.useCallback(xe=>{be.current?.disconnect(),be.current=null,Ne.current=xe,xe&&(he(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver(he),be.current.observe(xe)))},[he]);p.useEffect(()=>(window.addEventListener("resize",he),()=>window.removeEventListener("resize",he)),[he]);const Me=iu({open:B,fullHeight:Q,setDragHeight:J,onToggleOpen:Z}),Te=X!==null,Le=ru(X,B,Q),Ve=Q>0?Math.min(1,Math.max(0,Le/Q)):B?1:0,De=s.jsx(Ra,{total:o,locale:r,className:M.total}),te=d&&d.length>0&&s.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(xe=>s.jsx(Bn,{row:xe,locale:r,emphasized:!1,onRemove:u,removeAriaLabel:A,showRemoveButton:y},xe.key))}),me=f&&s.jsx(Ba,{secondaryTotal:f,locale:r,className:M.secondaryTotal}),Ee=S!=null&&s.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",M.ctaCaption),children:S}),mt=s.jsx(za,{pricesInLabel:t,currency:n,items:a,serviceFee:i,rows:l,locale:r,onRemoveItem:j,removeAriaLabel:F,showRemoveButton:y,emptyState:E,classNames:M});return W?s.jsxs(Se.motion.section,{"data-testid":$,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Me.onDrag,onDragEnd:Me.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",_,M.base),children:[s.jsx(Va,{title:e,total:o,secondaryTotal:f,locale:r,open:B,progress:Ve,dragging:Te,toggleAriaLabel:T,onToggleOpen:Z,classNames:M}),s.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!B,style:{height:Le},className:c.cn("min-h-0",B&&!Te?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!B&&"pointer-events-none",au(Te)),children:s.jsxs("div",{ref:Be,className:"flex flex-col gap-4 pb-4",children:[mt,s.jsx(c.Divider,{className:"bg-default-200"}),De,te,me]})}),s.jsx(Ha,{open:B,progress:Ve,dragging:Te,primaryAction:v,isLoading:b,cart:k,cartAriaLabel:P,ctaCaption:Ee,onToggleOpen:Z,classNames:M})]}):s.jsxs("section",{"data-testid":$,className:c.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",_,M.base),children:[s.jsx("div",{className:c.cn("flex items-center justify-between",M.header),children:s.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",M.title),children:e})}),mt,s.jsx(c.Divider,{className:"bg-default-200"}),De,te,me,f&&v&&s.jsx(c.Divider,{className:"bg-default-200"}),v&&s.jsx(St,{action:v,disabledByLoading:b,className:c.cn("w-full",M.cta)}),Ee]})};qa.displayName="Summary";exports.AdminTable=da;exports.AdminTextField=ya;exports.AdminToolbar=ua;exports.AppliedCodeCard=Ys;exports.Button=U;exports.CashTenderForm=Pd;exports.CatalogItemCard=Qr;exports.CheckTenderForm=ka;exports.CommitmentDetails=Dc;exports.ConfirmDialog=Pa;exports.ConfirmationModal=Ft;exports.ConfirmationPageTemplate=Jl;exports.DatePicker=Nn;exports.DimensionChip=_n;exports.DonationAmounts=jr;exports.EmptyState=Tn;exports.ErrorState=Ln;exports.EventDetails=Lo;exports.EventDetailsTemplate=no;exports.ExpireCartTimer=wr;exports.FeedbackState=et;exports.FilterPopover=ea;exports.Footer=so;exports.HeroUIProvider=Ni;exports.InstallmentFundAssignment=Cc;exports.InstallmentFundAssignmentSkeleton=Ac;exports.InstallmentSchedule=qc;exports.InstallmentScheduleSkeleton=Zc;exports.InstallmentTable=td;exports.ItemCard=Kr;exports.KeyValueChip=_n;exports.ListPanel=Ca;exports.LoadingOverlay=Ma;exports.LoadingState=Pn;exports.MembershipSelectCards=ad;exports.ModalShell=$a;exports.ModalShellFooter=Ea;exports.ModalShellHeader=Da;exports.Multiselect=ro;exports.Navbar=Xl;exports.OfferCard=wt;exports.OfferCardEmpty=Nr;exports.OfferCardError=Cr;exports.OfferCardList=$r;exports.OfferCardSkeleton=kr;exports.OtherTenderForm=Sa;exports.PageHeader=na;exports.PaginationSummary=Na;exports.PaymentCashChangeBanner=zn;exports.PaymentSubAmountInput=La;exports.PaymentSuccessView=Ta;exports.PaymentTotalBanner=Ia;exports.PickerRow=ja;exports.RICH_TEXT_PRESETS=yr;exports.RedeemCodeInput=Gl;exports.RevenueDistributionCard=Rr;exports.RevenueDistributionEmpty=Br;exports.RevenueDistributionError=Vr;exports.RevenueDistributionSkeleton=Ur;exports.RichTextArea=vr;exports.RowActions=va;exports.Select=ze;exports.SessionTimeline=ta;exports.SplitPaymentSummary=Aa;exports.StatusChip=sa;exports.Stepper=xr;exports.SuccessState=Zr;exports.Summary=qa;exports.TableSkeleton=ra;exports.TicketSelection=jd;exports.TileSelect=Fa;exports.Toggle=Xr;exports.UnderlineTabs=fa;exports.adminFieldErrorClass=ba;exports.adminFieldHintClass=ga;exports.adminFieldLabelClass=ma;exports.adminInputClass=xa;exports.adminInputReadOnlyClass=pa;exports.adminInputWrapperClass=ha;exports.adminRowClass=la;exports.adminSurfaceCss=wi;exports.adminSurfaceTokens=hn;exports.adminTableClass=oa;exports.adminTableFooterClass=ca;exports.adminTdClass=ia;exports.adminThClass=aa;exports.calculateAllocationDifference=mc;exports.computeChange=an;exports.currencyFractionDigits=kn;exports.formatMoney=Re;exports.formatOfferCurrency=on;exports.formatRevenueAmount=cc;exports.formatRevenueCurrency=dc;exports.generateAutomaticInstallments=Wr;exports.generateDistributionId=Mn;exports.getCurrencySymbol=uc;exports.offerCardVariants=Ar;exports.offerListVariants=Sr;exports.pageRange=wa;exports.parseOfferCurrency=Po;exports.parseRevenueCurrency=fc;exports.roundToCurrency=pr;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,Bn=x.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:au}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:d.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})]}));Bn.displayName="ModalShell";const Vn=({title:e,onClose:n,closeLabel:s="Close",actions:a,className:r,"data-testid":i="modal-shell-header"})=>t.jsxs("header",{className:d.cn("flex items-center justify-between",r),"data-testid":i,children:[t.jsx("h2",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),t.jsxs("div",{className:"flex items-center gap-2",children:[a,n&&t.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:n,"aria-label":s,"data-testid":`${i}-close`,children:t.jsx(V,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Vn.displayName="ModalShellHeader";const Un=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:d.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});Un.displayName="ModalShellFooter";const ru={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},iu={1:"grid-cols-1",2:"grid-cols-2"},Jt=e=>typeof e=="string"?t.jsx(V,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Hn=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:o=2,className:l,"data-testid":c="tile-select"})=>{const u=e.find(f=>f.key===n);return t.jsxs("div",{className:d.cn("flex flex-col gap-3",l),"data-testid":c,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${c}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Ie,{"aria-label":a?void 0:r,"aria-labelledby":a?`${c}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:f=>{const g=Array.from(f)[0];typeof g=="string"&&s(g)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${c}-mobile-select`,startContent:u?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(u.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(f=>t.jsx(d.SelectItem,{isDisabled:f.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:Jt(f.icon)}),"data-testid":f["data-testid"]??`${c}-${f.key}-mobile`,children:f.label},f.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${c}-heading`:void 0,"aria-label":a?void 0:r,className:d.cn("hidden md:grid gap-3",iu[o],ru[i]),children:e.map(f=>{const h=n===f.key;return t.jsxs(R,{variant:"bordered",radius:"lg","aria-pressed":h,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${c}-${f.key}`,className:d.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",h?"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:Jt(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Hn.displayName="TileSelect";const lu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},qn=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=lu[a];return t.jsxs("div",{"data-testid":i,className:d.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:d.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:we(e.value,s,e.currency)})]})};qn.displayName="PaymentTotalBanner";const ou={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Tr=({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:d.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",ou[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})]})]});Tr.displayName="LoadingOverlay";const Wn=({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":c="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":c,className:d.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(V,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:d.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":`${c}-amount`,children:we(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(R,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${c}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(V,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Wn.displayName="PaymentCashChangeBanner";const Pr=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:c,className:u,"data-testid":f="payment-success-view"})=>{const h=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:d.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(V,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),h&&r&&t.jsx(Wn,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),c&&t.jsx(R,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:c,"data-testid":`${f}-close`,className:"mt-4 w-full",children:l})]})};Pr.displayName="PaymentSuccessView";const mt=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:o,isInvalid:l,errorMessage:c,autoFocus:u,maxAmount:f,hideHeading:h=!1,className:g,"data-testid":m="payment-sub-amount-input"})=>{const v=`${m}-input`,j=x.useCallback(w=>{if(f!==void 0){const y=Number.parseFloat(w.replace(",","."));if(Number.isFinite(y)&&y>f)return}r?.(w)},[f,r]),b=x.useCallback(w=>{const y=w.currentTarget;requestAnimationFrame(()=>{y.isConnected&&y.select()})},[]);return t.jsxs("div",{className:d.cn("flex flex-col gap-3 border-t border-default-100 pt-5",g),"data-testid":m,children:[t.jsx("h3",{className:d.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${m}-heading`,children:e}),t.jsx(d.Input,{id:v,label:n,labelPlacement:"outside",classNames:h?{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:o,isInvalid:l,errorMessage:l?c:void 0,variant:"bordered",radius:"lg","aria-invalid":l||void 0,autoFocus:u,"data-testid":`${m}-field`})]})};mt.displayName="PaymentSubAmountInput";const cu={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"}},du=e=>typeof e=="string"?t.jsx(V,{icon:e,className:"size-5","aria-hidden":"true"}):e,_r=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:c="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:h=!1,hideIcon:g=!1,icon:m,"data-testid":v="confirm-dialog"})=>{const j=i??o??null,b=cu[c],w=g?null:du(m??b.icon);return t.jsx(d.Modal,{isOpen:e,onOpenChange:y=>r?.(y),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:h||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":v,children:t.jsxs(d.ModalContent,{role:"alertdialog",children:[t.jsxs(d.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[w?t.jsx("div",{"aria-hidden":"true","data-testid":`${v}-icon`,className:d.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:w}):null,t.jsx("span",{"data-testid":`${v}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),j!==null?t.jsx(d.ModalBody,{"data-testid":`${v}-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(d.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(R,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${v}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(R,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${v}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};_r.displayName="ConfirmDialog";const uu=60,fu=(e,n,s=uu)=>n?e>s:e<-s,Or=(e,n)=>Math.max(0,Math.min(e,n)),mu=160,hu=(e,n,s=mu)=>Math.min(e,Math.max(0,n-s)),xu=(e,n,s)=>Or(e-n,s),pu=(e,n,s)=>e!==null?Or(e,s):n?s:0,gu=e=>e?"":"transition-[height] duration-300 ease-out",bu=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(xu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{fu(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,n)=>we(e.value,n,e.currency),Yn=({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:d.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(R,{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(V,{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(V,{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(V,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(V,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((l,c)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${l.key??c}`,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:d.cn("whitespace-nowrap",l.valueTone==="primary"&&"font-medium text-primary"),children:l.value}),l.tooltip!=null&&t.jsx(d.Tooltip,{content:l.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${l.key??c}`,className:"flex shrink-0 items-center",children:t.jsx(V,{icon:"lucide:info",width:16,height:16,className:d.cn(l.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},l.key??c)),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(Yn,{item:l,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},l.id))})]})};Yn.displayName="SummaryItemRow";const Rr=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:d.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:d.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)})]});Rr.displayName="SummaryServiceFeeRow";const Kn=({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:d.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(R,{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(V,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):l]})};Kn.displayName="SummaryTotalsLineRow";const zr=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,showRemoveButton:c,emptyState:u,classNames:f})=>{const h=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":"summary-prices",className:d.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),h?t.jsx("div",{className:d.cn("flex flex-col gap-4",f.items),children:s.map(g=>t.jsx(Yn,{item:g,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:c},g.id))}):t.jsx("div",{"data-testid":"summary-empty",children:u}),a&&t.jsxs(t.Fragment,{children:[t.jsx(d.Divider,{className:"bg-default-200"}),t.jsx(Rr,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:d.cn("flex flex-col gap-4",f.totalsRows),children:r.map((g,m)=>t.jsx(Kn,{row:g,locale:i,emphasized:m===0},g.key))})]})};zr.displayName="SummaryBody";const Br=({total:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-total",className:d.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)})]});Br.displayName="SummaryGrandTotalRow";const Vr=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:d.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)})]});Vr.displayName="SummarySecondaryTotalRow";const $t=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(R,{color:"primary",radius:"full",className:d.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(V,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});$t.displayName="SummaryPrimaryCta";const Ur=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:c,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:c,className:d.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:d.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:d.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:d.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(V,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:d.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)})]})]})]})});Ur.displayName="SummaryCollapseHeader";const Hr=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:d.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(V,{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})]});Hr.displayName="SummaryCartButton";const qr=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,onToggleOpen:c,classNames:u})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:d.cn("flex flex-col gap-4",u.mobileBar),children:[t.jsx(d.Divider,{className:"bg-default-200"}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:d.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(Hr,{cart:i,ariaLabel:o,className:u.cart,onPress:()=>{c?.(),i.onPress?.()}}),a&&t.jsx($t,{action:a,disabledByLoading:r,className:d.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:d.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx($t,{action:a,disabledByLoading:r,className:d.cn("h-[52px] w-full",u.cta)})})]}),l&&t.jsx("div",{children:l})]});qr.displayName="SummaryActionBar";const yu="(max-width: 767px)",vu=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,ju=(e=yu)=>{const[n,s]=x.useState(()=>vu(e));return x.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},Wr=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:c,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:h,isOpen:g,onToggleOpen:m,defaultOpen:v=!1,primaryAction:j,isLoading:b=!1,onRemoveItem:w,showRemoveButton:y,ctaCaption:S,variant:N,cart:k,emptyState:E,labels:M,classNames:L={},"data-testid":A="summary",className:O})=>{const F=M?.removeAriaLabel??"Remove item",$=M?.removePostTotalRowAriaLabel??"Remove applied code",I=M?.toggleAriaLabel??"Toggle summary",P=M?.cartAriaLabel??"View cart",G=ju(),W=h??(N??(G?"mobile":"main"))==="mobile",[ee,ae]=x.useState(v),re=g!==void 0,U=!W||(re?g:ee),Z=x.useCallback(()=>{re||ae(xe=>!xe),m?.()},[re,m]),[Q,H]=x.useState(0),[X,J]=x.useState(null),Ce=x.useRef(null),be=x.useRef(null),he=x.useCallback(()=>{const xe=Ce.current;xe&&H(hu(xe.scrollHeight,window.innerHeight))},[]),Be=x.useCallback(xe=>{be.current?.disconnect(),be.current=null,Ce.current=xe,xe&&(he(),typeof ResizeObserver<"u"&&(be.current=new ResizeObserver(he),be.current.observe(xe)))},[he]);x.useEffect(()=>(window.addEventListener("resize",he),()=>window.removeEventListener("resize",he)),[he]);const Te=bu({open:U,fullHeight:Q,setDragHeight:J,onToggleOpen:Z}),Pe=X!==null,_e=pu(X,U,Q),Ve=Q>0?Math.min(1,Math.max(0,_e/Q)):U?1:0,Ee=t.jsx(Br,{total:l,locale:a,className:L.total}),te=c&&c.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:c.map(xe=>t.jsx(Kn,{row:xe,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:$,showRemoveButton:y},xe.key))}),me=f&&t.jsx(Vr,{secondaryTotal:f,locale:a,className:L.secondaryTotal}),Fe=S!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:d.cn("text-center text-sm text-default-500",L.ctaCaption),children:S}),ht=t.jsx(zr,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:w,removeAriaLabel:F,showRemoveButton:y,emptyState:E,classNames:L});return W?t.jsxs($e.motion.section,{"data-testid":A,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:Te.onDrag,onDragEnd:Te.onDragEnd,className:d.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)]",O,L.base),children:[t.jsx(Ur,{title:e,total:l,secondaryTotal:f,locale:a,open:U,progress:Ve,dragging:Pe,toggleAriaLabel:I,onToggleOpen:Z,classNames:L}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:_e},className:d.cn("min-h-0",U&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",gu(Pe)),children:t.jsxs("div",{ref:Be,className:"flex flex-col gap-4 pb-4",children:[ht,t.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me]})}),t.jsx(qr,{open:U,progress:Ve,dragging:Pe,primaryAction:j,isLoading:b,cart:k,cartAriaLabel:P,ctaCaption:Fe,onToggleOpen:Z,classNames:L})]}):t.jsxs("section",{"data-testid":A,className:d.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",O,L.base),children:[t.jsx("div",{className:d.cn("flex items-center justify-between",L.header),children:t.jsx("h2",{"data-testid":"summary-title",className:d.cn("text-xl font-semibold leading-7 text-foreground",L.title),children:e})}),ht,t.jsx(d.Divider,{className:"bg-default-200"}),Ee,te,me,f&&j&&t.jsx(d.Divider,{className:"bg-default-200"}),j&&t.jsx($t,{action:j,disabledByLoading:b,className:d.cn("w-full",L.cta)}),Fe]})};Wr.displayName="Summary";const wu={back:"Back",close:"Close"},Yr=({onClose:e,steps:n,activeStepId:s,onBack:a,primaryAction:r,footerSummary:i,labels:o,className:l,"data-testid":c="wizard-shell",children:u})=>{const f={...wu,...o},h=n.filter(v=>v.state!=="skipped"),g=n.find(v=>v.id===s),m=Math.max(0,h.findIndex(v=>v.id===s));return t.jsxs(Bn,{className:l,"data-testid":c,children:[t.jsx(Vn,{title:g?.label??"",onClose:e,closeLabel:f.close,"data-testid":`${c}-header`}),t.jsx("div",{"data-testid":`${c}-stepper`,children:t.jsx(Sn,{stepsCount:h.length,currentStep:m,isDisabled:!0})}),u,i,t.jsxs(Un,{columns:a?2:1,"data-testid":`${c}-footer`,children:[a&&t.jsx(R,{variant:"light",onPress:a,"data-testid":`${c}-back`,startContent:t.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:f.back}),t.jsx(R,{color:"primary",isLoading:r.loading,isDisabled:r.disabled,onPress:r.onClick,"data-testid":`${c}-primary`,children:r.label})]})]})};Yr.displayName="WizardShell";const Nu={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location."},Kr=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,labels:r,className:i,"data-testid":o="refund-item-list"})=>{const l={...Nu,...r};return t.jsx("div",{className:d.cn("flex flex-col",i),"data-testid":o,children:e.map(c=>{const u=n[c.id],f=!!u?.selected,h=u?.mode??"full",g=c.state==="already_refunded"||c.state==="non_refundable",m=`${o}-row-${c.id}`,v=we(c.paidAmount.value,void 0,c.paidAmount.currency);return t.jsx("div",{className:d.cn("mb-2 rounded-xl border border-default-200 p-3",f&&"border-primary bg-primary-50"),"data-testid":m,children:t.jsxs("div",{className:"flex items-start gap-3",children:[g?t.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:c.state==="already_refunded"?"default":"warning","data-testid":`${m}-blocked`,children:c.state==="already_refunded"?l.refunded:l.ineligible}):t.jsx(d.Checkbox,{isSelected:f,onValueChange:j=>s(c.id,{selected:j,mode:"full"}),"aria-label":c.name,"data-testid":`${m}-checkbox`}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-semibold",children:c.name}),t.jsxs("span",{className:"text-sm text-default-500",children:["×",c.quantity]})]}),t.jsx("span",{className:"shrink-0 text-sm font-semibold",children:v})]}),c.warning&&t.jsx(d.Chip,{size:"sm",radius:"full",variant:"flat",color:"warning",className:"mt-2",startContent:t.jsx(V,{icon:"gravity-ui:triangle-exclamation-fill",width:14,height:14,"aria-hidden":"true"}),"data-testid":`${m}-warning`,children:c.warning}),!g&&f&&h==="full"&&t.jsx(R,{variant:"light",size:"sm",className:"mt-2 h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"partial"}),"data-testid":`${m}-partial-link`,children:l.partialLink}),!g&&f&&h==="partial"&&t.jsxs("div",{className:"mt-2 flex items-center gap-2","data-testid":`${m}-partial`,children:[t.jsx(mt,{heading:c.name,amountLabel:l.partialLink,hideHeading:!0,maxAmount:c.paidAmount.value,value:u?.partialAmount!==void 0?String(u.partialAmount):void 0,onChange:j=>{const b=Number.parseFloat(j.replace(",","."));s(c.id,{selected:!0,mode:"partial",partialAmount:Number.isFinite(b)?b:void 0})},className:"max-w-[140px] border-t-0 pt-0","data-testid":`${m}-partial-input`}),t.jsx("span",{className:"text-xs text-default-500",children:l.partialOf.replace("{amount}",v)}),t.jsx(R,{variant:"light",size:"sm",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>s(c.id,{selected:!0,mode:"full"}),"data-testid":`${m}-partial-cancel`,children:l.partialCancel})]}),!g&&f&&c.restock.available&&t.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-dashed border-default-200 pt-2",children:[t.jsx(V,{icon:"lucide:rotate-ccw",width:18,height:18,className:"shrink-0 text-default-500","aria-hidden":"true"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-xs font-semibold",children:l.restockTitle}),t.jsx("p",{className:"text-xs text-default-500",children:l.restockHint})]}),t.jsx(d.Switch,{isSelected:c.restock.on,onValueChange:j=>a(c.id,j),"data-testid":`${m}-restock`})]}),!g&&f&&!c.restock.available&&c.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:c.restock.unavailableHint})]})]})},c.id)})})};Kr.displayName="RefundItemList";const Cu={amountLabel:"Refund amount",descriptionLabel:"Add a note",maxHint:"of {amount}"},Gr=({amount:e,description:n,max:s,error:a,onChange:r,labels:i,className:o,"data-testid":l="custom-amount-field"})=>{const c={...Cu,...i},u=c.maxHint.replace("{amount}",we(s.value,void 0,s.currency)),f=x.useCallback(g=>{const m=Number.parseFloat(g.replace(",","."));r({amount:Number.isFinite(m)?m:null,description:n})},[n,r]),h=x.useCallback(g=>{r({amount:e,description:g})},[e,r]);return t.jsxs("div",{className:d.cn("flex flex-col gap-3",o),"data-testid":l,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(mt,{heading:c.amountLabel,amountLabel:c.amountLabel,hideHeading:!0,value:e!==null?String(e):"",placeholder:"$0.00",maxAmount:s.value,isInvalid:!!a,errorMessage:a,onChange:f,className:"max-w-[160px] border-t-0 pt-0","data-testid":`${l}-amount`}),t.jsx("span",{className:"text-xs text-default-500",children:u})]}),t.jsx(d.Input,{label:c.descriptionLabel,labelPlacement:"outside",variant:"bordered",radius:"lg",value:n,onChange:g=>h(g.target.value),"data-testid":`${l}-description`})]})};Gr.displayName="CustomAmountField";const ku={title:"Refund total",partialBadge:"Partial refund"},Qr=({total:e,isPartial:n,labels:s,className:a,"data-testid":r="refund-total-bar"})=>{const i={...ku,...s};return t.jsxs("div",{className:d.cn("flex flex-col items-center gap-2",a),"data-testid":r,children:[t.jsx(qn,{total:e,label:i.title,variant:"subtle",className:"w-full","data-testid":`${r}-banner`}),n&&t.jsx(d.Chip,{color:"warning",size:"sm",radius:"full",variant:"flat","data-testid":`${r}-partial`,children:i.partialBadge})]})};Qr.displayName="RefundTotalBar";const Su={label:"Reason",placeholder:"Select a reason"},Zr=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":o="reason-select"})=>{const l={...Su,...r};return t.jsx(Ie,{label:l.label,labelPlacement:"outside",placeholder:l.placeholder,selectedKeys:n?[n]:[],isInvalid:!!a,errorMessage:a,className:d.cn(i),"data-testid":o,onSelectionChange:c=>{if(c==="all")return;const u=[...c][0];u&&s(String(u))},children:e.map(c=>t.jsx(d.SelectItem,{children:c.label},c.id))})};Zr.displayName="ReasonSelect";const $u={toggle:"Add a note",optionalTag:"(optional)"},Xr=({value:e,onChange:n,maxLength:s,labels:a,className:r,"data-testid":i="notes-field"})=>{const o={...$u,...a},[l,c]=x.useState(e!=="");return t.jsx("div",{className:d.cn(r),"data-testid":i,children:l?t.jsx(d.Textarea,{value:e,onChange:u=>n(u.target.value),maxLength:s,placeholder:o.toggle,"aria-label":o.toggle,variant:"bordered",radius:"lg","data-testid":`${i}-textarea`}):t.jsxs(R,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>c(!0),"data-testid":`${i}-toggle`,children:[o.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:o.optionalTag})]})})};Xr.displayName="NotesField";const Au={legend:"Acting as",manager:"Manager",cashier:"Cashier"},Du=["manager","cashier"],Jr=({role:e,onChange:n,labels:s,className:a,"data-testid":r="acting-as-toggle"})=>{const i={...Au,...s},o=`${r}-legend`;return t.jsxs("div",{className:d.cn("flex items-center gap-2",a),"data-testid":r,children:[t.jsx("span",{id:o,className:"text-xs font-semibold text-default-500",children:i.legend}),t.jsx("div",{role:"group","aria-labelledby":o,className:"inline-flex rounded-lg border border-default-200 p-0.5",children:Du.map(l=>{const c=e===l;return t.jsx(R,{variant:"light",color:"default",radius:"md",size:"sm","aria-pressed":c,onPress:()=>n(l),className:d.cn("h-auto min-w-0 px-3 py-1 text-xs",c?"bg-default-100 font-semibold text-foreground":"text-default-500"),"data-testid":`${r}-${l}`,children:i[l]},l)})})]})};Jr.displayName="ActingAsToggle";const Eu={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"},Fu={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Bs="__split__",ei=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:o,"data-testid":l="money-back-methods"})=>{const c={...Eu,...i},u=x.useMemo(()=>[...e.map(m=>({key:m.tenderId,label:`${m.label} · ${we(m.maxRefundable.value,"en-US",m.maxRefundable.currency)}`,icon:Fu[m.kind],"data-testid":`${l}-tile-${m.tenderId}`})),{key:Bs,label:c.split,icon:"lucide:split","data-testid":`${l}-split`}],[e,c.split,l]),f=m=>{if(m===Bs){a();return}s(m)},h=r?.kind==="processor_declined"?c.declinedTitle:c.networkTitle,g=r?.kind==="processor_declined"?c.declinedBody:c.networkBody;return t.jsxs("div",{className:d.cn("flex flex-col gap-4",o),"data-testid":l,children:[r&&t.jsx(d.Alert,{color:"danger",title:h,description:g,"data-testid":`${l}-error`,children:t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsx(R,{color:"primary",size:"sm",onPress:r.onRetry,"data-testid":`${l}-retry`,children:c.retry}),t.jsx(R,{variant:"bordered",size:"sm",onPress:r.onChooseDifferent,"data-testid":`${l}-choose-different`,children:c.chooseDifferent})]})}),t.jsx(Hn,{heading:c.title,options:u,selectedKey:n,onSelect:f,"data-testid":`${l}-tiles`})]})};ei.displayName="MoneyBackMethods";const Mu=e=>e.refunded!==null,Lu={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",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.",retry:"Try again",chooseDifferent:"Choose different method"},ti=({parts:e,refundedSoFar:n,remaining:s,current:a,onRefundPart:r,partError:i,onBack:o,busy:l,labels:c,className:u,"data-testid":f="split-refund-panel"})=>{const h={...Lu,...c},g=e.filter(Mu),m=e.find(b=>b.tenderId===a.tenderId)?.label,v=x.useCallback(b=>{const w=Number.parseFloat(b.replace(",","."));a.onAmountChange(Number.isFinite(w)?w:0)},[a]),j=i?.kind==="processor_declined"?h.partDeclinedBody:h.partNetworkBody;return t.jsxs("div",{className:d.cn("flex flex-col gap-4",u),"data-testid":f,children:[t.jsx("h3",{className:"text-lg font-semibold","data-testid":`${f}-title`,children:h.title}),i&&t.jsx(d.Alert,{color:"danger",description:j,"data-testid":`${f}-part-error`,children:t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsx(R,{color:"primary",size:"sm",onPress:i.onRetry,"data-testid":`${f}-retry`,children:h.retry}),t.jsx(R,{variant:"bordered",size:"sm",onPress:i.onChooseDifferent,"data-testid":`${f}-choose-different`,children:h.chooseDifferent})]})}),t.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-default-50 p-3","data-testid":`${f}-totals`,children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:h.refundedSoFar}),t.jsx("p",{className:"text-sm font-semibold",children:we(n.value,void 0,n.currency)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:h.remaining}),t.jsx("p",{className:"text-sm font-semibold",children:we(s.value,void 0,s.currency)})]})]}),g.length>0&&t.jsx("div",{className:"flex flex-col gap-2",children:g.map(b=>t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${f}-part-${b.tenderId}-done`,children:[t.jsx("span",{className:"text-sm font-semibold",children:b.label}),t.jsx(d.Chip,{color:"success",size:"sm",radius:"full",variant:"flat",children:we(b.refunded.value,void 0,b.refunded.currency)})]},b.tenderId))}),t.jsxs("div",{className:"rounded-xl border border-primary bg-primary-50 p-3","data-testid":`${f}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold","data-testid":`${f}-amount-label`,children:h.amountForPart}),m&&t.jsx("span",{className:"text-xs text-default-500",children:m})]}),t.jsx(mt,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:v,maxAmount:s.value,isDisabled:l,className:"border-t-0 pt-0","data-testid":`${f}-amount`})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(R,{variant:"light",onPress:o,"data-testid":`${f}-back`,startContent:t.jsx(V,{icon:"lucide:arrow-left",width:18,height:18,"aria-hidden":"true"}),children:h.back}),t.jsx(R,{color:"primary",className:"flex-1",isDisabled:l,isLoading:l,onPress:r,"data-testid":`${f}-submit`,children:h.submit})]})]})};ti.displayName="SplitRefundPanel";const Iu={label:"Enter supervisor PIN",placeholder:"••••"},ni=({pin:e,onChange:n,error:s,labels:a,className:r,"data-testid":i="supervisor-pin-field"})=>{const o={...Iu,...a};return t.jsx(d.Input,{type:"password",inputMode:"numeric",label:o.label,labelPlacement:"outside",placeholder:o.placeholder,value:e,onChange:l=>n(l.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!s,errorMessage:s,variant:"bordered",radius:"lg",className:d.cn(r),"data-testid":`${i}-input`})};ni.displayName="SupervisorPinField";const Tu={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded"},Pu={succeeded:"success",pending:"warning"},si=({state:e,destinations:n,onSendReceipt:s,onDone:a,labels:r,className:i,"data-testid":o="refund-complete-view"})=>{const l={...Tu,...r};return e==="processing"?t.jsx("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:t.jsxs("div",{className:"flex flex-col items-center gap-4 py-8","data-testid":`${o}-processing`,children:[t.jsx(d.Spinner,{size:"lg",color:"primary"}),t.jsx("p",{className:"text-base font-semibold",children:l.processing})]})}):t.jsxs("div",{className:d.cn("flex flex-col items-center gap-4 text-center",i),"aria-live":"polite","data-testid":o,children:[t.jsx(V,{icon:"solar:check-circle-bold",width:46,height:46,className:"text-success","aria-hidden":"true"}),t.jsx("p",{className:"text-xl font-semibold","data-testid":`${o}-title`,children:l.title}),t.jsxs("div",{className:"w-full text-left",children:[t.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.destinationsTitle}),t.jsx("div",{className:"flex flex-col gap-2",children:n.map((c,u)=>t.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-default-200 p-3","data-testid":`${o}-destination-${u}-${c.status}`,children:[t.jsx("span",{className:"text-sm font-semibold",children:c.label}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-default-500",children:we(c.amount.value,void 0,c.amount.currency)}),t.jsx(d.Chip,{color:Pu[c.status],size:"sm",radius:"full",variant:"flat",children:c.status==="succeeded"?l.succeeded:l.pending})]})]},`${c.label}-${u}`))})]}),s&&t.jsxs("div",{className:"w-full text-left",children:[t.jsx("p",{className:"mb-2 text-xs font-semibold uppercase text-default-500",children:l.sendReceipt}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("email"),"data-testid":`${o}-receipt-email`,children:l.email}),t.jsx(R,{variant:"bordered",className:"flex-1",onPress:()=>s("print"),"data-testid":`${o}-receipt-print`,children:l.print})]})]}),t.jsx(R,{color:"primary",className:"w-full",onPress:a,"data-testid":`${o}-done`,children:l.done})]})};si.displayName="RefundCompleteView";exports.ActingAsToggle=Jr;exports.AdminTable=gr;exports.AdminTextField=Sr;exports.AdminToolbar=br;exports.AppliedCodeCard=ta;exports.Button=R;exports.CashTenderForm=Kd;exports.CatalogItemCard=sr;exports.CheckTenderForm=Mr;exports.CommitmentDetails=Bc;exports.ConfirmDialog=_r;exports.ConfirmationModal=Mt;exports.ConfirmationPageTemplate=fo;exports.CustomAmountField=Gr;exports.DatePicker=Cn;exports.DimensionChip=zn;exports.DonationAmounts=Aa;exports.EmptyState=Pn;exports.ErrorState=_n;exports.EventDetails=Yo;exports.EventDetailsTemplate=xo;exports.ExpireCartTimer=Da;exports.FeedbackState=et;exports.FilterPopover=lr;exports.Footer=po;exports.HeroUIProvider=Ti;exports.InstallmentFundAssignment=Pc;exports.InstallmentFundAssignmentSkeleton=Rc;exports.InstallmentSchedule=sd;exports.InstallmentScheduleSkeleton=cd;exports.InstallmentTable=md;exports.ItemCard=nr;exports.KeyValueChip=zn;exports.ListPanel=Fr;exports.LoadingOverlay=Tr;exports.LoadingState=On;exports.MembershipSelectCards=gd;exports.ModalShell=Bn;exports.ModalShellFooter=Un;exports.ModalShellHeader=Vn;exports.MoneyBackMethods=ei;exports.Multiselect=go;exports.Navbar=uo;exports.NotesField=Xr;exports.OfferCard=Nt;exports.OfferCardEmpty=Ea;exports.OfferCardError=Fa;exports.OfferCardList=Ta;exports.OfferCardSkeleton=Ma;exports.OtherTenderForm=Lr;exports.PageHeader=cr;exports.PaginationSummary=Er;exports.PaymentCashChangeBanner=Wn;exports.PaymentSubAmountInput=mt;exports.PaymentSuccessView=Pr;exports.PaymentTotalBanner=qn;exports.PickerRow=Ar;exports.RICH_TEXT_PRESETS=Sa;exports.ReasonSelect=Zr;exports.RedeemCodeInput=io;exports.RefundCompleteView=si;exports.RefundItemList=Kr;exports.RefundTotalBar=Qr;exports.RevenueDistributionCard=Ya;exports.RevenueDistributionEmpty=Ka;exports.RevenueDistributionError=Ga;exports.RevenueDistributionSkeleton=Qa;exports.RichTextArea=$a;exports.RowActions=$r;exports.Select=Ie;exports.SessionTimeline=or;exports.SplitPaymentSummary=Ir;exports.SplitRefundPanel=ti;exports.StatusChip=dr;exports.Stepper=Sn;exports.SuccessState=ar;exports.Summary=Wr;exports.SupervisorPinField=ni;exports.TableSkeleton=ur;exports.TicketSelection=Ld;exports.TileSelect=Hn;exports.Toggle=rr;exports.UnderlineTabs=yr;exports.WizardShell=Yr;exports.adminFieldErrorClass=kr;exports.adminFieldHintClass=Cr;exports.adminFieldLabelClass=vr;exports.adminInputClass=wr;exports.adminInputReadOnlyClass=Nr;exports.adminInputWrapperClass=jr;exports.adminRowClass=hr;exports.adminSurfaceCss=Ii;exports.adminSurfaceTokens=xn;exports.adminTableClass=xr;exports.adminTableFooterClass=pr;exports.adminTdClass=mr;exports.adminThClass=fr;exports.calculateAllocationDifference=kc;exports.computeChange=ln;exports.currencyFractionDigits=$n;exports.formatMoney=we;exports.formatOfferCurrency=cn;exports.formatRevenueAmount=jc;exports.formatRevenueCurrency=wc;exports.generateAutomaticInstallments=Ja;exports.generateDistributionId=Tn;exports.getCurrencySymbol=Nc;exports.offerCardVariants=Ia;exports.offerListVariants=La;exports.pageRange=Dr;exports.parseOfferCurrency=Ko;exports.parseRevenueCurrency=Cc;exports.roundToCurrency=Na;Object.keys(d).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>d[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)}})();