@buildbase/sdk 0.0.16 → 0.0.19

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 (40) hide show
  1. package/README.md +201 -98
  2. package/dist/index.d.ts +594 -198
  3. package/dist/index.esm.js +5 -5
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +5 -5
  6. package/dist/index.js.map +1 -1
  7. package/dist/saas-os.css +1 -1
  8. package/dist/types/api/currency-utils.d.ts +44 -0
  9. package/dist/types/api/index.d.ts +11 -0
  10. package/dist/types/api/pricing-variant-utils.d.ts +53 -0
  11. package/dist/types/api/quota-utils.d.ts +24 -0
  12. package/dist/types/api/types.d.ts +118 -43
  13. package/dist/types/components/beta/api.d.ts +1 -2
  14. package/dist/types/components/pricing/PricingPage.d.ts +3 -1
  15. package/dist/types/components/subscription/index.d.ts +108 -0
  16. package/dist/types/contexts/SubscriptionContext/SubscriptionContext.d.ts +22 -0
  17. package/dist/types/contexts/SubscriptionContext/index.d.ts +2 -0
  18. package/dist/types/contexts/SubscriptionContext/subscriptionInvalidation.d.ts +19 -0
  19. package/dist/types/contexts/SubscriptionContext/types.d.ts +12 -0
  20. package/dist/types/contexts/index.d.ts +2 -0
  21. package/dist/types/contexts/shared/types.d.ts +21 -0
  22. package/dist/types/contexts/shared/useAppDispatch.d.ts +2 -12
  23. package/dist/types/contexts/shared/useAppSelector.d.ts +2 -12
  24. package/dist/types/contexts/shared/utils/reducerHelpers.d.ts +2 -2
  25. package/dist/types/index.d.ts +12 -2
  26. package/dist/types/lib/api-base.d.ts +49 -0
  27. package/dist/types/providers/ContextConfigProvider.d.ts +1 -1
  28. package/dist/types/providers/auth/api.d.ts +12 -0
  29. package/dist/types/providers/auth/hooks.d.ts +2 -0
  30. package/dist/types/providers/os/api.d.ts +11 -0
  31. package/dist/types/providers/os/hooks.d.ts +6 -0
  32. package/dist/types/providers/os/types.d.ts +2 -0
  33. package/dist/types/providers/user/api.d.ts +16 -0
  34. package/dist/types/providers/user/hooks.d.ts +1 -0
  35. package/dist/types/providers/workspace/api.d.ts +2 -5
  36. package/dist/types/providers/workspace/hooks.d.ts +11 -1
  37. package/dist/types/providers/workspace/subscription-hooks.d.ts +2 -1
  38. package/dist/types/providers/workspace/types.d.ts +18 -1
  39. package/dist/types/providers/workspace/ui/SubscriptionDialog.d.ts +7 -1
  40. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),s=n(r);function o(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=o(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function i(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=o(e))&&(n&&(n+=" "),n+=t);return n}exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";const c=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),l="-",d=[],u=e=>{const t=m(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return p(e);const r=e.split(l),n=""===r[0]&&r.length>1?1:0;return f(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||d}return r[e]||d}}},f=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=f(e,t+1,a);if(r)return r}const s=r.validators;if(null===s)return;const o=0===t?e.join(l):e.slice(t).join(l),i=s.length;for(let e=0;e<i;e++){const t=s[e];if(t.validator(o))return t.classGroupId}},p=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),m=e=>{const{theme:t,classGroups:r}=e;return h(r,t)},h=(e,t)=>{const r=c();for(const n in e){const a=e[n];g(a,r,n,t)}return r},g=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const a=e[s];b(a,t,r,n)}},b=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?x(e,t,r,n):v(e,t,r,n):y(e,t,r)},y=(e,t,r)=>{(""===e?t:w(t,e)).classGroupId=r},v=(e,t,r,n)=>{S(e)?g(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},x=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){const[s,o]=a[e];g(o,w(t,s),r,n)}},w=(e,t)=>{let r=e;const n=t.split(l),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=c(),r.nextPart.set(t,a)),r=a}return r},S=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,k=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,s)=>{r[a]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},j=[],E=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),A=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,s=0;const o=e.length;for(let i=0;i<o;i++){const o=e[i];if(0===n&&0===a){if(":"===o){t.push(e.slice(s,i)),s=i+1;continue}if("/"===o){r=i;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}const i=0===t.length?e:e.slice(s);let c=i,l=!1;i.endsWith("!")?(c=i.slice(0,-1),l=!0):i.startsWith("!")&&(c=i.slice(1),l=!0);return E(t,l,c,r&&r>s?r-s:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):E(j,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},N=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const s=e[a],o="["===s[0],i=t.has(s);o||i?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(s)):n.push(s)}return n.length>0&&(n.sort(),r.push(...n)),r}},C=/\s+/,_=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=_(e[n]))&&(r&&(r+=" "),r+=t);return r},T=(e,...t)=>{let r,n,a,s;const o=e=>{const t=n(e);if(t)return t;const s=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],i=e.trim().split(C);let c="";for(let e=i.length-1;e>=0;e-=1){const t=i[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:s(d).join(":"),b=u?g+"!":g,y=b+h;if(o.indexOf(y)>-1)continue;o.push(y);const v=a(h,m);for(let e=0;e<v.length;++e){const t=v[e];o.push(b+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,s),s};return s=i=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:k(e.cacheSize),parseClassName:A(e),sortModifiers:N(e),...u(e)}))(c),n=r.cache.get,a=r.cache.set,s=o,o(i)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=_(t))&&(a&&(a+=" "),a+=r);return a})(...e))},R=[],P=e=>{const t=t=>t[e]||R;return t.isThemeGetter=!0,t},O=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I=/^\((?:(\w[\w-]*):)?(.+)\)$/i,D=/^\d+\/\d+$/,U=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,F=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,z=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,L=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$=e=>D.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),W=e=>!!e&&Number.isInteger(Number(e)),B=e=>e.endsWith("%")&&V(e.slice(0,-1)),G=e=>U.test(e),H=()=>!0,K=e=>M.test(e)&&!F.test(e),Z=()=>!1,q=e=>z.test(e),J=e=>L.test(e),Y=e=>!Q(e)&&!se(e),X=e=>fe(e,ge,Z),Q=e=>O.test(e),ee=e=>fe(e,be,K),te=e=>fe(e,ye,V),re=e=>fe(e,me,Z),ne=e=>fe(e,he,J),ae=e=>fe(e,xe,q),se=e=>I.test(e),oe=e=>pe(e,be),ie=e=>pe(e,ve),ce=e=>pe(e,me),le=e=>pe(e,ge),de=e=>pe(e,he),ue=e=>pe(e,xe,!0),fe=(e,t,r)=>{const n=O.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},pe=(e,t,r=!1)=>{const n=I.exec(e);return!!n&&(n[1]?t(n[1]):r)},me=e=>"position"===e||"percentage"===e,he=e=>"image"===e||"url"===e,ge=e=>"length"===e||"size"===e||"bg-size"===e,be=e=>"length"===e,ye=e=>"number"===e,ve=e=>"family-name"===e,xe=e=>"shadow"===e,we=T(()=>{const e=P("color"),t=P("font"),r=P("text"),n=P("font-weight"),a=P("tracking"),s=P("leading"),o=P("breakpoint"),i=P("container"),c=P("spacing"),l=P("radius"),d=P("shadow"),u=P("inset-shadow"),f=P("text-shadow"),p=P("drop-shadow"),m=P("blur"),h=P("perspective"),g=P("aspect"),b=P("ease"),y=P("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",se,Q],x=()=>[se,Q,c],w=()=>[$,"full","auto",...x()],S=()=>[W,"none","subgrid",se,Q],k=()=>["auto",{span:["full",W,se,Q]},W,se,Q],j=()=>[W,"auto",se,Q],E=()=>["auto","min","max","fr",se,Q],A=()=>["auto",...x()],N=()=>[$,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],C=()=>[e,se,Q],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",ce,re,{position:[se,Q]}],T=()=>["auto","cover","contain",le,X,{size:[se,Q]}],R=()=>[B,oe,ee],O=()=>["","none","full",l,se,Q],I=()=>["",V,oe,ee],D=()=>[V,B,ce,re],U=()=>["","none",m,se,Q],M=()=>["none",V,se,Q],F=()=>["none",V,se,Q],z=()=>[V,se,Q],L=()=>[$,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[G],breakpoint:[G],color:[H],container:[G],"drop-shadow":[G],ease:["in","out","in-out"],font:[Y],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[G],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[G],shadow:[G],spacing:["px",V],text:[G],"text-shadow":[G],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$,Q,se,g]}],container:["container"],columns:[{columns:[V,Q,se,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[W,"auto",se,Q]}],basis:[{basis:[$,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[V,$,"auto","initial","none",Q]}],grow:[{grow:["",V,se,Q]}],shrink:[{shrink:["",V,se,Q]}],order:[{order:[W,"first","last","none",se,Q]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[i,"screen",...N()]}],"min-w":[{"min-w":[i,"screen","none",...N()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,oe,ee]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,se,te]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",B,Q]}],"font-family":[{font:[ie,Q,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,se,Q]}],"line-clamp":[{"line-clamp":[V,"none",se,te]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",se,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[V,"from-font","auto",se,ee]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[V,"auto",se,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},W,se,Q],radial:["",se,Q],conic:[W,se,Q]},de,ne]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:O()}],"rounded-s":[{"rounded-s":O()}],"rounded-e":[{"rounded-e":O()}],"rounded-t":[{"rounded-t":O()}],"rounded-r":[{"rounded-r":O()}],"rounded-b":[{"rounded-b":O()}],"rounded-l":[{"rounded-l":O()}],"rounded-ss":[{"rounded-ss":O()}],"rounded-se":[{"rounded-se":O()}],"rounded-ee":[{"rounded-ee":O()}],"rounded-es":[{"rounded-es":O()}],"rounded-tl":[{"rounded-tl":O()}],"rounded-tr":[{"rounded-tr":O()}],"rounded-br":[{"rounded-br":O()}],"rounded-bl":[{"rounded-bl":O()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[V,se,Q]}],"outline-w":[{outline:["",V,oe,ee]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",d,ue,ae]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",u,ue,ae]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[V,ee]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",f,ue,ae]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[V,se,Q]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[se,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,Q]}],filter:[{filter:["","none",se,Q]}],blur:[{blur:U()}],brightness:[{brightness:[V,se,Q]}],contrast:[{contrast:[V,se,Q]}],"drop-shadow":[{"drop-shadow":["","none",p,ue,ae]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",V,se,Q]}],"hue-rotate":[{"hue-rotate":[V,se,Q]}],invert:[{invert:["",V,se,Q]}],saturate:[{saturate:[V,se,Q]}],sepia:[{sepia:["",V,se,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",se,Q]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[V,se,Q]}],"backdrop-contrast":[{"backdrop-contrast":[V,se,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",V,se,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,se,Q]}],"backdrop-invert":[{"backdrop-invert":["",V,se,Q]}],"backdrop-opacity":[{"backdrop-opacity":[V,se,Q]}],"backdrop-saturate":[{"backdrop-saturate":[V,se,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",V,se,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[V,"initial",se,Q]}],ease:[{ease:["linear","initial",b,se,Q]}],delay:[{delay:[V,se,Q]}],animate:[{animate:["none",y,se,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,se,Q]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:M()}],"rotate-x":[{"rotate-x":M()}],"rotate-y":[{"rotate-y":M()}],"rotate-z":[{"rotate-z":M()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[se,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,Q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,Q]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[V,oe,ee,te]}],stroke:[{stroke:["none",...C()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Se(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function ke(...e){return we(i(e))}let je=!0;function Ee(e,...t){console.error(e,...t)}function Ae(e){if(null==e)return e;if("object"!=typeof e)return e;const t=new Set(["authorization","token","password","accessToken","refreshToken"]);if(Array.isArray(e))return e.map(Ae);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ae(a);return r}function Ne(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function Ce(e,t){try{const r=await fetch(e,t);if(Se()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const s=r.clone();let o;try{const e=await s.text();if(e)try{o=JSON.parse(e)}catch{o=e.substring(0,200)+(e.length>200?"...":"")}}catch{o="(read failed)"}!function(e,...t){je&&Se()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ae(a),response:Ae(o),status:r.status})}return r}catch(e){if(Ne(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function _e(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function Te(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Re(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await Te(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await Te(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Pe extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,Pe)}}const Oe=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e},void 0!==e.enableConsoleLogging&&function(e){void 0!==e.enableLogging&&(je=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Ne(e))return;const r=e instanceof Error?e:new Pe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Pe?r:new Pe(r.message,r.name,t,r);if(this.config.enableConsoleLogging&&function(e,...t){je&&Se()&&console.error(e,...t)}(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){Ee("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function Ie(e,t={}){Oe.handleError(e,t)}function De(e,t={}){return!Ne(e)&&(Oe.handleError(e,t),!0)}class Ue extends t.Component{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(Ie(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ee("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const Me=()=>({type:"AUTHENTICATION_STARTED"}),Fe=()=>({type:"AUTHENTICATION_PROCESSING"}),ze=()=>({type:"AUTHENTICATION_FAILED"}),Le=e=>({type:"SET_SESSION",payload:e}),$e=()=>({type:"REMOVE_SESSION"});function Ve(e,r,n){const a=t.useRef(r),s=t.useRef(n),o=t.useRef(void 0),i=t.useRef(e);return a.current=r,s.current=n,t.useMemo(()=>{const t=a.current(e);if(void 0!==o.current){if((s.current?s.current(o.current,t):Object.is(o.current,t))&&i.current===e)return o.current}return o.current=t,i.current=e,t},[e])}function We({name:r,initialState:n,reducer:a,initializer:s}){const o=t.createContext(null),i=t.createContext(null),c=t.createContext(null),l=t.memo(({children:r})=>{const[l,d]=t.useReducer(a,n,s||(e=>e)),u=t.useMemo(()=>({state:l,dispatch:d}),[l,d]);return e.jsx(c.Provider,{value:u,children:e.jsx(o.Provider,{value:l,children:e.jsx(i.Provider,{value:d,children:r})})})});l.displayName=`${r}Provider`;const d=()=>{const e=t.useContext(o);if(null===e)throw new Error(`use${r}State must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e};return{Provider:l,useContext:()=>{const e=t.useContext(c);if(!e)throw new Error(`use${r}Context must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useState:d,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw new Error(`use${r}Dispatch must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`);return e},useSelector:(e,t)=>{const r=e||(e=>e);return Ve(d(),r,t)}}}function Be(e,t,r){return{...e,[t]:r}}function Ge(e,t){return{...e,...t}}var He;function Ke(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function Ze(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return Ie(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function qe(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){Ie(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function Je(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){Ie(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}exports.AuthStatus=void 0,(He=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",He.redirecting="redirecting",He.authenticated="authenticated",He.unauthenticated="unauthenticated",He.authenticating="authenticating";const Ye="code",Xe="saas-session-id",Qe="saas-workspace-current";function et(e,t,r){const n=e._id||e.id;if(!n||"string"!=typeof n)throw new Error("User data missing required ID field");if(!e.email||"string"!=typeof e.email)throw new Error("User data missing required email field");return{id:n,name:e.name||"",org:t,email:e.email,emailVerified:!0,clientId:r,role:e.role||"",image:e.image}}function tt(){Je(Xe)}function rt(){if("undefined"==typeof window)return null;try{return Ze(Xe)}catch(e){return Ie(e,{component:"auth/utils",action:"getSessionId",metadata:{key:Xe}}),null}}function nt(){const e=rt(),t={};return e&&(t["x-session-id"]=e),t}function at(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(Ye)}catch(e){return Ie(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:Ye}}),null}}function st(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const ot=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:it,useState:ct,useDispatch:lt}=We({name:"Auth",initialState:ot(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return Be(e,"status",exports.AuthStatus.redirecting);case"AUTHENTICATION_PROCESSING":return Be(e,"status",exports.AuthStatus.authenticating);case"AUTHENTICATION_FAILED":return Ge(e,{session:null,status:exports.AuthStatus.unauthenticated});case"SET_SESSION":{const n=t.payload;return r=n.sessionId,qe(Xe,r),Ge(e,{session:n,status:exports.AuthStatus.authenticated})}case"REMOVE_SESSION":return tt(),Ge(e,{session:null,status:exports.AuthStatus.unauthenticated});default:return e}var r},initializer:ot}),dt=it,ut=ct,ft=lt,pt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),mt=e=>({type:"SET_SETTINGS",payload:e}),ht=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:gt,useState:bt,useDispatch:yt}=We({name:"OS",initialState:ht(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return Ge(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return ht();case"SET_SETTINGS":return Be(e,"settings",t.payload);default:return e}}}),vt=gt,xt=bt,wt=yt,St=e=>({type:"SET_WORKSPACES",payload:e}),kt=e=>({type:"SET_ALL_FEATURES",payload:e}),jt=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),Et=()=>({type:"RESET_CURRENT_WORKSPACE"}),At=e=>({type:"SET_IS_INITIALIZED",payload:e}),Nt=e=>({type:"SET_LOADING",payload:e}),Ct=e=>({type:"SET_ERROR",payload:e}),_t=e=>({type:"SET_REFRESHING",payload:e}),Tt=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),Rt=e=>{e?qe(Qe,e._id):Je(Qe)},Pt=()=>Ze(Qe),Ot=()=>{Je(Qe)},It=(e,t)=>!!e&&t.some(t=>t._id===e);function Dt(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function Ut(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>{if("string"==typeof e)return e===t;if("object"==typeof e&&null!==e&&"_id"in e){return e._id===t}return!1});return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}const{Provider:Mt,useState:Ft,useDispatch:zt}=We({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switchingToId:null,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return Be(e,"workspaces",t.payload);case"SET_ALL_FEATURES":return Be(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return Rt(t.payload),Be(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return Ot(),Be(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return Be(e,"isInitialized",t.payload);case"SET_LOADING":return Be(e,"loading",t.payload);case"SET_ERROR":return Be(e,"error",t.payload);case"SET_REFRESHING":return Be(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return Be(e,"switchingToId",t.payload);default:return e}}}),Lt=Mt,$t=Ft,Vt=zt,Wt=t.memo(({children:t})=>e.jsx(vt,{children:e.jsx(dt,{children:e.jsx(Lt,{children:t})})}));function Bt(e,r){const n=xt(),a=ut(),s=$t(),o=e||(e=>e);return Ve(t.useMemo(()=>({os:n,auth:a,workspaces:s}),[n,a,s]),o,r)}function Gt(){const e=ft(),r=wt(),n=Vt();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}function Ht(e,r,n){t.useEffect(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Ne(e)||(n?.onError?n.onError(e):Ie(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},r)}Wt.displayName="SDKContextProvider";const Kt=t.memo(({children:r,callbacks:n})=>{const a=Gt(),s=Bt(e=>e.auth),o=Bt(e=>e.os),i=Ke(s.status).isAuthenticated,c=t.useRef(!1),l=t.useRef(null),d=t.useRef(!1),u=t.useMemo(()=>n,[n]),f=t.useCallback(async e=>{try{if(u?.handleAuthentication){const{sessionId:t}=await u.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=o,{serverUrl:n,version:s,orgId:i}=r;if(!n||!s||!i)throw new Error("OS configuration is not available");const c=await Ce(`${n}/api/${s}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"}}),l=await Re(c,"Failed to fetch user profile"),d=st(et(l,i,r.auth?.clientId||""),t);a.auth(Le(d)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(Ye),window.history.replaceState({},"",e.toString())}catch(e){Ie(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:Ye}})}}()}}catch(t){throw Ie(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(ze()),t}},[a,u,o]);return Ht(async e=>{if("undefined"==typeof window)return;if(i)return;if(d.current)return;if(at())return;const t=rt();if(t){d.current=!0;try{const{serverUrl:r,version:n,orgId:s}=o;if(!r||!n||!s)return d.current=!1,void Ie(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});let i;try{const a=await Ce(`${r}/api/${n}/public/profile`,{headers:{"x-session-id":t,"Content-Type":"application/json"},signal:e});i=await Re(a,"Failed to fetch user profile")}catch(e){if(!De(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return d.current=!1,tt(),void a.auth(ze())}const c=st(et(i,s,o.auth?.clientId||""),t);a.auth(Le(c))}catch(e){if(!De(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:e instanceof Error&&("User data missing required ID field"===e.message||"User data missing required email field"===e.message)?"validateUserData":"pageLoad"}}))return;tt(),a.auth(ze())}finally{d.current=!1}}else a.auth(ze())},[i,a,o]),t.useEffect(()=>{const e=at();if(!e)return;if(c.current||l.current===e)return;const{serverUrl:t,version:r,orgId:n}=o;t&&r&&n&&(c.current=!0,l.current=e,a.auth(Fe()),f(e).then(()=>{l.current=null}).catch(t=>{Ie(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),l.current=null}).finally(()=>{c.current=!1}))},[f,o.serverUrl,o.version,o.orgId]),e.jsx(e.Fragment,{children:r})});Kt.displayName="AuthProviderWrapper";const Zt=t.memo(({config:r,auth:n,children:a})=>{const s=Gt(),o=Bt(e=>e.os),i=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);return t.useEffect(()=>{s.os(pt({...r,auth:i}))},[r,i,s]),Ht(async e=>{const{serverUrl:t,version:r,orgId:n,settings:a}=o;if(!t||!r||!n||a)return;const i=nt(),c=await Ce(`${t}/api/${r}/public/${n}/settings`,{headers:i,signal:e});if(c.ok){const e=await c.json();s.os(mt(e))}},[o.serverUrl,o.version,o.orgId,o.settings,s],{onError:e=>Ie(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:o.serverUrl,version:o.version,orgId:o.orgId}})}),e.jsx(e.Fragment,{children:a})});Zt.displayName="ContextConfigProvider";const qt=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){Ie(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}},Jt=t.createContext({container:null,setContainer:()=>{}}),Yt=t.memo(({children:r})=>{const[n,a]=t.useState(null),s=t.useMemo(()=>({container:n,setContainer:a}),[n]),o=t.useMemo(()=>r,[r]);return e.jsxs(Jt.Provider,{value:s,children:[o,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Yt.displayName="PortalProvider";const Xt=t.createContext(void 0),Qt=t.memo(({children:r})=>{const n=Bt(e=>e.os),a=Bt(e=>e.auth),{serverUrl:s,version:o}=n,i=Ke(a.status).isAuthenticated,[c,l]=t.useState({}),[d,u]=t.useState({}),[f,p]=t.useState(!1),[m,h]=t.useState(null),g=t.useCallback(async e=>{if(s&&o&&i)try{const t=await Ce(`${s}/api/${o}/public/users/attributes`,{headers:nt(),signal:e});if(!t.ok)throw new Error(await _e(t,"Failed to fetch user attributes"));const r=await t.json();r&&"object"==typeof r&&!Array.isArray(r)?l(r):l({})}catch(e){if(Ne(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");h(t),Ie(e,{component:"UserProvider",action:"fetchAttributes"})}else l({})},[s,o,i]),b=t.useCallback(async()=>{if(s&&o&&i){p(!0),h(null);try{await g()}finally{p(!1)}}},[s,o,i,g]),y=t.useCallback(async e=>{if(!s||!o)throw new Error("Server URL or version is missing");p(!0),h(null);try{const t=await Ce(`${s}/api/${o}/public/users/attributes`,{method:"PATCH",headers:{"Content-Type":"application/json",...nt()},body:JSON.stringify({attributes:e})});if(!t.ok)throw new Error(await _e(t,"Failed to update user attributes"));const r=await t.json();return await g(),r}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw h(r),Ie(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),r}finally{p(!1)}},[s,o,g]),v=t.useCallback(async(e,t)=>{if(!s||!o)throw new Error("Server URL or version is missing");p(!0),h(null);try{const r=await Ce(`${s}/api/${o}/public/users/attributes/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...nt()},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(await _e(r,"Failed to update user attribute"));const n=await r.json();return await g(),n}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw h(n),Ie(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),n}finally{p(!1)}},[s,o,g]),x=t.useCallback(async e=>{if(s&&o&&i)try{const t=await Ce(`${s}/api/${o}/public/users/features`,{headers:nt(),signal:e});if(!t.ok)throw new Error(await _e(t,"Failed to fetch user features"));const r=await t.json();u("object"==typeof r?r:{})}catch(e){if(Ne(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");h(t),Ie(e,{component:"UserProvider",action:"fetchFeatures"})}else u({})},[s,o,i]),w=t.useCallback(async()=>{if(s&&o&&i){p(!0),h(null);try{await x()}finally{p(!1)}}},[s,o,i,x]);Ht(async e=>{if(!i||!s||!o)return l({}),void u({});p(!0),h(null);try{await Promise.all([g(e),x(e)])}finally{p(!1)}},[i,s,o,g,x],{onError:e=>Ie(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const S=t.useMemo(()=>({attributes:c,features:d,isLoading:f,error:m,updateAttributes:y,updateAttribute:v,refreshAttributes:b,refreshFeatures:w}),[c,d,f,m,y,v,b,w]);return e.jsx(Xt.Provider,{value:S,children:r})});Qt.displayName="UserProvider";class er{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}getAuthHeader(){return nt()}async getWorkspaces(){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces`,{headers:this.getAuthHeader()}),"Failed to fetch workspaces")}async createWorkspace(e){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)}),"Failed to create workspace")}async updateWorkspace(e,t){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to update workspace")}async deleteWorkspace(e){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to delete workspace")}async getWorkspaceUsers(e){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users`,{headers:this.getAuthHeader()}),"Failed to fetch workspace users")}async addUser(e,t){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/add`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)}),"Failed to invite member")}async removeUser(e,t){return Re(await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"DELETE",headers:this.getAuthHeader()}),"Failed to remove user")}async updateUser(e,t,r){const n=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/users/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(r)});if(!n.ok){const e=await n.json();throw new Error(e.message||"Failed to update user")}return n.json()}async getFeatures(){const e=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/features`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch features");return e.json()}async updateFeature(e,t,r){const n=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/features`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify({features:{[t]:r}})});if(!n.ok)throw new Error("Failed to update feature");return n.json()}async getWorkspace(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}`,{headers:this.getAuthHeader()});if(!t.ok)throw new Error("Failed to fetch workspace");return t.json()}async getProfile(){const e=await Ce(`${this.serverUrl}/api/${this.version}/public/profile`,{headers:this.getAuthHeader()});if(!e.ok)throw new Error("Failed to fetch profile");return e.json()}async updateUserProfile(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/profile`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to update user profile");return t.json()}async getCurrentSubscription(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data}return r}async getPlanGroup(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group found for this workspace":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group");return r.data}return r}async getPlanGroupByVersion(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group?groupVersionId=${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch plan group version";try{e=(await r.json()).message||e}catch{e=404===r.status?"Plan group version not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch plan group version");return n.data}return n}async getPlanGroupVersions(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/plan-group/versions`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group versions";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group versions found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group versions (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group versions");return r.data}return r}async getPublicPlans(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/${this.orgId}/plans/${encodeURIComponent(e)}`,{headers:this.getAuthHeader()});if(!t.ok){let r="Failed to fetch plans";try{r=(await t.json()).message||r}catch{r=404===t.status?`Plans "${e}" not found`:`Failed to fetch plans (${t.status}: ${t.statusText})`}throw new Error(r)}const r=await t.json();if(void 0!==r.success&&!r.success)throw new Error(r.message||"Failed to fetch plans");return r.data??r}async getPlanGroupVersion(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/plan-group-versions/${e}`,{headers:this.getAuthHeader()});if(!t.ok){let e="Failed to fetch plan group version";try{e=(await t.json()).message||e}catch{e=404===t.status?"Plan group version not found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group version");return r.data}return r}async createCheckoutSession(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/checkout`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to create checkout session";try{e=(await r.json()).message||e}catch{e=`Failed to create checkout session (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to create checkout session");return n.data||n}return n}async updateSubscription(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription`,{method:"PATCH",headers:{"Content-Type":"application/json",...this.getAuthHeader()},body:JSON.stringify(t)});if(!r.ok){let e="Failed to update subscription";try{e=(await r.json()).message||e}catch{e=`Failed to update subscription (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to update subscription");return n.data?.checkoutUrl||n.checkoutUrl?n.data||n:n.data}return n.checkoutUrl,n}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices?${n.toString()}`,{headers:this.getAuthHeader()});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const s=await a.json();if(void 0!==s.success){if(!s.success)throw new Error(s.message||"Failed to fetch invoices");return s}return s}async getInvoice(e,t){const r=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/invoices/${t}`,{headers:this.getAuthHeader()});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}async cancelSubscriptionAtPeriodEnd(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/cancel-at-period-end`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()}});if(!t.ok){let e="Failed to cancel subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to cancel subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to cancel subscription");return r.data||r}return r}async resumeSubscription(e){const t=await Ce(`${this.serverUrl}/api/${this.version}/public/workspaces/${e}/subscription/resume`,{method:"POST",headers:{"Content-Type":"application/json",...this.getAuthHeader()}});if(!t.ok){let e="Failed to resume subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to resume subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to resume subscription");return r.data||r}return r}}const tr=()=>{const e=Gt(),r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),a=Bt(e=>e.workspaces),s=Bt(e=>e.auth.session?.user),o=t.useCallback((t,r)=>{if((!(t._id===a.currentWorkspace?._id)||r?.forceEmit)&&t){const r=a.currentWorkspace;e.workspaces(jt(t)),qt.emitWorkspaceChanged(t,r).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]),i=t.useCallback(async(t,n)=>{const a=++u.current;e.workspaces(Tt(t._id));try{const e=r.auth?.callbacks?.onWorkspaceChange;if(e){const r=Ut(t,s?.id);try{await e({workspace:t,user:s??null,role:r})}catch(e){throw Ie(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:t._id}}),e}if(a!==u.current)return}o(t,n)}finally{a===u.current&&e.workspaces(Tt(null))}},[e,r.auth?.callbacks?.onWorkspaceChange,o,s]);t.useEffect(()=>{if(!a.isInitialized){const t=Pt();if(e.workspaces(At(!0)),t){const e=a.workspaces.find(e=>e._id===t);e&&i(e,{forceEmit:!0}).catch(()=>{})}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,i]);const c=t.useCallback(()=>{e.workspaces(Et())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useRef(0),f=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(Nt(!0)),e.workspaces(Ct(null));try{const t=await n.getWorkspaces();if(e.workspaces(St(t)),t.length>0){const e=Pt();if(e&&It(e,t)){const r=t.find(t=>t._id===e);if(r)try{await i(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await i(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(Ct(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(Nt(!1)),l.current=!1}}},[n,a.loading,a.currentWorkspace?._id,e,i]),p=t.useCallback(async()=>{if(!a.refreshing&&!l.current){l.current=!0,e.workspaces(_t(!0));try{const t=await n.getWorkspaces();e.workspaces(St(t))}catch(e){}finally{e.workspaces(_t(!1)),l.current=!1}}},[n,a.refreshing,e]),m=t.useCallback(async(t,r)=>{const s=await n.createWorkspace({name:t,image:r});e.workspaces(St([...a.workspaces,s])),qt.emitWorkspaceCreated(s).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:s._id}})})},[n,a.workspaces,e]),h=t.useCallback(async(t,r)=>{const s=await n.updateWorkspace(t._id,r);e.workspaces(St(a.workspaces.map(e=>e._id===t._id?s:e))),qt.emitWorkspaceUpdated(s).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:s._id}})})},[n,a.workspaces,e]),g=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(kt(t)),t}catch(e){return Ie(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),b=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const e=a.currentWorkspace._id,t=a.workspaces.find(t=>t._id===e);if(t)t!==a.currentWorkspace&&o(t);else if(a.workspaces.length>0){const t=a.workspaces[0];t._id!==e&&i(t).catch(()=>{})}},[a.workspaces,a.currentWorkspace,o,i]);const y=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),v=t.useCallback(async(e,t,r)=>{const s=await n.addUser(e,{email:t,role:r}),o=a.workspaces.find(t=>t._id===e);return o&&qt.emitWorkspaceUserAdded(s.userId,o,r).catch(t=>{Ie(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:s.userId,role:r}})}),s},[n,a.workspaces]),x=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&Dt(r,t))throw new Error("Cannot remove the workspace owner");const s=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),o=await n.removeUser(e,t);if(r&&s){const t=s.role;qt.emitWorkspaceUserRemoved(o.userId,r,t).catch(r=>{Ie(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:o.userId,role:t}})})}return o},[n,a.workspaces]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&Dt(r,t))throw new Error("Cannot change the role of the workspace owner")}let s;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);s=r?.role}const o=await n.updateUser(e,t,r);return r.role&&s&&s!==r.role&&qt.emitWorkspaceUserRoleChanged(o.userId,o.workspace,s,r.role).catch(n=>{Ie(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:s,newRole:r.role}})}),o},[n,a.workspaces]),S=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return qt.emitUserUpdated(r,t||void 0).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),k=t.useCallback(async()=>await n.getProfile(),[n]),j=t.useCallback(async e=>await n.getWorkspace(e),[n]),E=t.useCallback(async t=>{if(!s)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!Dt(r,s.id))throw new Error("Only the workspace creator can delete the workspace");const o=await n.deleteWorkspace(t);return e.workspaces(St(a.workspaces.filter(e=>e._id!==t))),a.currentWorkspace?._id===t&&e.workspaces(Et()),r&&qt.emitWorkspaceDeleted(r).catch(e=>{Ie(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),o},[n,a.workspaces,a.currentWorkspace,e,s]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:f,refreshWorkspaces:p,refreshing:a.refreshing,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:o,switchToWorkspace:i,resetCurrentWorkspace:c,createWorkspace:m,allFeatures:a.allFeatures,getFeatures:g,updateFeature:b,getWorkspace:j,updateWorkspace:h,getUsers:y,addUser:v,removeUser:x,updateUser:w,getProfile:k,updateUserProfile:S,deleteWorkspace:E,switching:null!==a.switchingToId}};const rr=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}},nr=t.lazy(()=>Promise.resolve().then(function(){return Nk}).then(e=>({default:e.default}))),ar=({children:r})=>{const{currentWorkspace:n}=tr(),[a,s]=t.useState(!1),[o,i]=t.useState("profile");return t.useEffect(()=>{const e=rr.getState();s(e.open),i(e.section);return rr.subscribe((e,t)=>{s(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(nr,{workspace:n,open:a,onOpenChange:e=>{e||rr.closeSettings()},section:o,onSectionChange:e=>{rr.setSection(e)},showTrigger:!1})})]})},sr=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},or=t.memo(({serverUrl:r,version:n,orgId:a,auth:s,children:o})=>{sr(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),c=t.useMemo(()=>s?.callbacks,[s?.callbacks]),l=t.useMemo(()=>s?.callbacks?.handleEvent,[s?.callbacks]);return t.useEffect(()=>(qt.setCallbacks(l?{handleEvent:l}:null),()=>{qt.setCallbacks(null)}),[l]),e.jsx(Ue,{children:e.jsx(Wt,{children:e.jsx(Kt,{callbacks:c,children:e.jsx(Yt,{children:e.jsx(Zt,{config:i,auth:s,children:e.jsx(Qt,{children:e.jsx(ar,{children:o})})})})})})})});or.displayName="SaaSOSProvider";var ir=e=>"checkbox"===e.type,cr=e=>e instanceof Date,lr=e=>null==e;const dr=e=>"object"==typeof e;var ur=e=>!lr(e)&&!Array.isArray(e)&&dr(e)&&!cr(e),fr=e=>ur(e)&&e.target?ir(e.target)?e.target.checked:e.target.value:e,pr=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),mr="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function hr(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(mr&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||ur(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return ur(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=hr(e[t]));return n}var gr=e=>/^\w*$/.test(e),br=e=>void 0===e,yr=e=>Array.isArray(e)?e.filter(Boolean):[],vr=e=>yr(e.replace(/["|']|\]/g,"").split(/\.|\[/)),xr=(e,t,r)=>{if(!t||!ur(e))return r;const n=(gr(t)?[t]:vr(t)).reduce((e,t)=>lr(e)?e:e[t],e);return br(n)||n===e?br(e[t])?r:e[t]:n},wr=e=>"boolean"==typeof e,Sr=e=>"function"==typeof e,kr=(e,t,r)=>{let n=-1;const a=gr(t)?[t]:vr(t),s=a.length,o=s-1;for(;++n<s;){const t=a[n];let s=r;if(n!==o){const r=e[t];s=ur(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const jr="blur",Er="focusout",Ar="change",Nr="onBlur",Cr="onChange",_r="onSubmit",Tr="onTouched",Rr="all",Pr="max",Or="min",Ir="maxLength",Dr="minLength",Ur="pattern",Mr="required",Fr="validate",zr=t.createContext(null);zr.displayName="HookFormContext";const Lr=()=>t.useContext(zr),$r=e=>{const{children:r,...n}=e;return t.createElement(zr.Provider,{value:n},r)};var Vr=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const a=s;return t._proxyFormState[a]!==Rr&&(t._proxyFormState[a]=!n||Rr),r&&(r[a]=!0),e[a]}});return a};const Wr="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var Br=e=>"string"==typeof e,Gr=(e,t,r,n,a)=>Br(e)?(n&&t.watch.add(e),xr(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),xr(r,e))):(n&&(t.watchAll=!0),r),Hr=e=>lr(e)||!dr(e);function Kr(e,t,r=new WeakSet){if(Hr(e)||Hr(t))return Object.is(e,t);if(cr(e)&&cr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!a.includes(s))return!1;if("ref"!==s){const e=t[s];if(cr(n)&&cr(e)||ur(n)&&ur(e)||Array.isArray(n)&&Array.isArray(e)?!Kr(n,e,r):!Object.is(n,e))return!1}}return!0}function Zr(e){const r=Lr(),{name:n,disabled:a,control:s=r.control,shouldUnregister:o,defaultValue:i,exact:c=!0}=e,l=pr(s._names.array,n),d=t.useMemo(()=>xr(s._formValues,n,xr(s._defaultValues,n,i)),[s,n,i]),u=function(e){const r=Lr(),{control:n=r.control,name:a,defaultValue:s,disabled:o,exact:i,compute:c}=e||{},l=t.useRef(s),d=t.useRef(c),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=c;const[m,h]=t.useState(()=>{const e=n._getWatch(a,l.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=Gr(a,n._names,e||n._formValues,!1,l.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),b=t.useCallback(e=>{if(!o){const t=Gr(a,n._names,e||n._formValues,!1,l.current);if(d.current){const e=d.current(t);Kr(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,o,a]);Wr(()=>(f.current===n&&Kr(p.current,a)||(f.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{b(e.values)}})),[n,i,a,b]),t.useEffect(()=>n._removeUnmounted());const y=f.current!==n,v=p.current,x=t.useMemo(()=>{if(o)return null;const e=!y&&!Kr(v,a);return y||e?g():null},[o,y,a,v,g]);return null!==x?x:m}({control:s,name:n,defaultValue:d,exact:c}),f=function(e){const r=Lr(),{control:n=r.control,disabled:a,name:s,exact:o}=e||{},[i,c]=t.useState(n._formState),l=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Wr(()=>n._subscribe({name:s,formState:l.current,exact:o,callback:e=>{!a&&c({...n._formState,...e})}}),[s,a,o]),t.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>Vr(i,n,l.current,!1),[i,n])}({control:s,name:n,exact:c}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(s.register(n,{...e.rules,value:u,...wr(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!xr(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!xr(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!xr(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!xr(f.validatingFields,n)},error:{enumerable:!0,get:()=>xr(f.errors,n)}}),[f,n]),b=t.useCallback(e=>h.current.onChange({target:{value:fr(e),name:n},type:Ar}),[n]),y=t.useCallback(()=>h.current.onBlur({target:{value:xr(s._formValues,n),name:n},type:jr}),[n,s._formValues]),v=t.useCallback(e=>{const t=xr(s._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>Sr(e.focus)&&e.focus(),select:()=>Sr(e.select)&&e.select(),setCustomValidity:t=>Sr(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Sr(e.reportValidity)&&e.reportValidity()})},[s._fields,n]),x=t.useMemo(()=>({name:n,value:u,...wr(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:y,ref:v}),[n,a,f.disabled,b,y,v,u]);return t.useEffect(()=>{const e=s._options.shouldUnregister||o,t=m.current;t&&t!==n&&!l&&s.unregister(t),s.register(n,{...p.current.rules,...wr(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=xr(s._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=hr(xr(s._options.defaultValues,n,p.current.defaultValue));kr(s._defaultValues,n,e),br(xr(s._formValues,n))&&kr(s._formValues,n,e)}return!l&&s.register(n),m.current=n,()=>{(l?e&&!s._state.action:e)?s.unregister(n):r(n,!1)}},[n,s,l,o]),t.useEffect(()=>{s._setDisabledField({disabled:a,name:n})},[a,n,s]),t.useMemo(()=>({field:x,formState:f,fieldState:g}),[x,f,g])}const qr=e=>e.render(Zr(e));var Jr=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},Yr=e=>Array.isArray(e)?e:[e],Xr=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Qr(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&ur(a)&&s){const e=Qr(a,s);ur(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var en=e=>ur(e)&&!Object.keys(e).length,tn=e=>"file"===e.type,rn=e=>{if(!mr)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},nn=e=>"select-multiple"===e.type,an=e=>"radio"===e.type,sn=e=>rn(e)&&e.isConnected;function on(e,t){const r=Array.isArray(t)?t:gr(t)?[t]:vr(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=br(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(ur(n)&&en(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!br(e[t]))return!1;return!0}(n))&&on(e,r.slice(0,-1)),e}function cn(e){return Array.isArray(e)||ur(e)&&!(e=>{for(const t in e)if(Sr(e[t]))return!0;return!1})(e)}function ln(e,t={}){for(const r in e){const n=e[r];cn(n)?(t[r]=Array.isArray(n)?[]:{},ln(n,t[r])):br(n)||(t[r]=!0)}return t}function dn(e,t,r){r||(r=ln(t));for(const n in e){const a=e[n];if(cn(a))br(t)||Hr(r[n])?r[n]=ln(a,Array.isArray(a)?[]:{}):dn(a,lr(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!Kr(a,e)}}return r}const un={value:!1,isValid:!1},fn={value:!0,isValid:!0};var pn=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!br(e[0].attributes.value)?br(e[0].value)||""===e[0].value?fn:{value:e[0].value,isValid:!0}:fn:un}return un},mn=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>br(e)?e:t?""===e?NaN:e?+e:e:r&&Br(e)?new Date(e):n?n(e):e;const hn={isValid:!1,value:null};var gn=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,hn):hn;function bn(e){const t=e.ref;return tn(t)?t.files:an(t)?gn(e.refs).value:nn(t)?[...t.selectedOptions].map(({value:e})=>e):ir(t)?pn(e.refs).value:mn(br(t.value)?e.ref.value:t.value,e)}var yn=e=>e instanceof RegExp,vn=e=>br(e)?e:yn(e)?e.source:ur(e)?yn(e.value)?e.value.source:e.value:e,xn=e=>({isOnSubmit:!e||e===_r,isOnBlur:e===Nr,isOnChange:e===Cr,isOnAll:e===Rr,isOnTouch:e===Tr});const wn="AsyncFunction";var Sn=e=>!!e&&!!e.validate&&!!(Sr(e.validate)&&e.validate.constructor.name===wn||ur(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===wn)),kn=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const jn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=xr(e,a);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(jn(s,t))break}else if(ur(s)&&jn(s,t))break}}};function En(e,t,r){const n=xr(e,r);if(n||gr(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),s=xr(t,n),o=xr(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};a.pop()}return{name:r}}var An=(e,t,r)=>{const n=Yr(xr(e,r));return kr(n,"root",t[r]),kr(e,r,n),e};function Nn(e,t,r="validate"){if(Br(e)||Array.isArray(e)&&e.every(Br)||wr(e)&&!e)return{type:r,message:Br(e)?e:"",ref:t}}var Cn=e=>ur(e)&&!yn(e)?e:{value:e,message:""},_n=async(e,t,r,n,a,s)=>{const{ref:o,refs:i,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,y=xr(r,h);if(!b||t.has(h))return{};const v=i?i[0]:o,x=e=>{a&&v.reportValidity&&(v.setCustomValidity(wr(e)?"":e||""),v.reportValidity())},w={},S=an(o),k=ir(o),j=S||k,E=(g||tn(o))&&br(o.value)&&br(y)||rn(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,A=Jr.bind(null,h,n,w),N=(e,t,r,n=Ir,a=Dr)=>{const s=e?t:r;w[h]={type:e?n:a,message:s,ref:o,...A(e?n:a,s)}};if(s?!Array.isArray(y)||!y.length:c&&(!j&&(E||lr(y))||wr(y)&&!y||k&&!pn(i).isValid||S&&!gn(i).isValid)){const{value:e,message:t}=Br(c)?{value:!!c,message:c}:Cn(c);if(e&&(w[h]={type:Mr,message:t,ref:v,...A(Mr,t)},!n))return x(t),w}if(!(E||lr(u)&&lr(f))){let e,t;const r=Cn(f),a=Cn(u);if(lr(y)||isNaN(y)){const n=o.valueAsDate||new Date(y),s=e=>new Date((new Date).toDateString()+" "+e),i="time"==o.type,c="week"==o.type;Br(r.value)&&y&&(e=i?s(y)>s(r.value):c?y>r.value:n>new Date(r.value)),Br(a.value)&&y&&(t=i?s(y)<s(a.value):c?y<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(y?+y:y);lr(r.value)||(e=n>r.value),lr(a.value)||(t=n<a.value)}if((e||t)&&(N(!!e,r.message,a.message,Pr,Or),!n))return x(w[h].message),w}if((l||d)&&!E&&(Br(y)||s&&Array.isArray(y))){const e=Cn(l),t=Cn(d),r=!lr(e.value)&&y.length>+e.value,a=!lr(t.value)&&y.length<+t.value;if((r||a)&&(N(r,e.message,t.message),!n))return x(w[h].message),w}if(p&&!E&&Br(y)){const{value:e,message:t}=Cn(p);if(yn(e)&&!y.match(e)&&(w[h]={type:Ur,message:t,ref:o,...A(Ur,t)},!n))return x(t),w}if(m)if(Sr(m)){const e=Nn(await m(y,r),v);if(e&&(w[h]={...e,...A(Fr,e.message)},!n))return x(e.message),w}else if(ur(m)){let e={};for(const t in m){if(!en(e)&&!n)break;const a=Nn(await m[t](y,r),v,t);a&&(e={...a,...A(t,a.message)},x(a.message),n&&(w[h]=e))}if(!en(e)&&(w[h]={ref:v,...e},!n))return w}return x(!0),w};const Tn={mode:_r,reValidateMode:Cr,shouldFocusError:!0};function Rn(e={}){let t,r={...Tn,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Sr(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(ur(r.defaultValues)||ur(r.values))&&hr(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:hr(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d};let f={...u};const p={array:Xr(),state:Xr()},m=r.criteriaMode===Rr,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=en((await x()).errors),g()):e=await w(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?kr(n.validatingFields,e,t):on(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!en(n.validatingFields)}))},b=(e,t,r,n)=>{const c=xr(a,e);if(c){const a=xr(o,e,br(r)?xr(s,e):r);br(a)||n&&n.defaultChecked||t?kr(o,e,t?a:bn(c._f)):j(e,a),i.mount&&!i.action&&h()}},y=(e,t,a,o,i)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||o){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=Kr(xr(s,e),t);l=!!xr(n.dirtyFields,e),r?on(n.dirtyFields,e):kr(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=xr(n.touchedFields,e);t||(kr(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&i&&p.state.next(d)}return c?d:{}},v=(e,a,s,o)=>{const i=xr(n.errors,e),c=(u.isValid||f.isValid)&&wr(a)&&n.isValid!==a;var d;if(r.delayError&&s?(d=()=>((e,t)=>{kr(n.errors,e,t),p.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,s?kr(n.errors,e,s):on(n.errors,e)),(s?!Kr(i,s):i)||!en(o)||c){const t={...o,...c&&wr(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=async e=>{g(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=xr(t,r);e&&kr(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,s={valid:!0})=>{for(const i in t){const l=t[i];if(l){const{_f:t,...i}=l;if(t){const i=c.array.has(t.name),d=l._f&&Sn(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await _n(l,c.disabled,o,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(xr(f,t.name)?i?An(n.errors,f,t.name):kr(n.errors,t.name,f[t.name]):on(n.errors,t.name))}!en(i)&&await w(i,a,s)}}return s.valid},S=(e,t)=>!r.disabled&&(e&&t&&kr(o,e,t),!Kr(T(),s)),k=(e,t,r)=>Gr(e,c,{...i.mount?o:br(t)?s:Br(e)?{[e]:t}:t},r,t),j=(e,t,r={})=>{const n=xr(a,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&kr(o,e,mn(t,r)),s=rn(r.ref)&&lr(t)?"":t,nn(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?ir(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):tn(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||p.state.next({name:e,values:hr(o)})))}(r.shouldDirty||r.shouldTouch)&&y(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,i=xr(a,o);(c.array.has(e)||ur(s)||i&&!i._f)&&!cr(s)?E(o,s,r):j(o,s,r)}},A=(e,t,r={})=>{const l=xr(a,e),d=c.array.has(e),m=hr(t);kr(o,e,m),d?(p.array.next({name:e,values:hr(o)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:dn(s,o),isDirty:S(e,m)})):!l||l._f||lr(m)?j(e,m,r):E(e,m,r),kn(e,c)?p.state.next({...n,name:e,values:hr(o)}):p.state.next({name:i.mount?e:void 0,values:hr(o)})},N=async e=>{i.mount=!0;const s=e.target;let l=s.name,d=!0;const b=xr(a,l),S=e=>{d=Number.isNaN(e)||cr(e)&&isNaN(e.getTime())||Kr(e,xr(o,l,e))},k=xn(r.mode),j=xn(r.reValidateMode);if(b){let i,E;const A=s.type?bn(b._f):fr(e),N=e.type===jr||e.type===Er,C=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!xr(n.errors,l)&&!b._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(N,xr(n.touchedFields,l),n.isSubmitted,j,k),T=kn(l,c,N);kr(o,l,A),N?s&&s.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const R=y(l,A,N),P=!en(R)||T;if(!N&&p.state.next({name:l,type:e.type,values:hr(o)}),C)return(u.isValid||f.isValid)&&("onBlur"===r.mode?N&&h():N||h()),P&&p.state.next({name:l,...T?{}:R});if(!N&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await x([l]);if(g([l]),S(A),d){const t=En(n.errors,a,l),r=En(e,a,t.name||l);i=r.error,l=r.name,E=en(e)}}else g([l],!0),i=(await _n(b,c.disabled,o,m,r.shouldUseNativeValidation))[l],g([l]),S(A),d&&(i?E=!1:(u.isValid||f.isValid)&&(E=await w(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&_(b._f.deps),v(l,E,i,R))}},C=(e,t)=>{if(xr(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let s,o;const i=Yr(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(g(e),e)for(const r of e){const e=xr(t,r);e?kr(n.errors,r,e):on(n.errors,r)}else n.errors=t;return t})(br(e)?e:i);s=en(t),o=e?!i.some(e=>xr(t,e)):s}else e?(o=(await Promise.all(i.map(async e=>{const t=xr(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&h()):o=s=await w(a);return p.state.next({...!Br(e)||(u.isValid||f.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&jn(a,C,e?i:c.mount),o},T=(e,t)=>{let r={...i.mount?o:s};return t&&(r=Qr(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),br(e)?r:Br(e)?xr(r,e):e.map(e=>xr(r,e))},R=(e,t)=>({invalid:!!xr((t||n).errors,e),isDirty:!!xr((t||n).dirtyFields,e),error:xr((t||n).errors,e),isValidating:!!xr(n.validatingFields,e),isTouched:!!xr((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(xr(a,e,{_f:{}})._f||{}).ref,o=xr(n.errors,e)||{},{ref:i,message:c,type:l,...d}=o;kr(n.errors,e,{...d,...t,ref:s}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!Yr(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...s}=e;return en(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||Rr))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,I=(e,t={})=>{for(const i of e?Yr(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(on(a,i),on(o,i)),!t.keepError&&on(n.errors,i),!t.keepDirty&&on(n.dirtyFields,i),!t.keepTouched&&on(n.touchedFields,i),!t.keepIsValidating&&on(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&on(s,i);p.state.next({values:hr(o)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{(wr(e)&&i.mount||e||c.disabled.has(t))&&(e?c.disabled.add(t):c.disabled.delete(t))},U=(e,t={})=>{let n=xr(a,e);const o=wr(t.disabled)||wr(r.disabled);return kr(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?D({disabled:wr(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:vn(t.min),max:vn(t.max),minLength:vn(t.minLength),maxLength:vn(t.maxLength),pattern:vn(t.pattern)}:{},name:e,onChange:N,onBlur:N,ref:o=>{if(o){U(e,t),n=xr(a,e);const r=br(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,i=(e=>an(e)||ir(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;kr(a,e,{_f:{...n._f,...i?{refs:[...c.filter(sn),r,...Array.isArray(xr(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=xr(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!pr(c.array,e)||!i.action)&&c.unMount.add(e)}}},M=()=>r.shouldFocusError&&jn(a,C,c.mount),F=(e,t)=>async s=>{let i;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let l=hr(o);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();g(),n.errors=e,l=hr(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)on(l,e);if(on(n.errors,"root"),en(n.errors)){p.state.next({errors:{}});try{await e(l,s)}catch(e){i=e}}else t&&await t({...n.errors},s),M(),setTimeout(M);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:en(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const l=e?hr(e):s,d=hr(l),f=en(e),m=f?s:d;if(t.keepDefaultValues||(s=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(dn(s,o))]);for(const t of Array.from(e)){const e=xr(n.dirtyFields,t),r=xr(o,t),a=xr(m,t);e&&!br(r)?kr(m,t,r):e||br(a)||A(t,a)}}else{if(mr&&br(e))for(const e of c.mount){const t=xr(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(rn(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)A(e,xr(m,e));else a={}}o=r.shouldUnregister?t.keepDefaultValues?hr(s):{}:hr(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!en(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||Kr(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&o?dn(s,o):n.dirtyFields:t.keepDefaultValues&&e?dn(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},L=(e,t)=>z(Sr(e)?e(o):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:U,unregister:I,getFieldState:R,handleSubmit:F,setError:P,_subscribe:O,_runSchema:x,_updateIsValidating:g,_focusError:M,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(i.action=!0,m&&Array.isArray(xr(a,e))){const t=c(xr(a,e),l.argA,l.argB);d&&kr(a,e,t)}if(m&&Array.isArray(xr(n.errors,e))){const t=c(xr(n.errors,e),l.argA,l.argB);d&&kr(n.errors,e,t),((e,t)=>{!yr(xr(e,t)).length&&on(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(xr(n.touchedFields,e))){const t=c(xr(n.touchedFields,e),l.argA,l.argB);d&&kr(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=dn(s,o)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else kr(o,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>yr(xr(i.mount?o:s,e,r.shouldUnregister?xr(s,e,[]):[])),_reset:z,_resetDefaultValues:()=>Sr(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=xr(a,e);t&&(t._f.refs?t._f.refs.every(e=>!sn(e)):!sn(t._f.ref))&&I(e)}c.unMount=new Set},_disableForm:e=>{wr(e)&&(p.state.next({disabled:e}),jn(a,(t,r)=>{const n=xr(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return o},get _state(){return i},set _state(e){i=e},get _defaultValues(){return s},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:F,watch:(e,t)=>Sr(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:A,getValues:T,reset:L,resetField:(e,t={})=>{xr(a,e)&&(br(t.defaultValue)?A(e,hr(xr(s,e))):(A(e,t.defaultValue),kr(s,e,hr(t.defaultValue))),t.keepTouched||on(n.touchedFields,e),t.keepDirty||(on(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,hr(xr(s,e))):S()),t.keepError||(on(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&Yr(e).forEach(e=>on(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=xr(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Sr(e.select)&&e.select()})}},getFieldState:R};return{...V,formControl:V}}function Pn(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,s]=t.useState({isDirty:!1,isValidating:!1,isLoading:Sr(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:Sr(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!Sr(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Rn(e);r.current={...n,formState:a}}const o=r.current.control;return o._options=e,Wr(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),t.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),t.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),t.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),t.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}},[o,a.isDirty]),t.useEffect(()=>{var t;e.values&&!Kr(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),n.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),t.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),r.current.formState=Vr(a,o),r.current}const On=(e,t,r)=>{if(e&&"reportValidity"in e){const n=xr(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},In=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?On(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>On(t,r,e))}},Dn=(e,t)=>{t.shouldUseNativeValidation&&In(e,t);const r={};for(const n in e){const a=xr(t.fields,n),s=Object.assign(e[n]||{},{ref:a&&a.ref});if(Un(t.names||Object.keys(e),n)){const e=Object.assign({},xr(r,n));kr(e,"root",s),kr(r,n,e)}else kr(r,n,s)}return r},Un=(e,t)=>{const r=Mn(t);return e.some(e=>Mn(e).match(`^${r}\\.\\d+`))};function Mn(e){return e.replace(/\]|\[/g,"")}function Fn(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=o.prototype,s=Object.keys(a);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class s extends a{}function o(e){var t;const a=r?.Parent?new s:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class zn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ln extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const $n={};function Vn(e){return $n}function Wn(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function Bn(e,t){return"bigint"==typeof t?t.toString():t}function Gn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hn(e){return null==e}function Kn(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Zn=Symbol("evaluating");function qn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Zn)return void 0===n&&(n=Zn,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Jn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Yn(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Xn(e){return JSON.stringify(e)}const Qn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ea(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ta=Gn(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ra(e){if(!1===ea(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==ea(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function na(e){return ra(e)?{...e}:Array.isArray(e)?[...e]:e}const aa=new Set(["string","number","symbol"]);function sa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oa(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function ia(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function ca(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function la(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function da(e){return"string"==typeof e?e:e?.message}function ua(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=da(e.inst?._zod.def?.error?.(e))??da(t?.error?.(e))??da(r.customError?.(e))??da(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function fa(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function pa(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const ma=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Bn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ha=Fn("$ZodError",ma),ga=Fn("$ZodError",ma,{Parent:Error});const ba=e=>(t,r,n,a)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new zn;if(o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>ua(e,s,Vn())));throw Qn(t,a?.callee),t}return o.value},ya=ba(ga),va=e=>async(t,r,n,a)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>ua(e,s,Vn())));throw Qn(t,a?.callee),t}return o.value},xa=va(ga),wa=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new zn;return s.issues.length?{success:!1,error:new(e??ha)(s.issues.map(e=>ua(e,a,Vn())))}:{success:!0,data:s.value}},Sa=wa(ga),ka=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>ua(e,a,Vn())))}:{success:!0,data:s.value}},ja=ka(ga),Ea=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ba(e)(t,r,a)},Aa=e=>(t,r,n)=>ba(e)(t,r,n),Na=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return va(e)(t,r,a)},Ca=e=>async(t,r,n)=>va(e)(t,r,n),_a=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wa(e)(t,r,a)},Ta=e=>(t,r,n)=>wa(e)(t,r,n),Ra=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ka(e)(t,r,a)},Pa=e=>async(t,r,n)=>ka(e)(t,r,n),Oa=/^[cC][^\s-]{8,}$/,Ia=/^[0-9a-z]+$/,Da=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ua=/^[0-9a-vA-V]{20}$/,Ma=/^[A-Za-z0-9]{27}$/,Fa=/^[a-zA-Z0-9_-]{21}$/,za=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,La=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$a=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Va=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Wa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ba=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ga=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ha=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ka=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Za=/^[A-Za-z0-9_-]*$/,qa=/^\+[1-9]\d{6,14}$/,Ja="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ya=new RegExp(`^${Ja}$`);function Xa(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Qa=/^[^A-Z]*$/,es=/^[^a-z]*$/,ts=Fn("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),rs=Fn("$ZodCheckMaxLength",(e,t)=>{var r;ts.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=fa(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ns=Fn("$ZodCheckMinLength",(e,t)=>{var r;ts.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=fa(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),as=Fn("$ZodCheckLengthEquals",(e,t)=>{var r;ts.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Hn(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const s=fa(n),o=a>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ss=Fn("$ZodCheckStringFormat",(e,t)=>{var r,n;ts.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),os=Fn("$ZodCheckRegex",(e,t)=>{ss.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),is=Fn("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qa),ss.init(e,t)}),cs=Fn("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=es),ss.init(e,t)}),ls=Fn("$ZodCheckIncludes",(e,t)=>{ts.init(e,t);const r=sa(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ds=Fn("$ZodCheckStartsWith",(e,t)=>{ts.init(e,t);const r=new RegExp(`^${sa(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),us=Fn("$ZodCheckEndsWith",(e,t)=>{ts.init(e,t);const r=new RegExp(`.*${sa(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),fs=Fn("$ZodCheckOverwrite",(e,t)=>{ts.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class ps{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const ms={major:4,minor:3,patch:6},hs=Fn("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ms;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=ca(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&!1===r?.async)throw new zn;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(a||(a=ca(e,t)))});else{if(e.issues.length===t)continue;a||(a=ca(e,t))}}return n?n.then(()=>e):e},r=(r,a,s)=>{if(ca(r))return r.aborted=!0,r;const o=t(a,n,s);if(o instanceof Promise){if(!1===s.async)throw new zn;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if("backward"===s.direction){const t=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,s)):r(t,a,s)}const o=e._zod.parse(a,s);if(o instanceof Promise){if(!1===s.async)throw new zn;return o.then(e=>t(e,n,s))}return t(o,n,s)}}qn(e,"~standard",()=>({validate:t=>{try{const r=Sa(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return ja(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),gs=Fn("$ZodString",(e,t)=>{var r;hs.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),bs=Fn("$ZodStringFormat",(e,t)=>{ss.init(e,t),gs.init(e,t)}),ys=Fn("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=La),bs.init(e,t)}),vs=Fn("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$a(e))}else t.pattern??(t.pattern=$a());bs.init(e,t)}),xs=Fn("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Va),bs.init(e,t)}),ws=Fn("$ZodURL",(e,t)=>{bs.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ss=Fn("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),bs.init(e,t)}),ks=Fn("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fa),bs.init(e,t)}),js=Fn("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Oa),bs.init(e,t)}),Es=Fn("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ia),bs.init(e,t)}),As=Fn("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Da),bs.init(e,t)}),Ns=Fn("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ua),bs.init(e,t)}),Cs=Fn("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ma),bs.init(e,t)}),_s=Fn("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Xa({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ja}T(?:${n})$`)}(t)),bs.init(e,t)}),Ts=Fn("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ya),bs.init(e,t)}),Rs=Fn("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Xa(t)}$`)),bs.init(e,t)}),Ps=Fn("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=za),bs.init(e,t)}),Os=Fn("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wa),bs.init(e,t),e._zod.bag.format="ipv4"}),Is=Fn("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ba),bs.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ds=Fn("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ga),bs.init(e,t)}),Us=Fn("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ha),bs.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ms(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Fs=Fn("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ka),bs.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ms(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const zs=Fn("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Za),bs.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!Za.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Ms(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ls=Fn("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qa),bs.init(e,t)});const $s=Fn("$ZodJWT",(e,t)=>{bs.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Vs=Fn("$ZodUnknown",(e,t)=>{hs.init(e,t),e._zod.parse=e=>e}),Ws=Fn("$ZodNever",(e,t)=>{hs.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Bs(e,t,r){e.issues.length&&t.issues.push(...la(r,e.issues)),t.value[r]=e.value}const Gs=Fn("$ZodArray",(e,t)=>{hs.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const s=[];for(let e=0;e<a.length;e++){const o=a[e],i=t.element._zod.run({value:o,issues:[]},n);i instanceof Promise?s.push(i.then(t=>Bs(t,r,e))):Bs(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function Hs(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...la(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Ks(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Zs(e,t,r,n,a,s){const o=[],i=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(i.has(a))continue;if("never"===l){o.push(a);continue}const s=c.run({value:t[a],issues:[]},n);s instanceof Promise?e.push(s.then(e=>Hs(e,r,a,t,d))):Hs(s,r,a,t,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const qs=Fn("$ZodObject",(e,t)=>{hs.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=Gn(()=>Ks(t));qn(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const a=ea,s=t.catchall;let o;e._zod.parse=(t,r)=>{o??(o=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const n=l[e],a="optional"===n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?c.push(s.then(r=>Hs(r,t,e,i,a))):Hs(s,t,e,i,a)}return s?Zs(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Js=Fn("$ZodObjectJIT",(e,t)=>{qs.init(e,t);const r=e._zod.parse,n=Gn(()=>Ks(t));let a;const s=ea,o=!$n.jitless,i=o&&ta.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return s(f)?o&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new ps(["shape","payload","ctx"]),r=n.value,a=e=>{const t=Xn(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const e of r.keys)s[e]="key_"+o++;t.write("const newResult = {};");for(const n of r.keys){const r=s[n],o=Xn(n),i=e[n],c="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),c?Zs([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Ys(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!ca(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>ua(e,n,Vn())))}),t)}const Xs=Fn("$ZodUnion",(e,t)=>{hs.init(e,t),qn(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),qn(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),qn(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),qn(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Kn(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(r)return n(a,s);let o=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);if(t instanceof Promise)i.push(t),o=!0;else{if(0===t.issues.length)return t;i.push(t)}}return o?Promise.all(i).then(t=>Ys(t,a,e,s)):Ys(i,a,e,s)}}),Qs=Fn("$ZodIntersection",(e,t)=>{hs.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([t,r])=>to(e,t,r)):to(e,a,s)}});function eo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ra(e)&&ra(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=eo(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=eo(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function to(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const s=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&a&&e.issues.push({...a,keys:s}),ca(e))return e;const o=eo(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const ro=Fn("$ZodEnum",(e,t)=>{hs.init(e,t);const r=Wn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>aa.has(typeof e)).map(e=>"string"==typeof e?sa(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),no=Fn("$ZodTransform",(e,t)=>{hs.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Ln(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new zn;return r.value=a,r}});function ao(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const so=Fn("$ZodOptional",(e,t)=>{hs.init(e,t),e._zod.optin="optional",e._zod.optout="optional",qn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Kn(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>ao(t,e.value)):ao(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),oo=Fn("$ZodExactOptional",(e,t)=>{so.init(e,t),qn(e._zod,"values",()=>t.innerType._zod.values),qn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),io=Fn("$ZodNullable",(e,t)=>{hs.init(e,t),qn(e._zod,"optin",()=>t.innerType._zod.optin),qn(e._zod,"optout",()=>t.innerType._zod.optout),qn(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Kn(e.source)}|null)$`):void 0}),qn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),co=Fn("$ZodDefault",(e,t)=>{hs.init(e,t),e._zod.optin="optional",qn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>lo(e,t)):lo(n,t)}});function lo(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const uo=Fn("$ZodPrefault",(e,t)=>{hs.init(e,t),e._zod.optin="optional",qn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),fo=Fn("$ZodNonOptional",(e,t)=>{hs.init(e,t),qn(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>po(t,e)):po(a,e)}});function po(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const mo=Fn("$ZodCatch",(e,t)=>{hs.init(e,t),qn(e._zod,"optin",()=>t.innerType._zod.optin),qn(e._zod,"optout",()=>t.innerType._zod.optout),qn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ua(e,r,Vn()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>ua(e,r,Vn()))},input:e.value}),e.issues=[]),e)}}),ho=Fn("$ZodPipe",(e,t)=>{hs.init(e,t),qn(e._zod,"values",()=>t.in._zod.values),qn(e._zod,"optin",()=>t.in._zod.optin),qn(e._zod,"optout",()=>t.out._zod.optout),qn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>go(e,t.in,r)):go(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>go(e,t.out,r)):go(n,t.out,r)}});function go(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const bo=Fn("$ZodReadonly",(e,t)=>{hs.init(e,t),qn(e._zod,"propValues",()=>t.innerType._zod.propValues),qn(e._zod,"values",()=>t.innerType._zod.values),qn(e._zod,"optin",()=>t.innerType?._zod?.optin),qn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(yo):yo(n)}});function yo(e){return e.value=Object.freeze(e.value),e}const vo=Fn("$ZodCustom",(e,t)=>{ts.init(e,t),hs.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>xo(t,r,n,e));xo(a,r,n,e)}});function xo(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(pa(e))}}var wo;class So{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(wo=globalThis).__zod_globalRegistry??(wo.__zod_globalRegistry=new So);const ko=globalThis.__zod_globalRegistry;function jo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ia(t)})}function Eo(e,t){return new rs({check:"max_length",...ia(t),maximum:e})}function Ao(e,t){return new ns({check:"min_length",...ia(t),minimum:e})}function No(e,t){return new as({check:"length_equals",...ia(t),length:e})}function Co(e){return new fs({check:"overwrite",tx:e})}function _o(e){const t=function(e,t){const r=new ts({check:"custom",...ia(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(pa(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(pa(n))}},e(r.value,r)));return t}function To(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ko,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ro(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s){s.count++;return r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema}const o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);const i=e._zod.toJSONSchema?.();if(i)o.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{const r=o.schema,s=t.processors[a.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);s(e,t,r,n)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),Ro(s,t,n),t.seen.get(s).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(o.schema,c),"input"===t.io&&Io(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function Po(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:s}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${a("__shared")}#/${n}/${s}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:a+s}})(t);n.def={...n.schema},s&&(n.defId=s);const o=n.schema;for(const e in o)delete o[e];o.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const s=e.metadataRegistry.get(r[0])?.id;s?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Oo(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,s={...a},o=r.ref;if(r.ref=null,o){n(o);const r=e.seen.get(o),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,s);if(t._zod.parent===o)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in s||delete a[e]);if(i.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const i=t._zod.parent;if(i&&i!==o){n(i);const t=e.seen.get(i);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Do(t,"input",e.processors),output:Do(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Io(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return Io(n.element,r);if("set"===n.type)return Io(n.valueType,r);if("lazy"===n.type)return Io(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return Io(n.innerType,r);if("intersection"===n.type)return Io(n.left,r)||Io(n.right,r);if("record"===n.type||"map"===n.type)return Io(n.keyType,r)||Io(n.valueType,r);if("pipe"===n.type)return Io(n.in,r)||Io(n.out,r);if("object"===n.type){for(const e in n.shape)if(Io(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Io(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Io(e,r))return!0;return!(!n.rest||!Io(n.rest,r))}return!1}const Do=(e,t,r={})=>n=>{const{libraryOptions:a,target:s}=n??{},o=To({...a??{},target:s,io:t,processors:r});return Ro(e,o),Po(o,e),Oo(o,e)},Uo={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Mo=(e,t,r,n)=>{const a=e._zod.def;Ro(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Fo(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function zo(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[o].types,l=c&&c[n.code];r[o]=Jr(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Lo(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[o].types,l=c&&c[n.code];r[o]=Jr(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function $o(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,s){try{return Promise.resolve(Fo(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return s.shouldUseNativeValidation&&In({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:Dn(zo(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,s){try{return Promise.resolve(Fo(function(){return Promise.resolve(("sync"===r.mode?ya:xa)(e,n,t)).then(function(e){return s.shouldUseNativeValidation&&In({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof ha}(e))return{values:{},errors:Dn(Lo(e.issues,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function Vo(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Wo(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Vo(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():Vo(e[t],null)}}}}function Bo(...e){return a.useCallback(Wo(...e),e)}var Go=Symbol.for("react.lazy"),Ho=a[" use ".trim().toString()];function Ko(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Go&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Zo(t){const r=Jo(t),n=a.forwardRef((t,n)=>{let{children:s,...o}=t;Ko(s)&&"function"==typeof Ho&&(s=Ho(s._payload));const i=a.Children.toArray(s),c=i.find(Xo);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}var qo=Zo("Slot");function Jo(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(Ko(r)&&"function"==typeof Ho&&(r=Ho(r._payload)),a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yo=Symbol("radix.slottable");function Xo(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Yo}const Qo=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,ei=i,ti=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return ei(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==s?void 0:s[e];if(null===t)return null;const o=Qo(t)||Qo(n);return a[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...s,...i}[t]):{...s,...i}[t]===r})?[...e,r,n]:e},[]);return ei(e,o,c,null==r?void 0:r.class,null==r?void 0:r.className)},ri=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ni=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},ai=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),si=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var a=n(t),s=n(r);function o(e){return Boolean(e?.serverUrl&&e?.version&&e?.orgId)}function i(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=i(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function c(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=i(e))&&(n&&(n+=" "),n+=t);return n}exports.ApiVersion=void 0,(exports.ApiVersion||(exports.ApiVersion={})).V1="v1";const l=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),d="-",u=[],f=e=>{const t=h(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return m(e);const r=e.split(d),n=""===r[0]&&r.length>1?1:0;return p(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||u}return r[e]||u}}},p=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=p(e,t+1,a);if(r)return r}const s=r.validators;if(null===s)return;const o=0===t?e.join(d):e.slice(t).join(d),i=s.length;for(let e=0;e<i;e++){const t=s[e];if(t.validator(o))return t.classGroupId}},m=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),h=e=>{const{theme:t,classGroups:r}=e;return g(r,t)},g=(e,t)=>{const r=l();for(const n in e){const a=e[n];b(a,r,n,t)}return r},b=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const a=e[s];y(a,t,r,n)}},y=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?w(e,t,r,n):x(e,t,r,n):v(e,t,r)},v=(e,t,r)=>{(""===e?t:S(t,e)).classGroupId=r},x=(e,t,r,n)=>{k(e)?b(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},w=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){const[s,o]=a[e];b(o,S(t,s),r,n)}},S=(e,t)=>{let r=e;const n=t.split(d),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=l(),r.nextPart.set(t,a)),r=a}return r},k=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,j=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,s)=>{r[a]=s,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},E=[],C=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),N=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,s=0;const o=e.length;for(let i=0;i<o;i++){const o=e[i];if(0===n&&0===a){if(":"===o){t.push(e.slice(s,i)),s=i+1;continue}if("/"===o){r=i;continue}}"["===o?n++:"]"===o?n--:"("===o?a++:")"===o&&a--}const i=0===t.length?e:e.slice(s);let c=i,l=!1;i.endsWith("!")?(c=i.slice(0,-1),l=!0):i.startsWith("!")&&(c=i.slice(1),l=!0);return C(t,l,c,r&&r>s?r-s:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):C(E,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},A=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const s=e[a],o="["===s[0],i=t.has(s);o||i?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(s)):n.push(s)}return n.length>0&&(n.sort(),r.push(...n)),r}},_=/\s+/,T=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=T(e[n]))&&(r&&(r+=" "),r+=t);return r},R=(e,...t)=>{let r,n,a,s;const o=e=>{const t=n(e);if(t)return t;const s=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,o=[],i=e.trim().split(_);let c="";for(let e=i.length-1;e>=0;e-=1){const t=i[e],{isExternal:l,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(l){c=t+(c.length>0?" "+c:c);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?" "+c:c);continue}if(h=n(f),!h){c=t+(c.length>0?" "+c:c);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:s(d).join(":"),b=u?g+"!":g,y=b+h;if(o.indexOf(y)>-1)continue;o.push(y);const v=a(h,m);for(let e=0;e<v.length;++e){const t=v[e];o.push(b+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,s),s};return s=i=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:j(e.cacheSize),parseClassName:N(e),sortModifiers:A(e),...f(e)}))(c),n=r.cache.get,a=r.cache.set,s=o,o(i)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=T(t))&&(a&&(a+=" "),a+=r);return a})(...e))},P=[],O=e=>{const t=t=>t[e]||P;return t.isThemeGetter=!0,t},I=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,D=/^\((?:(\w[\w-]*):)?(.+)\)$/i,U=/^\d+\/\d+$/,F=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,L=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,V=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$=e=>U.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),B=e=>!!e&&Number.isInteger(Number(e)),G=e=>e.endsWith("%")&&W(e.slice(0,-1)),K=e=>F.test(e),H=()=>!0,Z=e=>M.test(e)&&!z.test(e),J=()=>!1,q=e=>L.test(e),Y=e=>V.test(e),X=e=>!ee(e)&&!oe(e),Q=e=>pe(e,be,J),ee=e=>I.test(e),te=e=>pe(e,ye,Z),re=e=>pe(e,ve,W),ne=e=>pe(e,he,J),ae=e=>pe(e,ge,Y),se=e=>pe(e,we,q),oe=e=>D.test(e),ie=e=>me(e,ye),ce=e=>me(e,xe),le=e=>me(e,he),de=e=>me(e,be),ue=e=>me(e,ge),fe=e=>me(e,we,!0),pe=(e,t,r)=>{const n=I.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},me=(e,t,r=!1)=>{const n=D.exec(e);return!!n&&(n[1]?t(n[1]):r)},he=e=>"position"===e||"percentage"===e,ge=e=>"image"===e||"url"===e,be=e=>"length"===e||"size"===e||"bg-size"===e,ye=e=>"length"===e,ve=e=>"number"===e,xe=e=>"family-name"===e,we=e=>"shadow"===e,Se=R(()=>{const e=O("color"),t=O("font"),r=O("text"),n=O("font-weight"),a=O("tracking"),s=O("leading"),o=O("breakpoint"),i=O("container"),c=O("spacing"),l=O("radius"),d=O("shadow"),u=O("inset-shadow"),f=O("text-shadow"),p=O("drop-shadow"),m=O("blur"),h=O("perspective"),g=O("aspect"),b=O("ease"),y=O("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",oe,ee],x=()=>[oe,ee,c],w=()=>[$,"full","auto",...x()],S=()=>[B,"none","subgrid",oe,ee],k=()=>["auto",{span:["full",B,oe,ee]},B,oe,ee],j=()=>[B,"auto",oe,ee],E=()=>["auto","min","max","fr",oe,ee],C=()=>["auto",...x()],N=()=>[$,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],A=()=>[e,oe,ee],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",le,ne,{position:[oe,ee]}],T=()=>["auto","cover","contain",de,Q,{size:[oe,ee]}],R=()=>[G,ie,te],P=()=>["","none","full",l,oe,ee],I=()=>["",W,ie,te],D=()=>[W,G,le,ne],U=()=>["","none",m,oe,ee],F=()=>["none",W,oe,ee],M=()=>["none",W,oe,ee],z=()=>[W,oe,ee],L=()=>[$,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[K],breakpoint:[K],color:[H],container:[K],"drop-shadow":[K],ease:["in","out","in-out"],font:[X],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[K],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[K],shadow:[K],spacing:["px",W],text:[K],"text-shadow":[K],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$,ee,oe,g]}],container:["container"],columns:[{columns:[W,ee,oe,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",oe,ee]}],basis:[{basis:[$,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[W,$,"auto","initial","none",ee]}],grow:[{grow:["",W,oe,ee]}],shrink:[{shrink:["",W,oe,ee]}],order:[{order:[B,"first","last","none",oe,ee]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:N()}],w:[{w:[i,"screen",...N()]}],"min-w":[{"min-w":[i,"screen","none",...N()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[o]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",r,ie,te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,oe,re]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",G,ee]}],"font-family":[{font:[ce,ee,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,oe,ee]}],"line-clamp":[{"line-clamp":[W,"none",oe,re]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",oe,ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:A()}],"text-color":[{text:A()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[W,"from-font","auto",oe,te]}],"text-decoration-color":[{decoration:A()}],"underline-offset":[{"underline-offset":[W,"auto",oe,ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,oe,ee],radial:["",oe,ee],conic:[B,oe,ee]},ue,ae]}],"bg-color":[{bg:A()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:A()}],"gradient-via":[{via:A()}],"gradient-to":[{to:A()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:A()}],"border-color-x":[{"border-x":A()}],"border-color-y":[{"border-y":A()}],"border-color-s":[{"border-s":A()}],"border-color-e":[{"border-e":A()}],"border-color-t":[{"border-t":A()}],"border-color-r":[{"border-r":A()}],"border-color-b":[{"border-b":A()}],"border-color-l":[{"border-l":A()}],"divide-color":[{divide:A()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[W,oe,ee]}],"outline-w":[{outline:["",W,ie,te]}],"outline-color":[{outline:A()}],shadow:[{shadow:["","none",d,fe,se]}],"shadow-color":[{shadow:A()}],"inset-shadow":[{"inset-shadow":["none",u,fe,se]}],"inset-shadow-color":[{"inset-shadow":A()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:A()}],"ring-offset-w":[{"ring-offset":[W,te]}],"ring-offset-color":[{"ring-offset":A()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":A()}],"text-shadow":[{"text-shadow":["none",f,fe,se]}],"text-shadow-color":[{"text-shadow":A()}],opacity:[{opacity:[W,oe,ee]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":A()}],"mask-image-linear-to-color":[{"mask-linear-to":A()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":A()}],"mask-image-t-to-color":[{"mask-t-to":A()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":A()}],"mask-image-r-to-color":[{"mask-r-to":A()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":A()}],"mask-image-b-to-color":[{"mask-b-to":A()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":A()}],"mask-image-l-to-color":[{"mask-l-to":A()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":A()}],"mask-image-x-to-color":[{"mask-x-to":A()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":A()}],"mask-image-y-to-color":[{"mask-y-to":A()}],"mask-image-radial":[{"mask-radial":[oe,ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":A()}],"mask-image-radial-to-color":[{"mask-radial-to":A()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":A()}],"mask-image-conic-to-color":[{"mask-conic-to":A()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ee]}],filter:[{filter:["","none",oe,ee]}],blur:[{blur:U()}],brightness:[{brightness:[W,oe,ee]}],contrast:[{contrast:[W,oe,ee]}],"drop-shadow":[{"drop-shadow":["","none",p,fe,se]}],"drop-shadow-color":[{"drop-shadow":A()}],grayscale:[{grayscale:["",W,oe,ee]}],"hue-rotate":[{"hue-rotate":[W,oe,ee]}],invert:[{invert:["",W,oe,ee]}],saturate:[{saturate:[W,oe,ee]}],sepia:[{sepia:["",W,oe,ee]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ee]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[W,oe,ee]}],"backdrop-contrast":[{"backdrop-contrast":[W,oe,ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",W,oe,ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,oe,ee]}],"backdrop-invert":[{"backdrop-invert":["",W,oe,ee]}],"backdrop-opacity":[{"backdrop-opacity":[W,oe,ee]}],"backdrop-saturate":[{"backdrop-saturate":[W,oe,ee]}],"backdrop-sepia":[{"backdrop-sepia":["",W,oe,ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[W,"initial",oe,ee]}],ease:[{ease:["linear","initial",b,oe,ee]}],delay:[{delay:[W,oe,ee]}],animate:[{animate:["none",y,oe,ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,oe,ee]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:M()}],"scale-x":[{"scale-x":M()}],"scale-y":[{"scale-y":M()}],"scale-z":[{"scale-z":M()}],"scale-3d":["scale-3d"],skew:[{skew:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[oe,ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:L()}],"translate-x":[{"translate-x":L()}],"translate-y":[{"translate-y":L()}],"translate-z":[{"translate-z":L()}],"translate-none":["translate-none"],accent:[{accent:A()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:A()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,ee]}],fill:[{fill:["none",...A()]}],"stroke-w":[{stroke:[W,ie,te,re]}],stroke:[{stroke:["none",...A()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function ke(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function je(...e){return Se(c(e))}let Ee=!0;function Ce(e,...t){console.error(e,...t)}function Ne(e){if(null==e)return e;if("object"!=typeof e)return e;const t=new Set(["authorization","token","password","accessToken","refreshToken"]);if(Array.isArray(e))return e.map(Ne);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":Ne(a);return r}function Ae(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function _e(e,t){try{const r=await fetch(e,t);if(ke()){const n=(t?.method??"GET").toUpperCase();let a;if(null!=t?.body)try{a="string"==typeof t.body?JSON.parse(t.body):{body:"(non-JSON)"}}catch{a={body:"(parse failed)"}}const s=r.clone();let o;try{const e=await s.text();if(e)try{o=JSON.parse(e)}catch{o=e.substring(0,200)+(e.length>200?"...":"")}}catch{o="(read failed)"}!function(e,...t){Ee&&ke()&&console.log(e,...t)}("[SDK API]",n,e,{request:Ne(a),response:Ne(o),status:r.status})}return r}catch(e){if(Ae(e))throw e;if(e instanceof TypeError&&"Failed to fetch"===e.message)throw new Error("Network error: Please check your internet connection");throw e}}async function Te(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function Re(e){const t=await e.text();if(!t)throw new Error("Empty response body");try{return JSON.parse(t)}catch(e){throw new Error(`Invalid JSON response: ${t.substring(0,100)}${t.length>100?"...":""}`)}}async function Pe(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await Re(e);r=t.message||t.error||r}catch{r=function(e,t){const r={400:"Bad Request",401:"Unauthorized - Please check your session",403:"Forbidden - You do not have permission",404:"Resource not found",500:"Internal server error",502:"Bad Gateway",503:"Service unavailable"}[e.status]||e.statusText||t;return new Error(`${t} (${e.status}: ${r})`)}(e,t).message}throw new Error(r)}try{return await Re(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class Oe extends Error{constructor(e,t,r,n){super(e),this.code=t,this.context=r,this.originalError=n,this.name="SDKError","undefined"!=typeof Error&&"captureStackTrace"in Error&&Error.captureStackTrace(this,Oe)}}const Ie=new class{constructor(){this.config={enableConsoleLogging:!0,showUserNotifications:!1}}configure(e){this.config={...this.config,...e},void 0!==e.enableConsoleLogging&&function(e){void 0!==e.enableLogging&&(Ee=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Ae(e))return;const r=e instanceof Error?e:new Oe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof Oe?r:new Oe(r.message,r.name,t,r);if(this.config.enableConsoleLogging&&function(e,...t){Ee&&ke()&&console.error(e,...t)}(`[SDK Error] ${t.component||"Unknown"}:`,{message:n.message,code:n.code,context:n.context,originalError:n.originalError,stack:n.stack}),this.config.onError)try{this.config.onError(n,t)}catch(e){Ce("[SDK Error Handler] Error in custom error callback:",e)}this.config.showUserNotifications&&this.notifyUser(n,t)}notifyUser(e,t){"undefined"!=typeof window&&window.dispatchEvent&&window.dispatchEvent(new CustomEvent("sdk-error",{detail:{error:e,context:t}}))}wrapAsync(e,t){return(...r)=>e(...r).catch(e=>{throw this.handleError(e,t),e})}wrapSync(e,t){return(...r)=>{try{return e(...r)}catch(e){throw this.handleError(e,t),e}}}};function De(e,t={}){Ie.handleError(e,t)}function Ue(e,t={}){return!Ae(e)&&(Ie.handleError(e,t),!0)}class Fe extends t.Component{constructor(e){super(e),this.resetError=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){if(De(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ce("[SDK ErrorBoundary] Error in onError callback:",e)}}componentDidUpdate(e){this.state.hasError&&!1!==this.props.resetOnPropsChange&&e.children!==this.props.children&&this.resetError()}render(){return this.state.hasError&&this.state.error?this.props.fallback?"function"==typeof this.props.fallback?this.props.fallback(this.state.error,this.resetError):this.props.fallback:e.jsxs("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[e.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),e.jsx("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),e.jsx("button",{onClick:this.resetError,style:{padding:"0.5rem 1rem",backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:"0.25rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]}):this.props.children}}const Me=()=>({type:"AUTHENTICATION_STARTED"}),ze=()=>({type:"AUTHENTICATION_PROCESSING"}),Le=()=>({type:"AUTHENTICATION_FAILED"}),Ve=e=>({type:"SET_SESSION",payload:e}),$e=()=>({type:"REMOVE_SESSION"});function We(e,r,n){const a=t.useRef(r),s=t.useRef(n),o=t.useRef(void 0),i=t.useRef(e);return a.current=r,s.current=n,t.useMemo(()=>{const t=a.current(e);if(void 0!==o.current){if((s.current?s.current(o.current,t):Object.is(o.current,t))&&i.current===e)return o.current}return o.current=t,i.current=e,t},[e])}function Be({name:r,initialState:n,reducer:a,initializer:s}){const o=t.createContext(null),i=t.createContext(null),c=t.createContext(null),l=t.memo(({children:r})=>{const[l,d]=t.useReducer(a,n,s||(e=>e)),u=t.useMemo(()=>({state:l,dispatch:d}),[l,d]);return e.jsx(c.Provider,{value:u,children:e.jsx(o.Provider,{value:l,children:e.jsx(i.Provider,{value:d,children:r})})})});l.displayName=`${r}Provider`;const d=e=>new Error(`use${r}${e} must be used within a ${r}Provider. Make sure SaaSOSProvider is wrapping your application.`),u=()=>{const e=t.useContext(o);if(null===e)throw d("State");return e};return{Provider:l,useContext:()=>{const e=t.useContext(c);if(!e)throw d("Context");return e},useState:u,useDispatch:()=>{const e=t.useContext(i);if(null===e)throw d("Dispatch");return e},useSelector:(e,t)=>{const r=e||(e=>e);return We(u(),r,t)}}}var Ge;function Ke(e){return{isAuthenticated:e===exports.AuthStatus.authenticated,isLoading:e===exports.AuthStatus.loading||e===exports.AuthStatus.redirecting||e===exports.AuthStatus.authenticating,isRedirecting:e===exports.AuthStatus.redirecting}}function He(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return De(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function Ze(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){De(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function Je(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){De(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}exports.AuthStatus=void 0,(Ge=exports.AuthStatus||(exports.AuthStatus={})).loading="loading",Ge.redirecting="redirecting",Ge.authenticated="authenticated",Ge.unauthenticated="unauthenticated",Ge.authenticating="authenticating";const qe="code",Ye="saas-session-id",Xe="saas-workspace-current";function Qe(e,t,r){const n=e._id||e.id;if(!n||"string"!=typeof n)throw new Error("User data missing required ID field");if(!e.email||"string"!=typeof e.email)throw new Error("User data missing required email field");return{id:n,name:e.name||"",org:t,email:e.email,emailVerified:!0,clientId:r,role:e.role||"",image:e.image}}function et(){Je(Ye)}function tt(){if("undefined"==typeof window)return null;try{return He(Ye)}catch(e){return De(e,{component:"auth/utils",action:"getSessionId",metadata:{key:Ye}}),null}}function rt(){const e=tt(),t={};return e&&(t["x-session-id"]=e),t}function nt(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(qe)}catch(e){return De(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:qe}}),null}}function at(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}function st(e,t,r){return{...e,[t]:r}}function ot(e,t){return{...e,...t}}const it=()=>({session:null,status:exports.AuthStatus.loading}),{Provider:ct,useState:lt,useDispatch:dt}=Be({name:"Auth",initialState:it(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return st(e,"status",exports.AuthStatus.redirecting);case"AUTHENTICATION_PROCESSING":return st(e,"status",exports.AuthStatus.authenticating);case"AUTHENTICATION_FAILED":return ot(e,{session:null,status:exports.AuthStatus.unauthenticated});case"SET_SESSION":{const n=t.payload;return r=n.sessionId,Ze(Ye,r),ot(e,{session:n,status:exports.AuthStatus.authenticated})}case"REMOVE_SESSION":return et(),ot(e,{session:null,status:exports.AuthStatus.unauthenticated});default:return e}var r},initializer:it}),ut=ct,ft=lt,pt=dt,mt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),ht=e=>({type:"SET_SETTINGS",payload:e}),gt=()=>({serverUrl:"",version:exports.ApiVersion.V1,orgId:"",settings:null}),{Provider:bt,useState:yt,useDispatch:vt}=Be({name:"OS",initialState:gt(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return ot(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return gt();case"SET_SETTINGS":return st(e,"settings",t.payload);default:return e}}}),xt=bt,wt=yt,St=vt,kt=e=>({type:"SET_WORKSPACES",payload:e}),jt=e=>({type:"SET_ALL_FEATURES",payload:e}),Et=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),Ct=()=>({type:"RESET_CURRENT_WORKSPACE"}),Nt=e=>({type:"SET_IS_INITIALIZED",payload:e}),At=e=>({type:"SET_LOADING",payload:e}),_t=e=>({type:"SET_ERROR",payload:e}),Tt=e=>({type:"SET_REFRESHING",payload:e}),Rt=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),Pt=e=>{e?Ze(Xe,e._id):Je(Xe)},Ot=()=>He(Xe),It=()=>{Je(Xe)},Dt=(e,t)=>!!e&&t.some(t=>t._id===e);function Ut(e,t){if(!t)return!1;const r=(n=e.createdBy)?"string"==typeof n?n:"object"==typeof n&&null!==n&&"_id"in n&&"string"==typeof n._id?n._id:null:null;var n;return null!==r&&r===t}function Ft(e,t){if(!t||!e.users||!Array.isArray(e.users))return null;const r=e.users.find(e=>{if("string"==typeof e)return e===t;if("object"==typeof e&&null!==e&&"_id"in e){return e._id===t}return!1});return r&&"object"==typeof r&&"role"in r&&"string"==typeof r.role?r.role:null}const{Provider:Mt,useState:zt,useDispatch:Lt}=Be({name:"Workspace",initialState:{workspaces:[],loading:!1,error:null,currentWorkspace:null,refreshing:!1,switchingToId:null,isInitialized:!1,allFeatures:[]},reducer:(e,t)=>{switch(t.type){case"SET_WORKSPACES":return st(e,"workspaces",t.payload);case"SET_ALL_FEATURES":return st(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return Pt(t.payload),st(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return It(),st(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return st(e,"isInitialized",t.payload);case"SET_LOADING":return st(e,"loading",t.payload);case"SET_ERROR":return st(e,"error",t.payload);case"SET_REFRESHING":return st(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return st(e,"switchingToId",t.payload);default:return e}}}),Vt=Mt,$t=zt,Wt=Lt,Bt=t.memo(({children:t})=>e.jsx(xt,{children:e.jsx(ut,{children:e.jsx(Vt,{children:t})})}));Bt.displayName="SDKContextProvider";const Gt=new class{constructor(){this.callbacks=null}setCallbacks(e){this.callbacks=e}getCallbacks(){return this.callbacks}async emit(e,t){if(this.callbacks?.handleEvent)try{await this.callbacks.handleEvent(e,t)}catch(t){De(t,{component:"EventEmitter",action:"emit",metadata:{eventType:e}})}}async emitUserCreated(e){await this.emit("user:created",{user:e})}async emitUserUpdated(e,t){await this.emit("user:updated",{user:e,previousUser:t})}async emitWorkspaceChanged(e,t){await this.emit("workspace:changed",{workspace:e,previousWorkspace:t})}async emitWorkspaceUpdated(e){await this.emit("workspace:updated",{workspace:e})}async emitWorkspaceUserAdded(e,t,r){await this.emit("workspace:user-added",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRemoved(e,t,r){await this.emit("workspace:user-removed",{userId:e,workspace:t,role:r})}async emitWorkspaceUserRoleChanged(e,t,r,n){await this.emit("workspace:user-role-changed",{userId:e,workspace:t,previousRole:r,newRole:n})}async emitWorkspaceCreated(e){await this.emit("workspace:created",{workspace:e})}async emitWorkspaceDeleted(e){await this.emit("workspace:deleted",{workspace:e})}};function Kt(e,r,n){t.useEffect(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Ae(e)||(n?.onError?n.onError(e):De(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},r)}const Ht="SDK is not ready (missing serverUrl, version, or orgId)";class Zt{constructor(e){this.serverUrl=e.serverUrl,this.version=e.version,this.orgId=e.orgId,this.requireOrgId=e.requireOrgId??!1,this.basePath=e.basePath??"public"}ensureReady(){if(!this.serverUrl?.trim()||!this.version)throw new Error(Ht);if(this.requireOrgId&&!this.orgId?.trim())throw new Error(Ht)}get baseUrl(){return this.ensureReady(),`${this.serverUrl}/api/${this.version}/${this.basePath}`}getAuthHeaders(){return rt()}url(e){const t=e.startsWith("/")?e.slice(1):e;return`${this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl}/${t}`}async fetchJson(e,t={},r="Request failed"){this.ensureReady();const n={...this.getAuthHeaders()};t.headers&&Object.assign(n,t.headers),null==t.body||n["Content-Type"]||(n["Content-Type"]="application/json");return Pe(await _e(this.url(e),{...t,headers:n}),r)}async fetchResponse(e,t={}){this.ensureReady();const r={...this.getAuthHeaders()};return t.headers&&Object.assign(r,t.headers),null==t.body||r["Content-Type"]||(r["Content-Type"]="application/json"),_e(this.url(e),{...t,headers:r})}}class Jt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getSettings(e){return this.fetchJson(`${this.orgId}/settings`,{signal:e},"Failed to fetch settings")}}function qt(){return mr(e=>e.os)}function Yt(){const e=hr(),r=qt(),{serverUrl:n,version:a,orgId:s,settings:i}=r,c=t.useRef(!1),l=t.useMemo(()=>o(r)?new Jt({serverUrl:n,version:a,orgId:s}):null,[n,a,s,r]),d=t.useCallback(async t=>{if(c.current)return i||null;if(i)return i;if(!l)return null;c.current=!0;try{const r=await l.getSettings(t);return e.os(ht(r)),r}catch(e){return Ue(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:n,version:a,orgId:s}}),null}finally{c.current=!1}},[l,i,e]);return Kt(async e=>{!o(r)||i||c.current||await d(e)},[n,a,s,d],{onError:e=>Ue(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:n,version:a,orgId:s}})}),t.useMemo(()=>({settings:i,getSettings:d}),[i,d])}class Xt extends Zt{constructor(e){super({...e,requireOrgId:!0})}async getWorkspaces(){return this.fetchJson("workspaces",{},"Failed to fetch workspaces")}async createWorkspace(e){return this.fetchJson("workspaces",{method:"POST",body:JSON.stringify(e)},"Failed to create workspace")}async updateWorkspace(e,t){return this.fetchJson(`workspaces/${e}`,{method:"PUT",body:JSON.stringify(t)},"Failed to update workspace")}async deleteWorkspace(e){return this.fetchJson(`workspaces/${e}`,{method:"DELETE"},"Failed to delete workspace")}async getWorkspaceUsers(e){return this.fetchJson(`workspaces/${e}/users`,{},"Failed to fetch workspace users")}async addUser(e,t){return this.fetchJson(`workspaces/${e}/users/add`,{method:"POST",body:JSON.stringify(t)},"Failed to invite member")}async removeUser(e,t){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"DELETE"},"Failed to remove user")}async updateUser(e,t,r){return this.fetchJson(`workspaces/${e}/users/${t}`,{method:"PATCH",body:JSON.stringify(r)},"Failed to update user")}async getFeatures(){return this.fetchJson("workspaces/features",{},"Failed to fetch features")}async updateFeature(e,t,r){return this.fetchJson(`workspaces/${e}/features`,{method:"PATCH",body:JSON.stringify({features:{[t]:r}})},"Failed to update feature")}async getWorkspace(e){return this.fetchJson(`workspaces/${e}`,{},"Failed to fetch workspace")}async getProfile(){return this.fetchJson("profile",{},"Failed to fetch profile")}async updateUserProfile(e){return this.fetchJson("profile",{method:"PATCH",body:JSON.stringify(e)},"Failed to update user profile")}async getCurrentSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription`);if(!t.ok){let e="Failed to fetch subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Workspace not found or no subscription available":401===t.status?"Unauthorized - Please check your session":`Failed to fetch subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch subscription");return r.data}return r}async getPlanGroup(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/plan-group`);if(!t.ok){let e="Failed to fetch plan group";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group found for this workspace":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group");return r.data}return r}async getPlanGroupByVersion(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/plan-group?groupVersionId=${t}`);if(!r.ok){let e="Failed to fetch plan group version";try{e=(await r.json()).message||e}catch{e=404===r.status?"Plan group version not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch plan group version");return n.data}return n}async getPlanGroupVersions(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/plan-group/versions`);if(!t.ok){let e="Failed to fetch plan group versions";try{e=(await t.json()).message||e}catch{e=404===t.status?"No plan group versions found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group versions (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group versions");return r.data}return r}async getPublicPlans(e){if(!this.orgId)throw new Error("orgId is required for getPublicPlans");const t=await this.fetchResponse(`${this.orgId}/plans/${encodeURIComponent(e)}`);if(!t.ok){let r="Failed to fetch plans";try{r=(await t.json()).message||r}catch{r=404===t.status?`Plans "${e}" not found`:`Failed to fetch plans (${t.status}: ${t.statusText})`}throw new Error(r)}const r=await t.json();if(void 0!==r.success&&!r.success)throw new Error(r.message||"Failed to fetch plans");return r.data??r}async getPlanGroupVersion(e){const t=await this.fetchResponse(`plan-group-versions/${e}`);if(!t.ok){let e="Failed to fetch plan group version";try{e=(await t.json()).message||e}catch{e=404===t.status?"Plan group version not found":401===t.status?"Unauthorized - Please check your session":`Failed to fetch plan group version (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to fetch plan group version");return r.data}return r}async createCheckoutSession(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/checkout`,{method:"POST",body:JSON.stringify(t)});if(!r.ok){let e="Failed to create checkout session";try{e=(await r.json()).message||e}catch{e=`Failed to create checkout session (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to create checkout session");return n.data||n}return n}async updateSubscription(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription`,{method:"PATCH",body:JSON.stringify(t)});if(!r.ok){let e="Failed to update subscription";try{e=(await r.json()).message||e}catch{e=`Failed to update subscription (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to update subscription");return n.data?.checkoutUrl||n.checkoutUrl?n.data||n:n.data}return n.checkoutUrl,n}async listInvoices(e,t=10,r){const n=new URLSearchParams;n.append("limit",t.toString()),r&&n.append("starting_after",r);const a=await this.fetchResponse(`workspaces/${e}/subscription/invoices?${n.toString()}`,{});if(!a.ok){let e="Failed to fetch invoices";try{e=(await a.json()).message||e}catch{e=404===a.status?"Workspace not found or no invoices available":401===a.status?"Unauthorized - Please check your session":`Failed to fetch invoices (${a.status}: ${a.statusText})`}throw new Error(e)}const s=await a.json();if(void 0!==s.success){if(!s.success)throw new Error(s.message||"Failed to fetch invoices");return s}return s}async getInvoice(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/invoices/${t}`,{});if(!r.ok){let e="Failed to fetch invoice";try{e=(await r.json()).message||e}catch{e=404===r.status?"Invoice not found":401===r.status?"Unauthorized - Please check your session":`Failed to fetch invoice (${r.status}: ${r.statusText})`}throw new Error(e)}const n=await r.json();if(void 0!==n.success){if(!n.success)throw new Error(n.message||"Failed to fetch invoice");return n}return n}async cancelSubscriptionAtPeriodEnd(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/cancel-at-period-end`,{method:"POST"});if(!t.ok){let e="Failed to cancel subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to cancel subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to cancel subscription");return r.data||r}return r}async resumeSubscription(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/resume`,{method:"POST"});if(!t.ok){let e="Failed to resume subscription";try{e=(await t.json()).message||e}catch{e=404===t.status?"Subscription not found":401===t.status?"Unauthorized - Please check your session":`Failed to resume subscription (${t.status}: ${t.statusText})`}throw new Error(e)}const r=await t.json();if(void 0!==r.success){if(!r.success)throw new Error(r.message||"Failed to resume subscription");return r.data||r}return r}}function Qt(){const e=qt(),r=function(e){return t.useMemo(()=>new Xt(e),[e.serverUrl,e.version,e.orgId])}(e);return t.useMemo(()=>({os:e,api:r}),[e,r])}const er=()=>{const e=hr(),{os:r,api:n}=Qt(),a=mr(e=>e.workspaces),s=mr(e=>e.auth.session?.user),o=t.useCallback((t,r)=>{if((!(t._id===a.currentWorkspace?._id)||r?.forceEmit)&&t){const r=a.currentWorkspace;e.workspaces(Et(t)),Gt.emitWorkspaceChanged(t,r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[a.currentWorkspace,e]),i=t.useCallback(async(t,n)=>{const a=++u.current;e.workspaces(Rt(t._id));try{const e=r.auth?.callbacks?.onWorkspaceChange;if(e){const r=Ft(t,s?.id);try{await e({workspace:t,user:s??null,role:r})}catch(e){throw De(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:t._id}}),e}if(a!==u.current)return}o(t,n)}finally{a===u.current&&e.workspaces(Rt(null))}},[e,r.auth?.callbacks?.onWorkspaceChange,o,s]);t.useEffect(()=>{if(!a.isInitialized){const t=Ot();if(e.workspaces(Nt(!0)),t){const e=a.workspaces.find(e=>e._id===t);e&&i(e,{forceEmit:!0}).catch(()=>{})}}},[a.isInitialized,a.workspaces,a.currentWorkspace,e,i]);const c=t.useCallback(()=>{e.workspaces(Ct())},[e]),l=t.useRef(!1),d=t.useRef(!1),u=t.useRef(0),f=t.useCallback(async()=>{if(!a.loading&&!l.current){l.current=!0,e.workspaces(At(!0)),e.workspaces(_t(null));try{const t=await n.getWorkspaces();if(e.workspaces(kt(t)),t.length>0){const e=Ot();if(e&&Dt(e,t)){const r=t.find(t=>t._id===e);if(r)try{await i(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await i(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(_t(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(At(!1)),l.current=!1}}},[n,a.loading,e,i]),p=t.useCallback(async()=>{if(!a.refreshing&&!l.current){l.current=!0,e.workspaces(Tt(!0));try{const t=await n.getWorkspaces();e.workspaces(kt(t))}catch(e){}finally{e.workspaces(Tt(!1)),l.current=!1}}},[n,a.refreshing,e]),m=t.useCallback(async(t,r)=>{const s=await n.createWorkspace({name:t,image:r});e.workspaces(kt([...a.workspaces,s])),Gt.emitWorkspaceCreated(s).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:s._id}})})},[n,a.workspaces,e]),h=t.useCallback(async(t,r)=>{const s=await n.updateWorkspace(t._id,r);e.workspaces(kt(a.workspaces.map(e=>e._id===t._id?s:e))),Gt.emitWorkspaceUpdated(s).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:s._id}})})},[n,a.workspaces,e]),g=t.useCallback(async()=>{if(d.current)return a.allFeatures.length>0?a.allFeatures:null;if(a.allFeatures.length>0)return a.allFeatures;d.current=!0;try{const t=await n.getFeatures();return e.workspaces(jt(t)),t}catch(e){return De(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{d.current=!1}},[n,e,a.allFeatures]),b=t.useCallback(async(e,t,r)=>await n.updateFeature(e,t,r),[n]);t.useEffect(()=>{if(!a.currentWorkspace?._id||0===a.workspaces.length)return;const t=a.currentWorkspace._id,r=a.workspaces.find(e=>e._id===t);if(r)r!==a.currentWorkspace&&e.workspaces(Et(r));else if(a.workspaces.length>0){const e=a.workspaces[0];e._id!==t&&i(e).catch(()=>{})}},[a.workspaces,a.currentWorkspace,e,i]);const y=t.useCallback(async e=>await n.getWorkspaceUsers(e),[n]),v=t.useCallback(async(e,t,r)=>{const s=await n.addUser(e,{email:t,role:r}),o=a.workspaces.find(t=>t._id===e);return o&&Gt.emitWorkspaceUserAdded(s.userId,o,r).catch(t=>{De(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:s.userId,role:r}})}),s},[n,a.workspaces]),x=t.useCallback(async(e,t)=>{const r=a.workspaces.find(t=>t._id===e);if(r&&Ut(r,t))throw new Error("Cannot remove the workspace owner");const s=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),o=await n.removeUser(e,t);if(r&&s){const t=s.role;Gt.emitWorkspaceUserRemoved(o.userId,r,t).catch(r=>{De(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:o.userId,role:t}})})}return o},[n,a.workspaces]),w=t.useCallback(async(e,t,r)=>{if(r.role){const r=a.workspaces.find(t=>t._id===e);if(r&&Ut(r,t))throw new Error("Cannot change the role of the workspace owner")}let s;if(r.role){const r=(await n.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);s=r?.role}const o=await n.updateUser(e,t,r);return r.role&&s&&s!==r.role&&Gt.emitWorkspaceUserRoleChanged(o.userId,o.workspace,s,r.role).catch(n=>{De(n,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:s,newRole:r.role}})}),o},[n,a.workspaces]),S=t.useCallback(async e=>{const t=await n.getProfile().catch(()=>null),r=await n.updateUserProfile(e);return Gt.emitUserUpdated(r,t||void 0).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:r._id}})}),r},[n]),k=t.useCallback(async()=>await n.getProfile(),[n]),j=t.useCallback(async e=>await n.getWorkspace(e),[n]),E=t.useCallback(async t=>{if(!s)throw new Error("User must be authenticated to delete a workspace");const r=a.workspaces.find(e=>e._id===t);if(!r)throw new Error("Workspace not found");if(!Ut(r,s.id))throw new Error("Only the workspace creator can delete the workspace");const o=await n.deleteWorkspace(t);return e.workspaces(kt(a.workspaces.filter(e=>e._id!==t))),a.currentWorkspace?._id===t&&e.workspaces(Ct()),r&&Gt.emitWorkspaceDeleted(r).catch(e=>{De(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),o},[n,a.workspaces,a.currentWorkspace,e,s]);return{workspaces:a.workspaces,loading:a.loading,error:a.error,fetchWorkspaces:f,refreshWorkspaces:p,refreshing:a.refreshing,currentWorkspace:a.currentWorkspace,setCurrentWorkspace:o,switchToWorkspace:i,resetCurrentWorkspace:c,createWorkspace:m,allFeatures:a.allFeatures,getFeatures:g,updateFeature:b,getWorkspace:j,updateWorkspace:h,getUsers:y,addUser:v,removeUser:x,updateUser:w,getProfile:k,updateUserProfile:S,deleteWorkspace:E,switching:null!==a.switchingToId,switchingToId:a.switchingToId}};let tr=[];function rr(){tr.forEach(e=>e())}const nr=e=>{const{os:r,api:n}=Qt(),a=o(r),[s,i]=t.useState(null),[c,l]=t.useState(!1),[d,u]=t.useState(null),f=t.useCallback(async()=>{if(e&&a){l(!0),u(null);try{const t=await n.getPublicPlans(e);i(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";u(r),De(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{l(!1)}}else i(null)},[n,e,a]);t.useEffect(()=>{f()},[f]);const p=e&&!a||c;return{items:s?.items??[],plans:s?.plans??[],notes:s?.notes,loading:p,error:d,refetch:f}},ar=e=>{const{api:r}=Qt(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,c]=t.useState(null),l=t.useCallback(async()=>{if(e){o(!0),c(null);try{const t=await r.getCurrentSubscription(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";c(r),De(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{l()},[l]),{subscription:n,loading:s,error:i,refetch:l}},sr=(e,r)=>{const{api:n}=Qt(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=r?await n.getPlanGroupByVersion(e,r):await n.getPlanGroup(e);s(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";l(n),De(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{planGroup:a,loading:o,error:c,refetch:d}},or=e=>{const{api:r}=Qt(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,c]=t.useState(null),l=t.useCallback(async()=>{if(e){o(!0),c(null);try{const t=await r.getPlanGroupVersions(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";c(r),De(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{l()},[l]),{versions:n,loading:s,error:i,refetch:l}},ir=e=>{const{api:r}=Qt(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{return await r.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw o(n),De(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{a(!1)}},[r,e]),loading:n,error:s}},cr=e=>{const{api:r}=Qt(),[n,a]=t.useState(!1),[s,o]=t.useState(null),i=t.useCallback(async(t,n)=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const a={planVersionId:t,...n?.billingInterval&&{billingInterval:n.billingInterval},...n?.successUrl&&{successUrl:n.successUrl},...n?.cancelUrl&&{cancelUrl:n.cancelUrl}},s=await r.updateSubscription(e,a);return rr(),s}catch(r){const a=r instanceof Error?r.message:"Failed to update subscription";throw o(a),De(r,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:n}}),r}finally{a(!1)}},[r,e]);return{updateSubscription:i,loading:n,error:s}},lr=(e,r)=>{const n=ar(e),a=sr(e,r),s=cr(e),o=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n,a]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||s.loading,error:n.error||a.error||s.error,updateSubscription:s.updateSubscription,refetch:o}},dr=(e,r=10,n)=>{const{api:a}=Qt(),[s,o]=t.useState([]),[i,c]=t.useState(!1),[l,d]=t.useState(!1),[u,f]=t.useState(null),p=t.useCallback(async()=>{if(!e)return o([]),void c(!1);d(!0),f(null);try{const t=await a.listInvoices(e,r,n);o(t.invoices||[]),c(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";f(a),De(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{d(!1)}},[a,e,r,n]);return t.useEffect(()=>{p()},[p]),{invoices:s,hasMore:i,loading:l,error:u,refetch:p}},ur=t.createContext(null);ur.displayName="SubscriptionContext";const fr=t.memo(function({children:r}){const{currentWorkspace:n}=er(),{subscription:a,loading:s,refetch:o}=ar(n?._id);t.useEffect(()=>{return e=o,tr.push(e),()=>{tr=tr.filter(t=>t!==e)};var e},[o]);const i=t.useMemo(()=>({response:a,loading:s,refetch:o}),[a,s,o]);return e.jsx(ur.Provider,{value:i,children:r})});function pr(){const e=t.useContext(ur);if(null===e)throw new Error("useSubscriptionContext must be used within SubscriptionContextProvider. Make sure SubscriptionContextProvider is wrapping your application (or the tree that uses subscription gates).");return e}function mr(e,r){const n=wt(),a=ft(),s=$t(),o=e||(e=>e);return We(t.useMemo(()=>({os:n,auth:a,workspaces:s}),[n,a,s]),o,r)}function hr(){const e=pt(),r=St(),n=Wt();return t.useMemo(()=>({auth:e,os:r,workspaces:n}),[e,r,n])}fr.displayName="SubscriptionContextProvider";class gr extends Zt{constructor(e){super(e)}async getProfile(e,t){return this.fetchJson("profile",{headers:{"x-session-id":e},signal:t},"Failed to fetch user profile")}}function br(e,t){return function(){return e.apply(t,arguments)}}const{toString:yr}=Object.prototype,{getPrototypeOf:vr}=Object,{iterator:xr,toStringTag:wr}=Symbol,Sr=(kr=Object.create(null),e=>{const t=yr.call(e);return kr[t]||(kr[t]=t.slice(8,-1).toLowerCase())});var kr;const jr=e=>(e=e.toLowerCase(),t=>Sr(t)===e),Er=e=>t=>typeof t===e,{isArray:Cr}=Array,Nr=Er("undefined");function Ar(e){return null!==e&&!Nr(e)&&null!==e.constructor&&!Nr(e.constructor)&&Rr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _r=jr("ArrayBuffer");const Tr=Er("string"),Rr=Er("function"),Pr=Er("number"),Or=e=>null!==e&&"object"==typeof e,Ir=e=>{if("object"!==Sr(e))return!1;const t=vr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||wr in e||xr in e)},Dr=jr("Date"),Ur=jr("File"),Fr=jr("Blob"),Mr=jr("FileList"),zr=jr("URLSearchParams"),[Lr,Vr,$r,Wr]=["ReadableStream","Request","Response","Headers"].map(jr);function Br(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Cr(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Ar(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),s=a.length;let o;for(n=0;n<s;n++)o=a[n],t.call(null,e[o],o,e)}}function Gr(e,t){if(Ar(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const Kr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Hr=e=>!Nr(e)&&e!==Kr;const Zr=(Jr="undefined"!=typeof Uint8Array&&vr(Uint8Array),e=>Jr&&e instanceof Jr);var Jr;const qr=jr("HTMLFormElement"),Yr=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Xr=jr("RegExp"),Qr=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Br(r,(r,a)=>{let s;!1!==(s=t(r,a,e))&&(n[a]=s||r)}),Object.defineProperties(e,n)};const en=jr("AsyncFunction"),tn=(rn="function"==typeof setImmediate,nn=Rr(Kr.postMessage),rn?setImmediate:nn?(an=`axios@${Math.random()}`,sn=[],Kr.addEventListener("message",({source:e,data:t})=>{e===Kr&&t===an&&sn.length&&sn.shift()()},!1),e=>{sn.push(e),Kr.postMessage(an,"*")}):e=>setTimeout(e));var rn,nn,an,sn;const on="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Kr):"undefined"!=typeof process&&process.nextTick||tn;var cn={isArray:Cr,isArrayBuffer:_r,isBuffer:Ar,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Rr(e.append)&&("formdata"===(t=Sr(e))||"object"===t&&Rr(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_r(e.buffer),t},isString:Tr,isNumber:Pr,isBoolean:e=>!0===e||!1===e,isObject:Or,isPlainObject:Ir,isEmptyObject:e=>{if(!Or(e)||Ar(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Lr,isRequest:Vr,isResponse:$r,isHeaders:Wr,isUndefined:Nr,isDate:Dr,isFile:Ur,isBlob:Fr,isRegExp:Xr,isFunction:Rr,isStream:e=>Or(e)&&Rr(e.pipe),isURLSearchParams:zr,isTypedArray:Zr,isFileList:Mr,forEach:Br,merge:function e(){const{caseless:t,skipUndefined:r}=Hr(this)&&this||{},n={},a=(a,s)=>{const o=t&&Gr(n,s)||s;Ir(n[o])&&Ir(a)?n[o]=e(n[o],a):Ir(a)?n[o]=e({},a):Cr(a)?n[o]=a.slice():r&&Nr(a)||(n[o]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Br(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Br(t,(t,n)=>{r&&Rr(t)?Object.defineProperty(e,n,{value:br(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,s,o;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),s=a.length;s-- >0;)o=a[s],n&&!n(o,e,t)||i[o]||(t[o]=e[o],i[o]=!0);e=!1!==r&&vr(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Sr,kindOfTest:jr,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Cr(e))return e;let t=e.length;if(!Pr(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[xr]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:qr,hasOwnProperty:Yr,hasOwnProp:Yr,reduceDescriptors:Qr,freezeMethods:e=>{Qr(e,(t,r)=>{if(Rr(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Rr(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return Cr(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Gr,global:Kr,isContextDefined:Hr,isSpecCompliantForm:function(e){return!!(e&&Rr(e.append)&&"FormData"===e[wr]&&e[xr])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Or(e)){if(t.indexOf(e)>=0)return;if(Ar(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Cr(e)?[]:{};return Br(e,(e,t)=>{const s=r(e,n+1);!Nr(s)&&(a[t]=s)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:en,isThenable:e=>e&&(Or(e)||Rr(e))&&Rr(e.then)&&Rr(e.catch),setImmediate:tn,asap:on,isIterable:e=>null!=e&&Rr(e[xr])};let ln=class e extends Error{static from(t,r,n,a,s,o){const i=new e(t.message,r||t.code,n,a,s);return i.cause=t,i.name=t.name,o&&Object.assign(i,o),i}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:cn.toJSONObject(this.config),code:this.code,status:this.status}}};ln.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ln.ERR_BAD_OPTION="ERR_BAD_OPTION",ln.ECONNABORTED="ECONNABORTED",ln.ETIMEDOUT="ETIMEDOUT",ln.ERR_NETWORK="ERR_NETWORK",ln.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ln.ERR_DEPRECATED="ERR_DEPRECATED",ln.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ln.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ln.ERR_CANCELED="ERR_CANCELED",ln.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ln.ERR_INVALID_URL="ERR_INVALID_URL";function dn(e){return cn.isPlainObject(e)||cn.isArray(e)}function un(e){return cn.endsWith(e,"[]")?e.slice(0,-2):e}function fn(e,t,r){return e?e.concat(t).map(function(e,t){return e=un(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const pn=cn.toFlatObject(cn,{},null,function(e){return/^is[A-Z]/.test(e)});function mn(e,t,r){if(!cn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=cn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!cn.isUndefined(t[e])})).metaTokens,a=r.visitor||l,s=r.dots,o=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&cn.isSpecCompliantForm(t);if(!cn.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(cn.isDate(e))return e.toISOString();if(cn.isBoolean(e))return e.toString();if(!i&&cn.isBlob(e))throw new ln("Blob is not supported. Use a Buffer instead.");return cn.isArrayBuffer(e)||cn.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(cn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(cn.isArray(e)&&function(e){return cn.isArray(e)&&!e.some(dn)}(e)||(cn.isFileList(e)||cn.endsWith(r,"[]"))&&(i=cn.toArray(e)))return r=un(r),i.forEach(function(e,n){!cn.isUndefined(e)&&null!==e&&t.append(!0===o?fn([r],n,s):null===o?r:r+"[]",c(e))}),!1;return!!dn(e)||(t.append(fn(a,r,s),c(e)),!1)}const d=[],u=Object.assign(pn,{defaultVisitor:l,convertValue:c,isVisitable:dn});if(!cn.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!cn.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),cn.forEach(r,function(r,s){!0===(!(cn.isUndefined(r)||null===r)&&a.call(t,r,cn.isString(s)?s.trim():s,n,u))&&e(r,n?n.concat(s):[s])}),d.pop()}}(e),t}function hn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function gn(e,t){this._pairs=[],e&&mn(e,this,t)}const bn=gn.prototype;function yn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function vn(e,t,r){if(!t)return e;const n=r&&r.encode||yn,a=cn.isFunction(r)?{serialize:r}:r,s=a&&a.serialize;let o;if(o=s?s(t,a):cn.isURLSearchParams(t)?t.toString():new gn(t,a).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}bn.append=function(e,t){this._pairs.push([e,t])},bn.toString=function(e){const t=e?function(t){return e.call(this,t,hn)}:hn;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class xn{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){cn.forEach(this.handlers,function(t){null!==t&&e(t)})}}var wn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Sn={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:gn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const kn="undefined"!=typeof window&&"undefined"!=typeof document,jn="object"==typeof navigator&&navigator||void 0,En=kn&&(!jn||["ReactNative","NativeScript","NS"].indexOf(jn.product)<0),Cn="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Nn=kn&&window.location.href||"http://localhost";var An={...Object.freeze({__proto__:null,hasBrowserEnv:kn,hasStandardBrowserEnv:En,hasStandardBrowserWebWorkerEnv:Cn,navigator:jn,origin:Nn}),...Sn};function _n(e){function t(e,r,n,a){let s=e[a++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),i=a>=e.length;if(s=!s&&cn.isArray(n)?n.length:s,i)return cn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&cn.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],a)&&cn.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let s;for(n=0;n<a;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(cn.isFormData(e)&&cn.isFunction(e.entries)){const r={};return cn.forEachEntry(e,(e,n)=>{t(function(e){return cn.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Tn={transitional:wn,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=cn.isObject(e);a&&cn.isHTMLForm(e)&&(e=new FormData(e));if(cn.isFormData(e))return n?JSON.stringify(_n(e)):e;if(cn.isArrayBuffer(e)||cn.isBuffer(e)||cn.isStream(e)||cn.isFile(e)||cn.isBlob(e)||cn.isReadableStream(e))return e;if(cn.isArrayBufferView(e))return e.buffer;if(cn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return mn(e,new An.classes.URLSearchParams,{visitor:function(e,t,r,n){return An.isNode&&cn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=cn.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return mn(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(cn.isString(e))try{return(t||JSON.parse)(e),cn.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Tn.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(cn.isResponse(e)||cn.isReadableStream(e))return e;if(e&&cn.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw ln.from(e,ln.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:An.classes.FormData,Blob:An.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};cn.forEach(["delete","get","head","post","put","patch"],e=>{Tn.headers[e]={}});const Rn=cn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Pn=Symbol("internals");function On(e){return e&&String(e).trim().toLowerCase()}function In(e){return!1===e||null==e?e:cn.isArray(e)?e.map(In):String(e)}function Dn(e,t,r,n,a){return cn.isFunction(n)?n.call(this,t,r):(a&&(t=r),cn.isString(t)?cn.isString(n)?-1!==t.indexOf(n):cn.isRegExp(n)?n.test(t):void 0:void 0)}let Un=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=On(t);if(!a)throw new Error("header name must be a non-empty string");const s=cn.findKey(n,a);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=In(e))}const s=(e,t)=>cn.forEach(e,(e,r)=>a(e,r,t));if(cn.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(cn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&Rn[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(cn.isObject(e)&&cn.isIterable(e)){let r,n,a={};for(const t of e){if(!cn.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?cn.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=On(e)){const r=cn.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(cn.isFunction(t))return t.call(this,e,r);if(cn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=On(e)){const r=cn.findKey(this,e);return!(!r||void 0===this[r]||t&&!Dn(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=On(e)){const a=cn.findKey(r,e);!a||t&&!Dn(0,r[a],a,t)||(delete r[a],n=!0)}}return cn.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!Dn(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return cn.forEach(this,(n,a)=>{const s=cn.findKey(r,a);if(s)return t[s]=In(n),void delete t[a];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();o!==a&&delete t[a],t[o]=In(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return cn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&cn.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Pn]=this[Pn]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=On(e);t[n]||(!function(e,t){const r=cn.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return cn.isArray(e)?e.forEach(n):n(e),this}};function Fn(e,t){const r=this||Tn,n=t||r,a=Un.from(n.headers);let s=n.data;return cn.forEach(e,function(e){s=e.call(r,s,a.normalize(),t?t.status:void 0)}),a.normalize(),s}function Mn(e){return!(!e||!e.__CANCEL__)}Un.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),cn.reduceDescriptors(Un.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),cn.freezeMethods(Un);let zn=class extends ln{constructor(e,t,r){super(null==e?"canceled":e,ln.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Ln(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new ln("Request failed with status code "+r.status,[ln.ERR_BAD_REQUEST,ln.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Vn=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,s=0,o=0;return t=void 0!==t?t:1e3,function(i){const c=Date.now(),l=n[o];a||(a=c),r[s]=i,n[s]=c;let d=o,u=0;for(;d!==s;)u+=r[d++],d%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,s=1e3/t;const o=(t,s=Date.now())=>{a=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-i)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,i=s-n,c=a(i);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:i,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},$n=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Wn=e=>(...t)=>cn.asap(()=>e(...t));var Bn=An.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,An.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(An.origin),An.navigator&&/(msie|trident)/i.test(An.navigator.userAgent)):()=>!0,Gn=An.hasStandardBrowserEnv?{write(e,t,r,n,a,s,o){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];cn.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),cn.isString(n)&&i.push(`path=${n}`),cn.isString(a)&&i.push(`domain=${a}`),!0===s&&i.push("secure"),cn.isString(o)&&i.push(`SameSite=${o}`),document.cookie=i.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Kn(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Hn=e=>e instanceof Un?{...e}:e;function Zn(e,t){t=t||{};const r={};function n(e,t,r,n){return cn.isPlainObject(e)&&cn.isPlainObject(t)?cn.merge.call({caseless:n},e,t):cn.isPlainObject(t)?cn.merge({},t):cn.isArray(t)?t.slice():t}function a(e,t,r,a){return cn.isUndefined(t)?cn.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function s(e,t){if(!cn.isUndefined(t))return n(void 0,t)}function o(e,t){return cn.isUndefined(t)?cn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(r,a,s){return s in t?n(r,a):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:i,headers:(e,t,r)=>a(Hn(e),Hn(t),0,!0)};return cn.forEach(Object.keys({...e,...t}),function(n){const s=c[n]||a,o=s(e[n],t[n],n);cn.isUndefined(o)&&s!==i||(r[n]=o)}),r}var Jn=e=>{const t=Zn({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:i}=t;if(t.headers=o=Un.from(o),t.url=vn(Kn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&o.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),cn.isFormData(r))if(An.hasStandardBrowserEnv||An.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(cn.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(An.hasStandardBrowserEnv&&(n&&cn.isFunction(n)&&(n=n(t)),n||!1!==n&&Bn(t.url))){const e=a&&s&&Gn.read(s);e&&o.set(a,e)}return t};var qn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Jn(e);let a=n.data;const s=Un.from(n.headers).normalize();let o,i,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Un.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Ln(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new ln("Request aborted",ln.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new ln(n,ln.ERR_NETWORK,e,h);a.event=t||null,r(a),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||wn;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new ln(t,a.clarifyTimeoutError?ln.ETIMEDOUT:ln.ECONNABORTED,e,h)),h=null},void 0===a&&s.setContentType(null),"setRequestHeader"in h&&cn.forEach(s.toJSON(),function(e,t){h.setRequestHeader(t,e)}),cn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Vn(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=Vn(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(o=t=>{h&&(r(!t||t.type?new zn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===An.protocols.indexOf(b)?r(new ln("Unsupported protocol "+b+":",ln.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Yn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof ln?t:new zn(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,a(new ln(`timeout of ${t}ms exceeded`,ln.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:i}=n;return i.unsubscribe=()=>cn.asap(o),i}},Xn=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},Qn=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},ea=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Qn(e))yield*Xn(r,t)}(e,t);let s,o=0,i=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return i(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:ta}=cn,ra=(({Request:e,Response:t})=>({Request:e,Response:t}))(cn.global),{ReadableStream:na,TextEncoder:aa}=cn.global,sa=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},oa=e=>{e=cn.merge.call({skipUndefined:!0},ra,e);const{fetch:t,Request:r,Response:n}=e,a=t?ta(t):"function"==typeof fetch,s=ta(r),o=ta(n);if(!a)return!1;const i=a&&ta(na),c=a&&("function"==typeof aa?(l=new aa,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=s&&i&&sa(()=>{let e=!1;const t=new r(An.origin,{body:new na,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=o&&i&&sa(()=>cn.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new ln(`Response type '${e}' is not supported`,ln.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=cn.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(cn.isBlob(e))return e.size;if(cn.isSpecCompliantForm(e)){const t=new r(An.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return cn.isArrayBufferView(e)||cn.isArrayBuffer(e)?e.byteLength:(cn.isURLSearchParams(e)&&(e+=""),cn.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:o,data:i,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:y,withCredentials:v="same-origin",fetchOptions:x}=Jn(e),w=t||fetch;b=b?(b+"").toLowerCase():"text";let S=Yn([c,l&&l.toAbortSignal()],m),k=null;const j=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==o&&"head"!==o&&0!==(E=await p(y,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(cn.isFormData(i)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=$n(E,Vn(Wn(g)));i=ea(t.body,65536,e,r)}}cn.isString(v)||(v=v?"include":"omit");const t=s&&"credentials"in r.prototype,c={...x,signal:S,method:o.toUpperCase(),headers:y.normalize().toJSON(),body:i,duplex:"half",credentials:t?v:void 0};k=s&&new r(a,c);let l=await(s?w(k,x):w(a,c));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&j)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=cn.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&$n(t,Vn(Wn(h),!0))||[];l=new n(ea(l.body,65536,r,()=>{a&&a(),j&&j()}),e)}b=b||"text";let C=await f[cn.findKey(f,b)||"text"](l,e);return!m&&j&&j(),await new Promise((t,r)=>{Ln(t,r,{data:C,headers:Un.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(j&&j(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ln("Network Error",ln.ERR_NETWORK,e,k),{cause:t.cause||t});throw ln.from(t,t&&t.code,e,k)}}},ia=new Map,ca=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,s=[n,a,r];let o,i,c=s.length,l=ia;for(;c--;)o=s[c],i=l.get(o),void 0===i&&l.set(o,i=c?new Map:oa(t)),l=i;return i};ca();const la={http:null,xhr:qn,fetch:{get:ca}};cn.forEach(la,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const da=e=>`- ${e}`,ua=e=>cn.isFunction(e)||null===e||!1===e;var fa={getAdapter:function(e,t){e=cn.isArray(e)?e:[e];const{length:r}=e;let n,a;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],a=n,!ua(n)&&(a=la[(r=String(n)).toLowerCase()],void 0===a))throw new ln(`Unknown adapter '${r}'`);if(a&&(cn.isFunction(a)||(a=a.get(t))))break;s[r||"#"+o]=a}if(!a){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(da).join("\n"):" "+da(e[0]):"as no adapter specified";throw new ln("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:la};function pa(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new zn(null,e)}function ma(e){pa(e),e.headers=Un.from(e.headers),e.data=Fn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return fa.getAdapter(e.adapter||Tn.adapter,e)(e).then(function(t){return pa(e),t.data=Fn.call(e,e.transformResponse,t),t.headers=Un.from(t.headers),t},function(t){return Mn(t)||(pa(e),t&&t.response&&(t.response.data=Fn.call(e,e.transformResponse,t.response),t.response.headers=Un.from(t.response.headers))),Promise.reject(t)})}const ha="1.13.4",ga={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ga[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ba={};ga.transitional=function(e,t,r){function n(e,t){return"[Axios v"+ha+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,s)=>{if(!1===e)throw new ln(n(a," has been removed"+(t?" in "+t:"")),ln.ERR_DEPRECATED);return t&&!ba[a]&&(ba[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,s)}},ga.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var ya={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ln("options must be an object",ln.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const s=n[a],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new ln("option "+s+" must be "+r,ln.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new ln("Unknown option "+s,ln.ERR_BAD_OPTION)}},validators:ga};const va=ya.validators;let xa=class{constructor(e){this.defaults=e||{},this.interceptors={request:new xn,response:new xn}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Zn(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&ya.assertOptions(r,{silentJSONParsing:va.transitional(va.boolean),forcedJSONParsing:va.transitional(va.boolean),clarifyTimeoutError:va.transitional(va.boolean)},!1),null!=n&&(cn.isFunction(n)?t.paramsSerializer={serialize:n}:ya.assertOptions(n,{encode:va.function,serialize:va.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ya.assertOptions(t,{baseUrl:va.spelling("baseURL"),withXsrfToken:va.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=a&&cn.merge(a.common,a[t.method]);a&&cn.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Un.concat(s,a);const o=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!i){const e=[ma.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){const e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=ma.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return vn(Kn((e=Zn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};cn.forEach(["delete","get","head","options"],function(e){xa.prototype[e]=function(t,r){return this.request(Zn(r||{},{method:e,url:t,data:(r||{}).data}))}}),cn.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(Zn(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}xa.prototype[e]=t(),xa.prototype[e+"Form"]=t(!0)});const wa={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(wa).forEach(([e,t])=>{wa[t]=e});const Sa=function e(t){const r=new xa(t),n=br(xa.prototype.request,r);return cn.extend(n,xa.prototype,r,{allOwnKeys:!0}),cn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Zn(t,r))},n}(Tn);Sa.Axios=xa,Sa.CanceledError=zn,Sa.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new zn(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Sa.isCancel=Mn,Sa.VERSION=ha,Sa.toFormData=mn,Sa.AxiosError=ln,Sa.Cancel=Sa.CanceledError,Sa.all=function(e){return Promise.all(e)},Sa.spread=function(e){return function(t){return e.apply(null,t)}},Sa.isAxiosError=function(e){return cn.isObject(e)&&!0===e.isAxiosError},Sa.mergeConfig=Zn,Sa.AxiosHeaders=Un,Sa.formToJSON=e=>_n(cn.isHTMLForm(e)?new FormData(e):e),Sa.getAdapter=fa.getAdapter,Sa.HttpStatusCode=wa,Sa.default=Sa;const{Axios:ka,AxiosError:ja,CanceledError:Ea,isCancel:Ca,CancelToken:Na,VERSION:Aa,all:_a,Cancel:Ta,isAxiosError:Ra,spread:Pa,toFormData:Oa,AxiosHeaders:Ia,HttpStatusCode:Da,formToJSON:Ua,getAdapter:Fa,mergeConfig:Ma}=Sa;const za=new class{constructor(e={}){this.client=Sa.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=tt();return t&&(e.headers=e.headers??{},e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};const La=new class{constructor(){this.listeners=new Set,this.currentState={open:!1,section:"profile"}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getState(){return{...this.currentState}}openWorkspaceSettings(e){this.currentState={open:!0,section:e||"profile"},this.notifyListeners()}closeSettings(){this.currentState={...this.currentState,open:!1},this.notifyListeners()}setSection(e){this.currentState={...this.currentState,section:e},this.notifyListeners()}notifyListeners(){this.listeners.forEach(e=>{e(this.currentState.open,this.currentState.section)})}};function Va(){return mr(e=>e.auth)}function $a(){const e=hr(),r=Va(),n=qt(),{serverUrl:a,orgId:s,auth:o}=n,{resetCurrentWorkspace:i,currentWorkspace:c}=er(),l=t.useCallback(async()=>{e.auth(Me());try{const t=await za.post(`${a}/api/v1/auth/request`,{orgId:s,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(Le()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(Le()),De(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,s,o,e]),d=t.useCallback(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth($e()),i(),et()}catch(e){De(e,{component:"useSaaSAuth",action:"signOut"}),et()}},[e,i,o?.callbacks?.onSignOut]),u=t.useCallback(e=>{c?La.openWorkspaceSettings(e):De(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[c]),f=t.useMemo(()=>Ke(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...f,signIn:l,signOut:d,openWorkspaceSettings:u}),[r.session,r.status,f,l,d,u])}const Wa=t.memo(({children:r,callbacks:n})=>{const a=hr(),s=Va(),i=qt(),c=Ke(s.status).isAuthenticated,l=t.useRef(!1),d=t.useRef(null),u=t.useRef(!1),f=t.useMemo(()=>n,[n]),p=t.useCallback(async e=>{try{if(f?.handleAuthentication){const{sessionId:t}=await f.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=i;if(!o(r))throw new Error("OS configuration is not available");const{serverUrl:n,version:s,orgId:c}=r,l=new gr({serverUrl:n,version:s}),d=await l.getProfile(t),u=at(Qe(d,c,r.auth?.clientId||""),t);a.auth(Ve(u)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(qe),window.history.replaceState({},"",e.toString())}catch(e){De(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:qe}})}}()}}catch(t){throw De(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),a.auth(Le()),t}},[a,f,i]);return Kt(async e=>{if("undefined"==typeof window)return;if(c)return;if(u.current)return;if(nt())return;const t=tt();if(t){u.current=!0;try{if(!o(i))return u.current=!1,void De(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const{orgId:r}=i;let n;try{const r=new gr({serverUrl:i.serverUrl,version:i.version});n=await r.getProfile(t,e)}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return u.current=!1,et(),void a.auth(Le())}const s=at(Qe(n,r,i.auth?.clientId||""),t);a.auth(Ve(s))}catch(e){if(!Ue(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:e instanceof Error&&("User data missing required ID field"===e.message||"User data missing required email field"===e.message)?"validateUserData":"pageLoad"}}))return;et(),a.auth(Le())}finally{u.current=!1}}else a.auth(Le())},[c,a,i]),t.useEffect(()=>{const e=nt();e&&(l.current||d.current===e||o(i)&&(l.current=!0,d.current=e,a.auth(ze()),p(e).then(()=>{d.current=null}).catch(t=>{De(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),d.current=null}).finally(()=>{l.current=!1})))},[p,i.serverUrl,i.version,i.orgId]),e.jsx(e.Fragment,{children:r})});Wa.displayName="AuthProviderWrapper";const Ba=t.memo(({config:r,auth:n,children:a})=>{const s=hr(),i=qt(),c=t.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);t.useEffect(()=>{s.os(mt({...r,auth:c}))},[r,c,s]);const l=t.useMemo(()=>o(i)?new Jt(i):null,[i.serverUrl,i.version,i.orgId]);return Kt(async e=>{if(!l||i.settings)return;const t=await l.getSettings(e);s.os(ht(t))},[l,i.settings,s],{onError:e=>De(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:i.serverUrl,version:i.version,orgId:i.orgId}})}),e.jsx(e.Fragment,{children:a})});Ba.displayName="ContextConfigProvider";const Ga=t.createContext({container:null,setContainer:()=>{}}),Ka=t.memo(({children:r})=>{const[n,a]=t.useState(null),s=t.useMemo(()=>({container:n,setContainer:a}),[n]),o=t.useMemo(()=>r,[r]);return e.jsxs(Ga.Provider,{value:s,children:[o,e.jsx("div",{ref:a,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Ka.displayName="PortalProvider";class Ha extends Zt{constructor(e){super(e)}async getAttributes(e){const t=await this.fetchResponse("users/attributes",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user attributes"));const r=await t.json();return r&&"object"==typeof r&&!Array.isArray(r)?r:{}}async updateAttributes(e){return this.fetchJson("users/attributes",{method:"PATCH",body:JSON.stringify({attributes:e})},"Failed to update user attributes")}async updateAttribute(e,t){return this.fetchJson(`users/attributes/${e}`,{method:"PATCH",body:JSON.stringify({value:t})},"Failed to update user attribute")}async getFeatures(e){const t=await this.fetchResponse("users/features",{signal:e});if(!t.ok)throw new Error(await Te(t,"Failed to fetch user features"));const r=await t.json();return"object"==typeof r&&null!==r?r:{}}}const Za=t.createContext(void 0),Ja=t.memo(({children:r})=>{const n=qt(),a=function(){const e=qt();return t.useMemo(()=>new Ha(e),[e.serverUrl,e.version])}(),{isAuthenticated:s}=$a(),{serverUrl:o,version:i}=n,[c,l]=t.useState({}),[d,u]=t.useState({}),[f,p]=t.useState(!1),[m,h]=t.useState(null),g=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getAttributes(e);l(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");h(t),De(e,{component:"UserProvider",action:"fetchAttributes"})}else l({})},[a,o,i,s]),b=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await g()}finally{p(!1)}}},[o,i,s,g]),y=t.useCallback(async e=>{p(!0),h(null);try{const t=await a.updateAttributes(e);return await g(),t}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw h(r),De(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),t}finally{p(!1)}},[a,g]),v=t.useCallback(async(e,t)=>{p(!0),h(null);try{const r=await a.updateAttribute(e,t);return await g(),r}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw h(n),De(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),r}finally{p(!1)}},[a,g]),x=t.useCallback(async e=>{if(o&&i&&s)try{const t=await a.getFeatures(e);u(t)}catch(e){if(Ae(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");h(t),De(e,{component:"UserProvider",action:"fetchFeatures"})}else u({})},[a,o,i,s]),w=t.useCallback(async()=>{if(o&&i&&s){p(!0),h(null);try{await x()}finally{p(!1)}}},[o,i,s,x]);Kt(async e=>{if(!s||!o||!i)return l({}),void u({});p(!0),h(null);try{await Promise.all([g(e),x(e)])}finally{p(!1)}},[s,o,i,g,x],{onError:e=>De(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const S=t.useMemo(()=>({attributes:c,features:d,isLoading:f,error:m,updateAttributes:y,updateAttribute:v,refreshAttributes:b,refreshFeatures:w}),[c,d,f,m,y,v,b,w]);return e.jsx(Za.Provider,{value:S,children:r})});Ja.displayName="UserProvider";const qa=t.lazy(()=>Promise.resolve().then(function(){return aj}).then(e=>({default:e.default}))),Ya=({children:r})=>{const{currentWorkspace:n}=er(),[a,s]=t.useState(!1),[o,i]=t.useState("profile");return t.useEffect(()=>{const e=La.getState();s(e.open),i(e.section);return La.subscribe((e,t)=>{s(e),i(t)})},[]),e.jsxs(e.Fragment,{children:[r,n&&a&&e.jsx(t.Suspense,{fallback:null,children:e.jsx(qa,{workspace:n,open:a,onOpenChange:e=>{e||La.closeSettings()},section:o,onSectionChange:e=>{La.setSection(e)},showTrigger:!1})})]})},Xa=(e,t,r)=>{if(t!==exports.ApiVersion.V1)throw new Error(`Invalid version: "${t}". Only "${exports.ApiVersion.V1}" is currently supported.`);if(!e||"string"!=typeof e)throw new Error("serverUrl is required and must be a string");if(!(e=>{try{return new URL(e),!0}catch{return!1}})(e))throw new Error(`Invalid serverUrl: "${e}". Must be a valid URL.`);if(!r||"string"!=typeof r)throw new Error("orgId is required and must be a string");if(!/^[0-9a-fA-F]{24}$/.test(r))throw new Error(`Invalid orgId: "${r}". Must be a valid MongoDB ObjectId (24 hexadecimal characters).`)},Qa=t.memo(({serverUrl:r,version:n,orgId:a,auth:s,children:o})=>{Xa(r,n,a);const i=t.useMemo(()=>({serverUrl:r,version:n,orgId:a}),[r,n,a]),c=t.useMemo(()=>s?.callbacks,[s?.callbacks]),l=t.useMemo(()=>s?.callbacks?.handleEvent,[s?.callbacks]);return t.useEffect(()=>(Gt.setCallbacks(l?{handleEvent:l}:null),()=>{Gt.setCallbacks(null)}),[l]),e.jsx(Fe,{children:e.jsx(Bt,{children:e.jsx(Wa,{callbacks:c,children:e.jsx(Ka,{children:e.jsx(Ba,{config:i,auth:s,children:e.jsx(Ja,{children:e.jsx(Ya,{children:e.jsx(fr,{children:o})})})})})})})})});Qa.displayName="SaaSOSProvider";var es=e=>"checkbox"===e.type,ts=e=>e instanceof Date,rs=e=>null==e;const ns=e=>"object"==typeof e;var as=e=>!rs(e)&&!Array.isArray(e)&&ns(e)&&!ts(e),ss=e=>as(e)&&e.target?es(e.target)?e.target.checked:e.target.value:e,os=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),is="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function cs(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(is&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||as(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return as(t)&&t.hasOwnProperty("isPrototypeOf")})(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=cs(e[t]));return n}var ls=e=>/^\w*$/.test(e),ds=e=>void 0===e,us=e=>Array.isArray(e)?e.filter(Boolean):[],fs=e=>us(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ps=(e,t,r)=>{if(!t||!as(e))return r;const n=(ls(t)?[t]:fs(t)).reduce((e,t)=>rs(e)?e:e[t],e);return ds(n)||n===e?ds(e[t])?r:e[t]:n},ms=e=>"boolean"==typeof e,hs=e=>"function"==typeof e,gs=(e,t,r)=>{let n=-1;const a=ls(t)?[t]:fs(t),s=a.length,o=s-1;for(;++n<s;){const t=a[n];let s=r;if(n!==o){const r=e[t];s=as(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};const bs="blur",ys="focusout",vs="change",xs="onBlur",ws="onChange",Ss="onSubmit",ks="onTouched",js="all",Es="max",Cs="min",Ns="maxLength",As="minLength",_s="pattern",Ts="required",Rs="validate",Ps=t.createContext(null);Ps.displayName="HookFormControlContext";const Os=()=>t.useContext(Ps);var Is=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const a=s;return t._proxyFormState[a]!==js&&(t._proxyFormState[a]=!n||js),r&&(r[a]=!0),e[a]}});return a};const Ds="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;var Us=e=>"string"==typeof e,Fs=(e,t,r,n,a)=>Us(e)?(n&&t.watch.add(e),ps(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),ps(r,e))):(n&&(t.watchAll=!0),r),Ms=e=>rs(e)||!ns(e);function zs(e,t,r=new WeakSet){if(Ms(e)||Ms(t))return Object.is(e,t);if(ts(e)&&ts(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const n=e[s];if(!a.includes(s))return!1;if("ref"!==s){const e=t[s];if(ts(n)&&ts(e)||as(n)&&as(e)||Array.isArray(n)&&Array.isArray(e)?!zs(n,e,r):!Object.is(n,e))return!1}}return!0}function Ls(e){const r=Os(),{name:n,disabled:a,control:s=r,shouldUnregister:o,defaultValue:i,exact:c=!0}=e,l=os(s._names.array,n),d=t.useMemo(()=>ps(s._formValues,n,ps(s._defaultValues,n,i)),[s,n,i]),u=function(e){const r=Os(),{control:n=r,name:a,defaultValue:s,disabled:o,exact:i,compute:c}=e||{},l=t.useRef(s),d=t.useRef(c),u=t.useRef(void 0),f=t.useRef(n),p=t.useRef(a);d.current=c;const[m,h]=t.useState(()=>{const e=n._getWatch(a,l.current);return d.current?d.current(e):e}),g=t.useCallback(e=>{const t=Fs(a,n._names,e||n._formValues,!1,l.current);return d.current?d.current(t):t},[n._formValues,n._names,a]),b=t.useCallback(e=>{if(!o){const t=Fs(a,n._names,e||n._formValues,!1,l.current);if(d.current){const e=d.current(t);zs(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,o,a]);Ds(()=>(f.current===n&&zs(p.current,a)||(f.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{b(e.values)}})),[n,i,a,b]),t.useEffect(()=>n._removeUnmounted());const y=f.current!==n,v=p.current,x=t.useMemo(()=>{if(o)return null;const e=!y&&!zs(v,a);return y||e?g():null},[o,y,a,v,g]);return null!==x?x:m}({control:s,name:n,defaultValue:d,exact:c}),f=function(e){const r=Os(),{control:n=r,disabled:a,name:s,exact:o}=e||{},[i,c]=t.useState(n._formState),l=t.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ds(()=>n._subscribe({name:s,formState:l.current,exact:o,callback:e=>{!a&&c({...n._formState,...e})}}),[s,a,o]),t.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),t.useMemo(()=>Is(i,n,l.current,!1),[i,n])}({control:s,name:n,exact:c}),p=t.useRef(e),m=t.useRef(void 0),h=t.useRef(s.register(n,{...e.rules,value:u,...ms(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=t.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ps(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!ps(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ps(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ps(f.validatingFields,n)},error:{enumerable:!0,get:()=>ps(f.errors,n)}}),[f,n]),b=t.useCallback(e=>h.current.onChange({target:{value:ss(e),name:n},type:vs}),[n]),y=t.useCallback(()=>h.current.onBlur({target:{value:ps(s._formValues,n),name:n},type:bs}),[n,s._formValues]),v=t.useCallback(e=>{const t=ps(s._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>hs(e.focus)&&e.focus(),select:()=>hs(e.select)&&e.select(),setCustomValidity:t=>hs(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>hs(e.reportValidity)&&e.reportValidity()})},[s._fields,n]),x=t.useMemo(()=>({name:n,value:u,...ms(a)||f.disabled?{disabled:f.disabled||a}:{},onChange:b,onBlur:y,ref:v}),[n,a,f.disabled,b,y,v,u]);return t.useEffect(()=>{const e=s._options.shouldUnregister||o,t=m.current;t&&t!==n&&!l&&s.unregister(t),s.register(n,{...p.current.rules,...ms(p.current.disabled)?{disabled:p.current.disabled}:{}});const r=(e,t)=>{const r=ps(s._fields,e);r&&r._f&&(r._f.mount=t)};if(r(n,!0),e){const e=cs(ps(s._options.defaultValues,n,p.current.defaultValue));gs(s._defaultValues,n,e),ds(ps(s._formValues,n))&&gs(s._formValues,n,e)}return!l&&s.register(n),m.current=n,()=>{(l?e&&!s._state.action:e)?s.unregister(n):r(n,!1)}},[n,s,l,o]),t.useEffect(()=>{s._setDisabledField({disabled:a,name:n})},[a,n,s]),t.useMemo(()=>({field:x,formState:f,fieldState:g}),[x,f,g])}const Vs=e=>e.render(Ls(e)),$s=t.createContext(null);$s.displayName="HookFormContext";const Ws=e=>{const{children:r,watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:c,trigger:l,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}=e;return t.createElement($s.Provider,{value:t.useMemo(()=>({watch:n,getValues:a,getFieldState:s,setError:o,clearErrors:i,setValue:c,trigger:l,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}),[i,h,d,s,a,p,g,f,u,o,b,c,y,l,m,n])},t.createElement(Ps.Provider,{value:h},r))};var Bs=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},Gs=e=>Array.isArray(e)?e:[e],Ks=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Hs(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&as(a)&&s){const e=Hs(a,s);as(e)&&(r[n]=e)}else e[n]&&(r[n]=s)}return r}var Zs=e=>as(e)&&!Object.keys(e).length,Js=e=>"file"===e.type,qs=e=>{if(!is)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ys=e=>"select-multiple"===e.type,Xs=e=>"radio"===e.type,Qs=e=>qs(e)&&e.isConnected;function eo(e,t){const r=Array.isArray(t)?t:ls(t)?[t]:fs(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=ds(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(as(n)&&Zs(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!ds(e[t]))return!1;return!0}(n))&&eo(e,r.slice(0,-1)),e}function to(e){return Array.isArray(e)||as(e)&&!(e=>{for(const t in e)if(hs(e[t]))return!0;return!1})(e)}function ro(e,t={}){for(const r in e){const n=e[r];to(n)?(t[r]=Array.isArray(n)?[]:{},ro(n,t[r])):ds(n)||(t[r]=!0)}return t}function no(e,t,r){r||(r=ro(t));for(const n in e){const a=e[n];if(to(a))ds(t)||Ms(r[n])?r[n]=ro(a,Array.isArray(a)?[]:{}):no(a,rs(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!zs(a,e)}}return r}const ao={value:!1,isValid:!1},so={value:!0,isValid:!0};var oo=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ds(e[0].attributes.value)?ds(e[0].value)||""===e[0].value?so:{value:e[0].value,isValid:!0}:so:ao}return ao},io=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>ds(e)?e:t?""===e?NaN:e?+e:e:r&&Us(e)?new Date(e):n?n(e):e;const co={isValid:!1,value:null};var lo=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,co):co;function uo(e){const t=e.ref;return Js(t)?t.files:Xs(t)?lo(e.refs).value:Ys(t)?[...t.selectedOptions].map(({value:e})=>e):es(t)?oo(e.refs).value:io(ds(t.value)?e.ref.value:t.value,e)}var fo=e=>e instanceof RegExp,po=e=>ds(e)?e:fo(e)?e.source:as(e)?fo(e.value)?e.value.source:e.value:e,mo=e=>({isOnSubmit:!e||e===Ss,isOnBlur:e===xs,isOnChange:e===ws,isOnAll:e===js,isOnTouch:e===ks});const ho="AsyncFunction";var go=e=>!!e&&!!e.validate&&!!(hs(e.validate)&&e.validate.constructor.name===ho||as(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ho)),bo=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const yo=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=ps(e,a);if(r){const{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;if(e.ref&&t(e.ref,e.name)&&!n)return!0;if(yo(s,t))break}else if(as(s)&&yo(s,t))break}}};function vo(e,t,r){const n=ps(e,r);if(n||ls(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),s=ps(t,n),o=ps(e,n);if(s&&!Array.isArray(s)&&r!==n)return{name:r};if(o&&o.type)return{name:n,error:o};if(o&&o.root&&o.root.type)return{name:`${n}.root`,error:o.root};a.pop()}return{name:r}}var xo=(e,t,r)=>{const n=Gs(ps(e,r));return gs(n,"root",t[r]),gs(e,r,n),e};function wo(e,t,r="validate"){if(Us(e)||Array.isArray(e)&&e.every(Us)||ms(e)&&!e)return{type:r,message:Us(e)?e:"",ref:t}}var So=e=>as(e)&&!fo(e)?e:{value:e,message:""},ko=async(e,t,r,n,a,s)=>{const{ref:o,refs:i,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,y=ps(r,h);if(!b||t.has(h))return{};const v=i?i[0]:o,x=e=>{a&&v.reportValidity&&(v.setCustomValidity(ms(e)?"":e||""),v.reportValidity())},w={},S=Xs(o),k=es(o),j=S||k,E=(g||Js(o))&&ds(o.value)&&ds(y)||qs(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,C=Bs.bind(null,h,n,w),N=(e,t,r,n=Ns,a=As)=>{const s=e?t:r;w[h]={type:e?n:a,message:s,ref:o,...C(e?n:a,s)}};if(s?!Array.isArray(y)||!y.length:c&&(!j&&(E||rs(y))||ms(y)&&!y||k&&!oo(i).isValid||S&&!lo(i).isValid)){const{value:e,message:t}=Us(c)?{value:!!c,message:c}:So(c);if(e&&(w[h]={type:Ts,message:t,ref:v,...C(Ts,t)},!n))return x(t),w}if(!(E||rs(u)&&rs(f))){let e,t;const r=So(f),a=So(u);if(rs(y)||isNaN(y)){const n=o.valueAsDate||new Date(y),s=e=>new Date((new Date).toDateString()+" "+e),i="time"==o.type,c="week"==o.type;Us(r.value)&&y&&(e=i?s(y)>s(r.value):c?y>r.value:n>new Date(r.value)),Us(a.value)&&y&&(t=i?s(y)<s(a.value):c?y<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(y?+y:y);rs(r.value)||(e=n>r.value),rs(a.value)||(t=n<a.value)}if((e||t)&&(N(!!e,r.message,a.message,Es,Cs),!n))return x(w[h].message),w}if((l||d)&&!E&&(Us(y)||s&&Array.isArray(y))){const e=So(l),t=So(d),r=!rs(e.value)&&y.length>+e.value,a=!rs(t.value)&&y.length<+t.value;if((r||a)&&(N(r,e.message,t.message),!n))return x(w[h].message),w}if(p&&!E&&Us(y)){const{value:e,message:t}=So(p);if(fo(e)&&!y.match(e)&&(w[h]={type:_s,message:t,ref:o,...C(_s,t)},!n))return x(t),w}if(m)if(hs(m)){const e=wo(await m(y,r),v);if(e&&(w[h]={...e,...C(Rs,e.message)},!n))return x(e.message),w}else if(as(m)){let e={};for(const t in m){if(!Zs(e)&&!n)break;const a=wo(await m[t](y,r),v,t);a&&(e={...a,...C(t,a.message)},x(a.message),n&&(w[h]=e))}if(!Zs(e)&&(w[h]={ref:v,...e},!n))return w}return x(!0),w};const jo={mode:Ss,reValidateMode:ws,shouldFocusError:!0};function Eo(e={}){let t,r={...jo,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:hs(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(as(r.defaultValues)||as(r.values))&&cs(r.defaultValues||r.values)||{},o=r.shouldUnregister?{}:cs(s),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...d};let f={...u};const p={array:Ks(),state:Ks()},m=r.criteriaMode===js,h=async e=>{if(!i.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=Zs((await x()).errors),g()):e=await w(a,!0),e!==n.isValid&&p.state.next({isValid:e})}},g=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(c.mount)).forEach(e=>{e&&(t?gs(n.validatingFields,e,t):eo(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Zs(n.validatingFields)}))},b=(e,t,r,n)=>{const c=ps(a,e);if(c){const a=ps(o,e,ds(r)?ps(s,e):r);ds(a)||n&&n.defaultChecked||t?gs(o,e,t?a:uo(c._f)):j(e,a),i.mount&&!i.action&&h()}},y=(e,t,a,o,i)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||o){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=zs(ps(s,e),t);l=!!ps(n.dirtyFields,e),r?eo(n.dirtyFields,e):gs(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=ps(n.touchedFields,e);t||(gs(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&i&&p.state.next(d)}return c?d:{}},v=(e,a,s,o)=>{const i=ps(n.errors,e),c=(u.isValid||f.isValid)&&ms(a)&&n.isValid!==a;var d;if(r.delayError&&s?(d=()=>((e,t)=>{gs(n.errors,e,t),p.state.next({errors:n.errors})})(e,s),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,s?gs(n.errors,e,s):eo(n.errors,e)),(s?!zs(i,s):i)||!Zs(o)||c){const t={...o,...c&&ms(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=async e=>{g(e,!0);const t=await r.resolver(o,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=ps(t,r);e&&gs(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},w=async(t,a,s={valid:!0})=>{for(const i in t){const l=t[i];if(l){const{_f:t,...i}=l;if(t){const i=c.array.has(t.name),d=l._f&&go(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await ko(l,c.disabled,o,m,r.shouldUseNativeValidation&&!a,i);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(ps(f,t.name)?i?xo(n.errors,f,t.name):gs(n.errors,t.name,f[t.name]):eo(n.errors,t.name))}!Zs(i)&&await w(i,a,s)}}return s.valid},S=(e,t)=>!r.disabled&&(e&&t&&gs(o,e,t),!zs(T(),s)),k=(e,t,r)=>Fs(e,c,{...i.mount?o:ds(t)?s:Us(e)?{[e]:t}:t},r,t),j=(e,t,r={})=>{const n=ps(a,e);let s=t;if(n){const r=n._f;r&&(!r.disabled&&gs(o,e,io(t,r)),s=qs(r.ref)&&rs(t)?"":t,Ys(r.ref)?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?es(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):Js(r.ref)?r.ref.value="":(r.ref.value=s,r.ref.type||p.state.next({name:e,values:cs(o)})))}(r.shouldDirty||r.shouldTouch)&&y(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&_(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const s=t[n],o=e+"."+n,i=ps(a,o);(c.array.has(e)||as(s)||i&&!i._f)&&!ts(s)?E(o,s,r):j(o,s,r)}},C=(e,t,r={})=>{const l=ps(a,e),d=c.array.has(e),m=cs(t);gs(o,e,m),d?(p.array.next({name:e,values:cs(o)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:no(s,o),isDirty:S(e,m)})):!l||l._f||rs(m)?j(e,m,r):E(e,m,r),bo(e,c)?p.state.next({...n,name:e,values:cs(o)}):p.state.next({name:i.mount?e:void 0,values:cs(o)})},N=async e=>{i.mount=!0;const s=e.target;let l=s.name,d=!0;const b=ps(a,l),S=e=>{d=Number.isNaN(e)||ts(e)&&isNaN(e.getTime())||zs(e,ps(o,l,e))},k=mo(r.mode),j=mo(r.reValidateMode);if(b){let i,E;const C=s.type?uo(b._f):ss(e),N=e.type===bs||e.type===ys,A=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!ps(n.errors,l)&&!b._f.deps||((e,t,r,n,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:!(r?n.isOnChange:a.isOnChange)||e))(N,ps(n.touchedFields,l),n.isSubmitted,j,k),T=bo(l,c,N);gs(o,l,C),N?s&&s.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const R=y(l,C,N),P=!Zs(R)||T;if(!N&&p.state.next({name:l,type:e.type,values:cs(o)}),A)return(u.isValid||f.isValid)&&("onBlur"===r.mode?N&&h():N||h()),P&&p.state.next({name:l,...T?{}:R});if(!N&&T&&p.state.next({...n}),r.resolver){const{errors:e}=await x([l]);if(g([l]),S(C),d){const t=vo(n.errors,a,l),r=vo(e,a,t.name||l);i=r.error,l=r.name,E=Zs(e)}}else g([l],!0),i=(await ko(b,c.disabled,o,m,r.shouldUseNativeValidation))[l],g([l]),S(C),d&&(i?E=!1:(u.isValid||f.isValid)&&(E=await w(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&_(b._f.deps),v(l,E,i,R))}},A=(e,t)=>{if(ps(n.errors,t)&&e.focus)return e.focus(),1},_=async(e,t={})=>{let s,o;const i=Gs(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(g(e),e)for(const r of e){const e=ps(t,r);e?gs(n.errors,r,e):eo(n.errors,r)}else n.errors=t;return t})(ds(e)?e:i);s=Zs(t),o=e?!i.some(e=>ps(t,e)):s}else e?(o=(await Promise.all(i.map(async e=>{const t=ps(a,e);return await w(t&&t._f?{[e]:t}:t)}))).every(Boolean),(o||n.isValid)&&h()):o=s=await w(a);return p.state.next({...!Us(e)||(u.isValid||f.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!o&&yo(a,A,e?i:c.mount),o},T=(e,t)=>{let r={...i.mount?o:s};return t&&(r=Hs(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),ds(e)?r:Us(e)?ps(r,e):e.map(e=>ps(r,e))},R=(e,t)=>({invalid:!!ps((t||n).errors,e),isDirty:!!ps((t||n).dirtyFields,e),error:ps((t||n).errors,e),isValidating:!!ps(n.validatingFields,e),isTouched:!!ps((t||n).touchedFields,e)}),P=(e,t,r)=>{const s=(ps(a,e,{_f:{}})._f||{}).ref,o=ps(n.errors,e)||{},{ref:i,message:c,type:l,...d}=o;gs(n.errors,e,{...d,...t,ref:s}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},O=e=>p.state.subscribe({next:t=>{var r,a,i;r=e.name,a=t.name,i=e.exact,r&&a&&r!==a&&!Gs(r).some(e=>e&&(i?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...s}=e;return Zs(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||js))})(t,e.formState||u,V,e.reRenderRoot)||e.callback({values:{...o},...n,...t,defaultValues:s})}}).unsubscribe,I=(e,t={})=>{for(const i of e?Gs(e):c.mount)c.mount.delete(i),c.array.delete(i),t.keepValue||(eo(a,i),eo(o,i)),!t.keepError&&eo(n.errors,i),!t.keepDirty&&eo(n.dirtyFields,i),!t.keepTouched&&eo(n.touchedFields,i),!t.keepIsValidating&&eo(n.validatingFields,i),!r.shouldUnregister&&!t.keepDefaultValue&&eo(s,i);p.state.next({values:cs(o)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},D=({disabled:e,name:t})=>{if(ms(e)&&i.mount||e||c.disabled.has(t)){const r=c.disabled.has(t)!==!!e;e?c.disabled.add(t):c.disabled.delete(t),r&&i.mount&&!i.action&&h()}},U=(e,t={})=>{let n=ps(a,e);const o=ms(t.disabled)||ms(r.disabled);return gs(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?D({disabled:ms(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...o?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:po(t.min),max:po(t.max),minLength:po(t.minLength),maxLength:po(t.maxLength),pattern:po(t.pattern)}:{},name:e,onChange:N,onBlur:N,ref:o=>{if(o){U(e,t),n=ps(a,e);const r=ds(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,i=(e=>Xs(e)||es(e))(r),c=n._f.refs||[];if(i?c.find(e=>e===r):r===n._f.ref)return;gs(a,e,{_f:{...n._f,...i?{refs:[...c.filter(Qs),r,...Array.isArray(ps(s,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=ps(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!os(c.array,e)||!i.action)&&c.unMount.add(e)}}},F=()=>r.shouldFocusError&&yo(a,A,c.mount),M=(e,t)=>async s=>{let i;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let l=cs(o);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await x();g(),n.errors=e,l=cs(t)}else await w(a);if(c.disabled.size)for(const e of c.disabled)eo(l,e);if(eo(n.errors,"root"),Zs(n.errors)){p.state.next({errors:{}});try{await e(l,s)}catch(e){i=e}}else t&&await t({...n.errors},s),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Zs(n.errors)&&!i,submitCount:n.submitCount+1,errors:n.errors}),i)throw i},z=(e,t={})=>{const l=e?cs(e):s,d=cs(l),f=Zs(e),m=f?s:d;if(t.keepDefaultValues||(s=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(no(s,o))]);for(const t of Array.from(e)){const e=ps(n.dirtyFields,t),r=ps(o,t),a=ps(m,t);e&&!ds(r)?gs(m,t,r):e||ds(a)||C(t,a)}}else{if(is&&ds(e))for(const e of c.mount){const t=ps(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(qs(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)C(e,ps(m,e));else a={}}o=r.shouldUnregister?t.keepDefaultValues?cs(s):{}:cs(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}c={mount:t.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Zs(m),i.watch=!!r.shouldUnregister,i.keepIsValid=!!t.keepIsValid,i.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||zs(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&o?no(s,o):n.dirtyFields:t.keepDefaultValues&&e?no(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},L=(e,t)=>z(hs(e)?e(o):e,{...r.resetOptions,...t}),V=e=>{n={...n,...e}},$={control:{register:U,unregister:I,getFieldState:R,handleSubmit:M,setError:P,_subscribe:O,_runSchema:x,_updateIsValidating:g,_focusError:F,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(i.action=!0,m&&Array.isArray(ps(a,e))){const t=c(ps(a,e),l.argA,l.argB);d&&gs(a,e,t)}if(m&&Array.isArray(ps(n.errors,e))){const t=c(ps(n.errors,e),l.argA,l.argB);d&&gs(n.errors,e,t),((e,t)=>{!us(ps(e,t)).length&&eo(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(ps(n.touchedFields,e))){const t=c(ps(n.touchedFields,e),l.argA,l.argB);d&&gs(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=no(s,o)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gs(o,e,t)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>us(ps(i.mount?o:s,e,r.shouldUnregister?ps(s,e,[]):[])),_reset:z,_resetDefaultValues:()=>hs(r.defaultValues)&&r.defaultValues().then(e=>{L(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=ps(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Qs(e)):!Qs(t._f.ref))&&I(e)}c.unMount=new Set},_disableForm:e=>{ms(e)&&(p.state.next({disabled:e}),yo(a,(t,r)=>{const n=ps(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return a},get _formValues(){return o},get _state(){return i},set _state(e){i=e},get _defaultValues(){return s},get _names(){return c},set _names(e){c=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(i.mount=!0,f={...f,...e.formState},O({...e,formState:{...d,...e.formState}})),trigger:_,register:U,handleSubmit:M,watch:(e,t)=>hs(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:C,getValues:T,reset:L,resetField:(e,t={})=>{ps(a,e)&&(ds(t.defaultValue)?C(e,cs(ps(s,e))):(C(e,t.defaultValue),gs(s,e,cs(t.defaultValue))),t.keepTouched||eo(n.touchedFields,e),t.keepDirty||(eo(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,cs(ps(s,e))):S()),t.keepError||(eo(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&Gs(e).forEach(e=>eo(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:I,setError:P,setFocus:(e,t={})=>{const r=ps(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&hs(e.select)&&e.select()})}},getFieldState:R};return{...$,formControl:$}}function Co(e={}){const r=t.useRef(void 0),n=t.useRef(void 0),[a,s]=t.useState({isDirty:!1,isValidating:!1,isLoading:hs(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:hs(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:a},e.defaultValues&&!hs(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:t,...n}=Eo(e);r.current={...n,formState:a}}const o=r.current.control;return o._options=e,Ds(()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),t.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),t.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),t.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),t.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),t.useEffect(()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==a.isDirty&&o._subjects.state.next({isDirty:e})}},[o,a.isDirty]),t.useEffect(()=>{var t;e.values&&!zs(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),(null===(t=o._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||o._setValid(),n.current=e.values,s(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),t.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),r.current.formState=t.useMemo(()=>Is(a,o),[o,a]),r.current}const No=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ps(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Ao=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?No(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>No(t,r,e))}},_o=(e,t)=>{t.shouldUseNativeValidation&&Ao(e,t);const r={};for(const n in e){const a=ps(t.fields,n),s=Object.assign(e[n]||{},{ref:a&&a.ref});if(To(t.names||Object.keys(e),n)){const e=Object.assign({},ps(r,n));gs(e,"root",s),gs(r,n,e)}else gs(r,n,s)}return r},To=(e,t)=>{const r=Ro(t);return e.some(e=>Ro(e).match(`^${r}\\.\\d+`))};function Ro(e){return e.replace(/\]|\[/g,"")}function Po(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:o,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=o.prototype,s=Object.keys(a);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class s extends a{}function o(e){var t;const a=r?.Parent?new s:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Oo extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Io extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Do={};function Uo(e){return Do}function Fo(e){const t=Object.values(e).filter(e=>"number"==typeof e),r=Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t);return r}function Mo(e,t){return"bigint"==typeof t?t.toString():t}function zo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Lo(e){return null==e}function Vo(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const $o=Symbol("evaluating");function Wo(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==$o)return void 0===n&&(n=$o,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Bo(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Go(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Ko(e){return JSON.stringify(e)}const Ho="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Zo(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Jo=zo(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function qo(e){if(!1===Zo(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==Zo(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Yo(e){return qo(e)?{...e}:Array.isArray(e)?[...e]:e}const Xo=new Set(["string","number","symbol"]);function Qo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function ti(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function ri(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function ni(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function ai(e){return"string"==typeof e?e:e?.message}function si(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=ai(e.inst?._zod.def?.error?.(e))??ai(t?.error?.(e))??ai(r.customError?.(e))??ai(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function oi(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ii(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const ci=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Mo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},li=Po("$ZodError",ci),di=Po("$ZodError",ci,{Parent:Error});const ui=e=>(t,r,n,a)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Oo;if(o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>si(e,s,Uo())));throw Ho(t,a?.callee),t}return o.value},fi=ui(di),pi=e=>async(t,r,n,a)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(a?.Err??e)(o.issues.map(e=>si(e,s,Uo())));throw Ho(t,a?.callee),t}return o.value},mi=pi(di),hi=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new Oo;return s.issues.length?{success:!1,error:new(e??li)(s.issues.map(e=>si(e,a,Uo())))}:{success:!0,data:s.value}},gi=hi(di),bi=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>si(e,a,Uo())))}:{success:!0,data:s.value}},yi=bi(di),vi=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ui(e)(t,r,a)},xi=e=>(t,r,n)=>ui(e)(t,r,n),wi=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return pi(e)(t,r,a)},Si=e=>async(t,r,n)=>pi(e)(t,r,n),ki=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return hi(e)(t,r,a)},ji=e=>(t,r,n)=>hi(e)(t,r,n),Ei=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return bi(e)(t,r,a)},Ci=e=>async(t,r,n)=>bi(e)(t,r,n),Ni=/^[cC][^\s-]{8,}$/,Ai=/^[0-9a-z]+$/,_i=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ti=/^[0-9a-vA-V]{20}$/,Ri=/^[A-Za-z0-9]{27}$/,Pi=/^[a-zA-Z0-9_-]{21}$/,Oi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ii=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Di=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ui=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Fi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Li=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$i=/^[A-Za-z0-9_-]*$/,Wi=/^\+[1-9]\d{6,14}$/,Bi="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Gi=new RegExp(`^${Bi}$`);function Ki(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Hi=/^[^A-Z]*$/,Zi=/^[^a-z]*$/,Ji=Po("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),qi=Po("$ZodCheckMaxLength",(e,t)=>{var r;Ji.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Lo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const a=oi(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Yi=Po("$ZodCheckMinLength",(e,t)=>{var r;Ji.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Lo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const a=oi(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xi=Po("$ZodCheckLengthEquals",(e,t)=>{var r;Ji.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Lo(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,a=n.length;if(a===t.length)return;const s=oi(n),o=a>t.length;r.issues.push({origin:s,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Qi=Po("$ZodCheckStringFormat",(e,t)=>{var r,n;Ji.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ec=Po("$ZodCheckRegex",(e,t)=>{Qi.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tc=Po("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Hi),Qi.init(e,t)}),rc=Po("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Zi),Qi.init(e,t)}),nc=Po("$ZodCheckIncludes",(e,t)=>{Ji.init(e,t);const r=Qo(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ac=Po("$ZodCheckStartsWith",(e,t)=>{Ji.init(e,t);const r=new RegExp(`^${Qo(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),sc=Po("$ZodCheckEndsWith",(e,t)=>{Ji.init(e,t);const r=new RegExp(`.*${Qo(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),oc=Po("$ZodCheckOverwrite",(e,t)=>{Ji.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class ic{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const cc={major:4,minor:3,patch:6},lc=Po("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cc;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,a=ri(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,o=s._zod.check(e);if(o instanceof Promise&&!1===r?.async)throw new Oo;if(n||o instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(a||(a=ri(e,t)))});else{if(e.issues.length===t)continue;a||(a=ri(e,t))}}return n?n.then(()=>e):e},r=(r,a,s)=>{if(ri(r))return r.aborted=!0,r;const o=t(a,n,s);if(o instanceof Promise){if(!1===s.async)throw new Oo;return o.then(t=>e._zod.parse(t,s))}return e._zod.parse(o,s)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if("backward"===s.direction){const t=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,s)):r(t,a,s)}const o=e._zod.parse(a,s);if(o instanceof Promise){if(!1===s.async)throw new Oo;return o.then(e=>t(e,n,s))}return t(o,n,s)}}Wo(e,"~standard",()=>({validate:t=>{try{const r=gi(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return yi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),dc=Po("$ZodString",(e,t)=>{var r;lc.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),uc=Po("$ZodStringFormat",(e,t)=>{Qi.init(e,t),dc.init(e,t)}),fc=Po("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ii),uc.init(e,t)}),pc=Po("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Di(e))}else t.pattern??(t.pattern=Di());uc.init(e,t)}),mc=Po("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ui),uc.init(e,t)}),hc=Po("$ZodURL",(e,t)=>{uc.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=a.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),gc=Po("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),uc.init(e,t)}),bc=Po("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Pi),uc.init(e,t)}),yc=Po("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ni),uc.init(e,t)}),vc=Po("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ai),uc.init(e,t)}),xc=Po("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_i),uc.init(e,t)}),wc=Po("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ti),uc.init(e,t)}),Sc=Po("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ri),uc.init(e,t)}),kc=Po("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Ki({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Bi}T(?:${n})$`)}(t)),uc.init(e,t)}),jc=Po("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gi),uc.init(e,t)}),Ec=Po("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Ki(t)}$`)),uc.init(e,t)}),Cc=Po("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Oi),uc.init(e,t)}),Nc=Po("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fi),uc.init(e,t),e._zod.bag.format="ipv4"}),Ac=Po("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mi),uc.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),_c=Po("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=zi),uc.init(e,t)}),Tc=Po("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Li),uc.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Rc(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Pc=Po("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vi),uc.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Rc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const Oc=Po("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$i),uc.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!$i.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Rc(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ic=Po("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),uc.init(e,t)});const Dc=Po("$ZodJWT",(e,t)=>{uc.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Uc=Po("$ZodUnknown",(e,t)=>{lc.init(e,t),e._zod.parse=e=>e}),Fc=Po("$ZodNever",(e,t)=>{lc.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function Mc(e,t,r){e.issues.length&&t.issues.push(...ni(r,e.issues)),t.value[r]=e.value}const zc=Po("$ZodArray",(e,t)=>{lc.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const s=[];for(let e=0;e<a.length;e++){const o=a[e],i=t.element._zod.run({value:o,issues:[]},n);i instanceof Promise?s.push(i.then(t=>Mc(t,r,e))):Mc(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function Lc(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...ni(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Vc(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function $c(e,t,r,n,a,s){const o=[],i=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(i.has(a))continue;if("never"===l){o.push(a);continue}const s=c.run({value:t[a],issues:[]},n);s instanceof Promise?e.push(s.then(e=>Lc(e,r,a,t,d))):Lc(s,r,a,t,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const Wc=Po("$ZodObject",(e,t)=>{lc.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=zo(()=>Vc(t));Wo(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const a=Zo,s=t.catchall;let o;e._zod.parse=(t,r)=>{o??(o=n.value);const i=t.value;if(!a(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],l=o.shape;for(const e of o.keys){const n=l[e],a="optional"===n._zod.optout,s=n._zod.run({value:i[e],issues:[]},r);s instanceof Promise?c.push(s.then(r=>Lc(r,t,e,i,a))):Lc(s,t,e,i,a)}return s?$c(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Bc=Po("$ZodObjectJIT",(e,t)=>{Wc.init(e,t);const r=e._zod.parse,n=zo(()=>Vc(t));let a;const s=Zo,o=!Do.jitless,i=o&&Jo.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return s(f)?o&&i&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new ic(["shape","payload","ctx"]),r=n.value,a=e=>{const t=Ko(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let o=0;for(const e of r.keys)s[e]="key_"+o++;t.write("const newResult = {};");for(const n of r.keys){const r=s[n],o=Ko(n),i=e[n],c="optional"===i?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=a(d,u),c?$c([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Gc(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const a=e.filter(e=>!ri(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>si(e,n,Uo())))}),t)}const Kc=Po("$ZodUnion",(e,t)=>{lc.init(e,t),Wo(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Wo(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Wo(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Wo(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Vo(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(r)return n(a,s);let o=!1;const i=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);if(t instanceof Promise)i.push(t),o=!0;else{if(0===t.issues.length)return t;i.push(t)}}return o?Promise.all(i).then(t=>Gc(t,a,e,s)):Gc(i,a,e,s)}}),Hc=Po("$ZodIntersection",(e,t)=>{lc.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([t,r])=>Jc(e,t,r)):Jc(e,a,s)}});function Zc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(qo(e)&&qo(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),a={...e,...t};for(const r of n){const n=Zc(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};a[r]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=Zc(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Jc(e,t,r){const n=new Map;let a;for(const r of t.issues)if("unrecognized_keys"===r.code){a??(a=r);for(const e of r.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(r);for(const t of r.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(t);const s=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&a&&e.issues.push({...a,keys:s}),ri(e))return e;const o=Zc(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const qc=Po("$ZodEnum",(e,t)=>{lc.init(e,t);const r=Fo(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Xo.has(typeof e)).map(e=>"string"==typeof e?Qo(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),Yc=Po("$ZodTransform",(e,t)=>{lc.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Io(e.constructor.name);const a=t.transform(r.value,r);if(n.async){return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(r.value=e,r))}if(a instanceof Promise)throw new Oo;return r.value=a,r}});function Xc(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Qc=Po("$ZodOptional",(e,t)=>{lc.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Wo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Wo(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Vo(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>Xc(t,e.value)):Xc(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),el=Po("$ZodExactOptional",(e,t)=>{Qc.init(e,t),Wo(e._zod,"values",()=>t.innerType._zod.values),Wo(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),tl=Po("$ZodNullable",(e,t)=>{lc.init(e,t),Wo(e._zod,"optin",()=>t.innerType._zod.optin),Wo(e._zod,"optout",()=>t.innerType._zod.optout),Wo(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Vo(e.source)}|null)$`):void 0}),Wo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),rl=Po("$ZodDefault",(e,t)=>{lc.init(e,t),e._zod.optin="optional",Wo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>nl(e,t)):nl(n,t)}});function nl(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const al=Po("$ZodPrefault",(e,t)=>{lc.init(e,t),e._zod.optin="optional",Wo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),sl=Po("$ZodNonOptional",(e,t)=>{lc.init(e,t),Wo(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(t=>ol(t,e)):ol(a,e)}});function ol(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const il=Po("$ZodCatch",(e,t)=>{lc.init(e,t),Wo(e._zod,"optin",()=>t.innerType._zod.optin),Wo(e._zod,"optout",()=>t.innerType._zod.optout),Wo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>si(e,r,Uo()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>si(e,r,Uo()))},input:e.value}),e.issues=[]),e)}}),cl=Po("$ZodPipe",(e,t)=>{lc.init(e,t),Wo(e._zod,"values",()=>t.in._zod.values),Wo(e._zod,"optin",()=>t.in._zod.optin),Wo(e._zod,"optout",()=>t.out._zod.optout),Wo(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>ll(e,t.in,r)):ll(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>ll(e,t.out,r)):ll(n,t.out,r)}});function ll(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const dl=Po("$ZodReadonly",(e,t)=>{lc.init(e,t),Wo(e._zod,"propValues",()=>t.innerType._zod.propValues),Wo(e._zod,"values",()=>t.innerType._zod.values),Wo(e._zod,"optin",()=>t.innerType?._zod?.optin),Wo(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(ul):ul(n)}});function ul(e){return e.value=Object.freeze(e.value),e}const fl=Po("$ZodCustom",(e,t)=>{Ji.init(e,t),lc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(t=>pl(t,r,n,e));pl(a,r,n,e)}});function pl(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(ii(e))}}var ml;class hl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(ml=globalThis).__zod_globalRegistry??(ml.__zod_globalRegistry=new hl);const gl=globalThis.__zod_globalRegistry;function bl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ti(t)})}function yl(e,t){return new qi({check:"max_length",...ti(t),maximum:e})}function vl(e,t){return new Yi({check:"min_length",...ti(t),minimum:e})}function xl(e,t){return new Xi({check:"length_equals",...ti(t),length:e})}function wl(e){return new oc({check:"overwrite",tx:e})}function Sl(e){const t=function(e,t){const r=new Ji({check:"custom",...ti(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(ii(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(ii(n))}},e(r.value,r)));return t}function kl(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??gl,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function jl(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s){s.count++;return r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema}const o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o);const i=e._zod.toJSONSchema?.();if(i)o.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,n);else{const r=o.schema,s=t.processors[a.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);s(e,t,r,n)}const s=e._zod.parent;s&&(o.ref||(o.ref=s),jl(s,t,n),t.seen.get(s).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(o.schema,c),"input"===t.io&&Nl(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function El(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const t of e.seen.entries()){const r=e.metadataRegistry.get(t[0])?.id;if(r){const e=n.get(r);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${r}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(r,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:a,defId:s}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${a("__shared")}#/${n}/${s}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:a+s}})(t);n.def={...n.schema},s&&(n.defId=s);const o=n.schema;for(const e in o)delete o[e];o.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const n=r[1];if(t===r[0]){a(r);continue}if(e.external){const n=e.external.registry.get(r[0])?.id;if(t!==r[0]&&n){a(r);continue}}const s=e.metadataRegistry.get(r[0])?.id;s?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function Cl(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const a=r.def??r.schema,s={...a},o=r.ref;if(r.ref=null,o){n(o);const r=e.seen.get(o),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,i):(a.allOf=a.allOf??[],a.allOf.push(i)),Object.assign(a,s);if(t._zod.parent===o)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in s||delete a[e]);if(i.$ref&&r.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(a[e])===JSON.stringify(r.def[e])&&delete a[e]}const i=t._zod.parent;if(i&&i!==o){n(i);const t=e.seen.get(i);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:r.path??[]})};for(const t of[...e.seen.entries()].reverse())n(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(r)}Object.assign(a,r.def??r.schema);const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Al(t,"input",e.processors),output:Al(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function Nl(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return Nl(n.element,r);if("set"===n.type)return Nl(n.valueType,r);if("lazy"===n.type)return Nl(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return Nl(n.innerType,r);if("intersection"===n.type)return Nl(n.left,r)||Nl(n.right,r);if("record"===n.type||"map"===n.type)return Nl(n.keyType,r)||Nl(n.valueType,r);if("pipe"===n.type)return Nl(n.in,r)||Nl(n.out,r);if("object"===n.type){for(const e in n.shape)if(Nl(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(Nl(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(Nl(e,r))return!0;return!(!n.rest||!Nl(n.rest,r))}return!1}const Al=(e,t,r={})=>n=>{const{libraryOptions:a,target:s}=n??{},o=kl({...a??{},target:s,io:t,processors:r});return jl(e,o),El(o,e),Cl(o,e)},_l={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tl=(e,t,r,n)=>{const a=e._zod.def;jl(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function Rl(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function Pl(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=r[o].types,l=c&&c[n.code];r[o]=Bs(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Ol(e,t){for(var r={};e.length;){var n=e[0],a=n.code,s=n.message,o=n.path.join(".");if(!r[o])if("invalid_union"===n.code&&n.errors.length>0){var i=n.errors[0][0];r[o]={message:i.message,type:i.code}}else r[o]={message:s,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=r[o].types,l=c&&c[n.code];r[o]=Bs(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function Il(e,t,r){if(void 0===r&&(r={}),function(e){return"_def"in e&&"object"==typeof e._def&&"typeName"in e._def}(e))return function(n,a,s){try{return Promise.resolve(Rl(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return s.shouldUseNativeValidation&&Ao({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(null==e?void 0:e.issues)}(e))return{values:{},errors:_o(Pl(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,s){try{return Promise.resolve(Rl(function(){return Promise.resolve(("sync"===r.mode?fi:mi)(e,n,t)).then(function(e){return s.shouldUseNativeValidation&&Ao({},s),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof li}(e))return{values:{},errors:_o(Ol(e.issues,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function Dl(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ul(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Dl(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():Dl(e[t],null)}}}}function Fl(...e){return a.useCallback(Ul(...e),e)}var Ml=Symbol.for("react.lazy"),zl=a[" use ".trim().toString()];function Ll(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===Ml&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function Vl(t){const r=Wl(t),n=a.forwardRef((t,n)=>{let{children:s,...o}=t;Ll(s)&&"function"==typeof zl&&(s=zl(s._payload));const i=a.Children.toArray(s),c=i.find(Gl);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}var $l=Vl("Slot");function Wl(e){const t=a.forwardRef((e,t)=>{let{children:r,...n}=e;if(Ll(r)&&"function"==typeof zl&&(r=zl(r._payload)),a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bl=Symbol("radix.slottable");function Gl(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Bl}const Kl=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Hl=c,Zl=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Hl(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:s}=t,o=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==s?void 0:s[e];if(null===t)return null;const o=Kl(t)||Kl(n);return a[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),c=null==t||null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...s,...i}[t]):{...s,...i}[t]===r})?[...e,r,n]:e},[]);return Hl(e,o,c,null==r?void 0:r.class,null==r?void 0:r.className)},Jl=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ql=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yl=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),Xl=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
2
2
  /**
3
3
  * @license lucide-react v0.544.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
- var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
8
+ var Ql={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
9
9
  /**
10
10
  * @license lucide-react v0.544.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
- */const ii=t.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:i,...c},l)=>t.createElement("svg",{ref:l,...oi,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:ai("lucide",s),...!o&&!si(c)&&{"aria-hidden":"true"},...c},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(o)?o:[o]])),ci=(e,r)=>{const n=t.forwardRef(({className:n,...a},s)=>t.createElement(ii,{ref:s,iconNode:r,className:ai(`lucide-${ri(ni(e))}`,`lucide-${e}`,n),...a}));return n.displayName=ni(e),n},li=ci("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),di=ci("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),ui=ci("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),fi=ci("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),pi=ci("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),mi=ci("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]),hi=ci("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),gi=ci("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),bi=ci("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),yi=ci("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),vi=ci("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),xi=ci("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),wi=ci("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),Si=ci("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),ki=ci("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ji=ci("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),Ei=ci("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),Ai=ci("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Ni=ci("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Ci=ci("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),_i=ci("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Ti=ci("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Ri=ti("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),Pi=a.forwardRef(({className:t,variant:r,progress:n,size:s,startIcon:o,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?qo:"button",f=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(s);return e.jsxs(u,{disabled:n||l.disabled,className:ke(Ri({variant:r,size:s,withIcon:null!=n||null!=o||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(vi,{size:f,className:"animate-spin"}),o&&a.cloneElement(o,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});
14
+ */const ed=t.forwardRef(({color:e="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:i,...c},l)=>t.createElement("svg",{ref:l,...Ql,width:r,height:r,stroke:e,strokeWidth:a?24*Number(n)/Number(r):n,className:Yl("lucide",s),...!o&&!Xl(c)&&{"aria-hidden":"true"},...c},[...i.map(([e,r])=>t.createElement(e,r)),...Array.isArray(o)?o:[o]])),td=(e,r)=>{const n=t.forwardRef(({className:n,...a},s)=>t.createElement(ed,{ref:s,iconNode:r,className:Yl(`lucide-${Jl(ql(e))}`,`lucide-${e}`,n),...a}));return n.displayName=ql(e),n},rd=td("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]),nd=td("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),ad=td("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),sd=td("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),od=td("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),id=td("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),cd=td("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),ld=td("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),dd=td("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),ud=td("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),fd=td("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),pd=td("refresh-ccw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),md=td("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),hd=td("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),gd=td("smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),bd=td("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),yd=td("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),vd=td("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),xd=td("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),wd=td("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),Sd=td("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),kd=Zl("inline-flex items-center justify-center rounded-full font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"underline-offset-4 hover:underline text-primary"},withIcon:{true:"flex"},fullWidth:{true:"w-full"},size:{default:"h-9 py-2 px-4 text-sm",sm:"h-8 px-3 text-xs",lg:"h-10 px-6 text-base",icon:"h-9 w-9"}},compoundVariants:[{size:"lg",withIcon:!0,className:"gap-x-1.5"},{size:"default",withIcon:!0,className:"gap-x-1"},{size:"sm",withIcon:!0,className:"gap-x-0.5"}],defaultVariants:{variant:"default",size:"default"}}),jd=a.forwardRef(({className:t,variant:r,progress:n,size:s,startIcon:o,endIcon:i,asChild:c=!1,...l},d)=>{const u=c?$l:"button",f=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(s);return e.jsxs(u,{disabled:n||l.disabled,className:je(kd({variant:r,size:s,withIcon:null!=n||null!=o||null!=i,className:t})),ref:d,...l,children:[n&&e.jsx(ud,{size:f,className:"animate-spin"}),o&&a.cloneElement(o,{size:f}),l.children,i&&a.cloneElement(i,{size:f})]})});
15
15
  /**
16
16
  * @license lucide-react v0.544.0 - ISC
17
17
  *
18
18
  * This source code is licensed under the ISC license.
19
19
  * See the LICENSE file in the root directory of this source tree.
20
- */Pi.displayName="Button";var Oi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zo(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Ii=a.forwardRef((t,r)=>e.jsx(Oi.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Ii.displayName="Label";var Di=Ii;const Ui=ti("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Mi=a.forwardRef(({className:t,...r},n)=>e.jsx(Di,{ref:n,className:ke(Ui(),t),...r}));Mi.displayName=Di.displayName;const Fi=$r,zi=a.createContext({}),Li=({...t})=>e.jsx(zi.Provider,{value:{name:t.name},children:e.jsx(qr,{...t})}),$i=()=>{const e=a.useContext(zi),t=a.useContext(Vi),{getFieldState:r,formState:n}=Lr(),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},Vi=a.createContext({}),Wi=a.forwardRef(({className:t,...r},n)=>{const s=a.useId();return e.jsx(Vi.Provider,{value:{id:s},children:e.jsx("div",{ref:n,className:ke("space-y-2",t),...r})})});Wi.displayName="FormItem";const Bi=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:s}=$i();return e.jsx(Mi,{ref:n,className:ke(a&&"text-destructive",t),htmlFor:s,...r})});Bi.displayName="FormLabel";const Gi=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:s,formMessageId:o}=$i();return e.jsx(qo,{ref:r,id:a,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...t})});Gi.displayName="FormControl";const Hi=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=$i();return e.jsx("p",{ref:n,id:a,className:ke("text-sm text-muted-foreground",t),...r})});Hi.displayName="FormDescription";const Ki=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:s,formMessageId:o}=$i(),i=s?String(s?.message):r;return i?e.jsx("p",{ref:a,id:o,className:ke("text-sm font-medium text-destructive",t),...n,children:i}):null});Ki.displayName="FormMessage";const Zi=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:ke("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n}));function qi({className:t,...r}){return e.jsx("div",{className:ke("animate-pulse rounded-md bg-primary/10",t),...r})}Zi.displayName="Input";let Ji=class{constructor(e){this.version=e.version,this.orgId=e.orgId,this.serverUrl=e.serverUrl}async fetchConfig(){const e=await Ce(`${this.serverUrl}/api/${this.version}/beta/config?orgId=${this.orgId}`);if(!e.ok)throw new Error(await _e(e,"Failed to fetch beta form configuration"));return e.json()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),s=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0),o=await Ce(`${this.serverUrl}/api/${this.version}/beta/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:s}})});if(!o.ok)throw new Error(await _e(o,"Failed to submit beta user request"));return o.json()}};const Yi=Fn("ZodISODateTime",(e,t)=>{_s.init(e,t),Sc.init(e,t)});function Xi(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ia(t)})}(Yi,e)}const Qi=Fn("ZodISODate",(e,t)=>{Ts.init(e,t),Sc.init(e,t)});function ec(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...ia(t)})}(Qi,e)}const tc=Fn("ZodISOTime",(e,t)=>{Rs.init(e,t),Sc.init(e,t)});function rc(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ia(t)})}(tc,e)}const nc=Fn("ZodISODuration",(e,t)=>{Ps.init(e,t),Sc.init(e,t)});function ac(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...ia(t)})}(nc,e)}const sc=Fn("ZodError",(e,t)=>{ha.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e}));else if("invalid_key"===a.code)n({issues:a.issues});else if("invalid_element"===a.code)n({issues:a.issues});else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Bn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Bn,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),oc=ba(sc),ic=va(sc),cc=wa(sc),lc=ka(sc),dc=Ea(sc),uc=Aa(sc),fc=Na(sc),pc=Ca(sc),mc=_a(sc),hc=Ta(sc),gc=Ra(sc),bc=Pa(sc),yc=Fn("ZodType",(e,t)=>(hs.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Do(e,"input"),output:Do(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=To({...r,processors:t});return Ro(e,n),Po(n,e),Oo(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Yn(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>oa(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>oc(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>cc(e,t,r),e.parseAsync=async(t,r)=>ic(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>lc(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>dc(e,t,r),e.decode=(t,r)=>uc(e,t,r),e.encodeAsync=async(t,r)=>fc(e,t,r),e.decodeAsync=async(t,r)=>pc(e,t,r),e.safeEncode=(t,r)=>mc(e,t,r),e.safeDecode=(t,r)=>hc(e,t,r),e.safeEncodeAsync=async(t,r)=>gc(e,t,r),e.safeDecodeAsync=async(t,r)=>bc(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ia(r)})}(ul,e,t)}(t,r)),e.superRefine=t=>e.check(_o(t)),e.overwrite=t=>e.check(Co(t)),e.optional=()=>el(e),e.exactOptional=()=>new tl({type:"optional",innerType:e}),e.nullable=()=>nl(e),e.nullish=()=>el(nl(e)),e.nonoptional=t=>function(e,t){return new ol({type:"nonoptional",innerType:e,...ia(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...ia(r)})}(Hc,e,t);var t},e.or=t=>function(e,t){return new qc({type:"union",options:e,...ia(t)})}([e,t]),e.and=t=>new Jc({type:"intersection",left:e,right:t}),e.transform=t=>ll(e,new Xc({type:"transform",transform:t})),e.default=t=>{return r=t,new al({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():na(r)}});var r},e.prefault=t=>{return r=t,new sl({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():na(r)}});var r},e.catch=t=>{return new il({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>ll(e,t),e.readonly=()=>new dl({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return ko.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>ko.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return ko.get(e);const r=e.clone();return ko.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),vc=Fn("_ZodString",(e,t)=>{gs.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:s,format:o,patterns:i,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof s&&(n.maxLength=s),o&&(n.format=Uo[o]??o,""===n.format&&delete n.format,"time"===o&&delete n.format),c&&(n.contentEncoding=c),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new os({check:"string_format",format:"regex",...ia(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ls({check:"string_format",format:"includes",...ia(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new ds({check:"string_format",format:"starts_with",...ia(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new us({check:"string_format",format:"ends_with",...ia(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Ao(...t)),e.max=(...t)=>e.check(Eo(...t)),e.length=(...t)=>e.check(No(...t)),e.nonempty=(...t)=>e.check(Ao(1,...t)),e.lowercase=t=>e.check(function(e){return new is({check:"string_format",format:"lowercase",...ia(e)})}(t)),e.uppercase=t=>e.check(function(e){return new cs({check:"string_format",format:"uppercase",...ia(e)})}(t)),e.trim=()=>e.check(Co(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Co(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Co(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Co(e=>e.toUpperCase())),e.slugify=()=>e.check(Co(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),xc=Fn("ZodString",(e,t)=>{gs.init(e,t),vc.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ia(t)})}(kc,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ia(t)})}(Ac,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ia(t)})}($c,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ia(t)})}(Nc,t)),e.guid=t=>e.check(jo(jc,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ia(t)})}(Ec,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ia(t)})}(Ec,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ia(t)})}(Ec,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ia(t)})}(Ec,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ia(t)})}(Cc,t)),e.guid=t=>e.check(jo(jc,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ia(t)})}(_c,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ia(t)})}(Tc,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ia(t)})}(Rc,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ia(t)})}(Fc,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ia(t)})}(zc,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ia(t)})}(Pc,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ia(t)})}(Oc,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ia(t)})}(Ic,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ia(t)})}(Dc,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ia(t)})}(Uc,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ia(t)})}(Mc,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ia(t)})}(Lc,t)),e.datetime=t=>e.check(Xi(t)),e.date=t=>e.check(ec(t)),e.time=t=>e.check(rc(t)),e.duration=t=>e.check(ac(t))});function wc(e){return function(e,t){return new e({type:"string",...ia(t)})}(xc,e)}const Sc=Fn("ZodStringFormat",(e,t)=>{bs.init(e,t),vc.init(e,t)}),kc=Fn("ZodEmail",(e,t)=>{xs.init(e,t),Sc.init(e,t)}),jc=Fn("ZodGUID",(e,t)=>{ys.init(e,t),Sc.init(e,t)}),Ec=Fn("ZodUUID",(e,t)=>{vs.init(e,t),Sc.init(e,t)}),Ac=Fn("ZodURL",(e,t)=>{ws.init(e,t),Sc.init(e,t)}),Nc=Fn("ZodEmoji",(e,t)=>{Ss.init(e,t),Sc.init(e,t)}),Cc=Fn("ZodNanoID",(e,t)=>{ks.init(e,t),Sc.init(e,t)}),_c=Fn("ZodCUID",(e,t)=>{js.init(e,t),Sc.init(e,t)}),Tc=Fn("ZodCUID2",(e,t)=>{Es.init(e,t),Sc.init(e,t)}),Rc=Fn("ZodULID",(e,t)=>{As.init(e,t),Sc.init(e,t)}),Pc=Fn("ZodXID",(e,t)=>{Ns.init(e,t),Sc.init(e,t)}),Oc=Fn("ZodKSUID",(e,t)=>{Cs.init(e,t),Sc.init(e,t)}),Ic=Fn("ZodIPv4",(e,t)=>{Os.init(e,t),Sc.init(e,t)}),Dc=Fn("ZodIPv6",(e,t)=>{Is.init(e,t),Sc.init(e,t)}),Uc=Fn("ZodCIDRv4",(e,t)=>{Ds.init(e,t),Sc.init(e,t)}),Mc=Fn("ZodCIDRv6",(e,t)=>{Us.init(e,t),Sc.init(e,t)}),Fc=Fn("ZodBase64",(e,t)=>{Fs.init(e,t),Sc.init(e,t)}),zc=Fn("ZodBase64URL",(e,t)=>{zs.init(e,t),Sc.init(e,t)}),Lc=Fn("ZodE164",(e,t)=>{Ls.init(e,t),Sc.init(e,t)}),$c=Fn("ZodJWT",(e,t)=>{$s.init(e,t),Sc.init(e,t)}),Vc=Fn("ZodUnknown",(e,t)=>{Vs.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Wc(){return new Vc({type:"unknown"})}const Bc=Fn("ZodNever",(e,t)=>{Ws.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Gc(e){return function(e,t){return new e({type:"never",...ia(t)})}(Bc,e)}const Hc=Fn("ZodArray",(e,t)=>{Gs.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(a.minItems=o),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=Ro(s.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Ao(t,r)),e.nonempty=t=>e.check(Ao(1,t)),e.max=(t,r)=>e.check(Eo(t,r)),e.length=(t,r)=>e.check(No(t,r)),e.unwrap=()=>e.element});const Kc=Fn("ZodObject",(e,t)=>{Js.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object",a.properties={};const o=s.shape;for(const e in o)a.properties[e]=Ro(o[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(o)),c=new Set([...i].filter(e=>{const r=s.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===s.catchall?._zod.def.type?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=Ro(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),qn(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Yc({type:"enum",entries:r,...ia(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Wc()}),e.loose=()=>e.clone({...e._zod.def,catchall:Wc()}),e.strict=()=>e.clone({...e._zod.def,catchall:Gc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ra(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Jn(this,"shape",r),r}});return oa(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!ra(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Jn(this,"shape",r),r}});return oa(e,r)}(e,t),e.merge=t=>function(e,t){const r=Yn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Jn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return oa(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return oa(e,Yn(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return Jn(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Yn(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return Jn(this,"shape",n),n},checks:[]});return oa(e,a)}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Yn(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Jn(this,"shape",a),a},checks:[]});return oa(t,a)}(Qc,e,t[0]),e.required=(...t)=>function(e,t,r){const n=Yn(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return Jn(this,"shape",a),a}});return oa(t,n)}(ol,e,t[0])});function Zc(e,t){const r={type:"object",shape:e??{},...ia(t)};return new Kc(r)}const qc=Fn("ZodUnion",(e,t)=>{Xs.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=!1===a.inclusive,o=a.options.map((e,r)=>Ro(e,t,{...n,path:[...n.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=o:r.anyOf=o})(e,t,r,n),e.options=t.options});const Jc=Fn("ZodIntersection",(e,t)=>{Qs.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Ro(a.left,t,{...n,path:[...n.path,"allOf",0]}),o=Ro(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,c=[...i(s)?s.allOf:[s],...i(o)?o.allOf:[o]];r.allOf=c})(e,t,r,n)});const Yc=Fn("ZodEnum",(e,t)=>{ro.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=Wn(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new Yc({...t,checks:[],...ia(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Yc({...t,checks:[],...ia(n),entries:a})}});const Xc=Fn("ZodTransform",(e,t)=>{no.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Ln(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(pa(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(pa(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Qc=Fn("ZodOptional",(e,t)=>{so.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Mo(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function el(e){return new Qc({type:"optional",innerType:e})}const tl=Fn("ZodExactOptional",(e,t)=>{oo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Mo(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const rl=Fn("ZodNullable",(e,t)=>{io.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=Ro(a.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=a.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function nl(e){return new rl({type:"nullable",innerType:e})}const al=Fn("ZodDefault",(e,t)=>{co.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ro(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const sl=Fn("ZodPrefault",(e,t)=>{uo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ro(a.innerType,t,n),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const ol=Fn("ZodNonOptional",(e,t)=>{fo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ro(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const il=Fn("ZodCatch",(e,t)=>{mo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let s;Ro(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const cl=Fn("ZodPipe",(e,t)=>{ho.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Ro(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function ll(e,t){return new cl({type:"pipe",in:e,out:t})}const dl=Fn("ZodReadonly",(e,t)=>{bo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ro(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const ul=Fn("ZodCustom",(e,t)=>{vo.init(e,t),yc.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});const fl=Zc({name:wc().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:wc().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),pl={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}};function ml({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function hl({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}const gl=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),a=Boolean(r.serverUrl&&r.version&&r.orgId),[s,o]=t.useState(null),[i,c]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e&&a){c(!0),d(null);try{const t=await n.getPublicPlans(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";d(r),Ie(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{c(!1)}}else o(null)},[n,e,a]);t.useEffect(()=>{u()},[u]);const f=e&&!a||i;return{items:s?.items??[],plans:s?.plans??[],loading:f,error:l,refetch:u}},bl=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(null),[o,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=await n.getCurrentSubscription(e);s(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";l(r),Ie(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{i(!1)}}else s(null)},[n,e]);return t.useEffect(()=>{d()},[d]),{subscription:a,loading:o,error:c,refetch:d}},yl=(e,r)=>{const n=Bt(e=>e.os),a=t.useMemo(()=>new er(n),[n.serverUrl,n.version,n.orgId]),[s,o]=t.useState(null),[i,c]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e){c(!0),d(null);try{const t=r?await a.getPlanGroupByVersion(e,r):await a.getPlanGroup(e);o(t)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch plan group";d(n),Ie(t,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:r}})}finally{c(!1)}}else o(null)},[a,e,r]);return t.useEffect(()=>{u()},[u]),{planGroup:s,loading:i,error:l,refetch:u}},vl=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(null),[o,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=await n.getPlanGroupVersions(e);s(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";l(r),Ie(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{i(!1)}}else s(null)},[n,e]);return t.useEffect(()=>{d()},[d]),{versions:a,loading:o,error:c,refetch:d}},xl=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(!1),[o,i]=t.useState(null);return{createCheckoutSession:t.useCallback(async t=>{if(!e)throw new Error("Workspace ID is required");s(!0),i(null);try{return await n.createCheckoutSession(e,t)}catch(r){const n=r instanceof Error?r.message:"Failed to create checkout session";throw i(n),Ie(r,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:t}}),r}finally{s(!1)}},[n,e]),loading:a,error:o}},wl=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(!1),[o,i]=t.useState(null),c=t.useCallback(async(t,r)=>{if(!e)throw new Error("Workspace ID is required");s(!0),i(null);try{const a={planVersionId:t,...r?.billingInterval&&{billingInterval:r.billingInterval},...r?.successUrl&&{successUrl:r.successUrl},...r?.cancelUrl&&{cancelUrl:r.cancelUrl}};return await n.updateSubscription(e,a)}catch(n){const a=n instanceof Error?n.message:"Failed to update subscription";throw i(a),Ie(n,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:t,options:r}}),n}finally{s(!1)}},[n,e]);return{updateSubscription:c,loading:a,error:o}},Sl=(e,r)=>{const n=bl(e),a=yl(e,r),s=wl(e),o=t.useCallback(async()=>{await Promise.all([n.refetch(),a.refetch()])},[n,a]);return{subscription:n.subscription,planGroup:a.planGroup,loading:n.loading||a.loading||s.loading,error:n.error||a.error||s.error,updateSubscription:s.updateSubscription,refetch:o}},kl=(e,r=10,n)=>{const a=Bt(e=>e.os),s=t.useMemo(()=>new er(a),[a.serverUrl,a.version,a.orgId]),[o,i]=t.useState([]),[c,l]=t.useState(!1),[d,u]=t.useState(!1),[f,p]=t.useState(null),m=t.useCallback(async()=>{if(!e)return i([]),void l(!1);u(!0),p(null);try{const t=await s.listInvoices(e,r,n);i(t.invoices||[]),l(t.has_more||!1)}catch(t){const a=t instanceof Error?t.message:"Failed to fetch invoices";p(a),Ie(t,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:r,startingAfter:n}})}finally{u(!1)}},[s,e,r,n]);return t.useEffect(()=>{m()},[m]),{invoices:o,hasMore:c,loading:d,error:f,refetch:m}};function jl(e,t){return function(){return e.apply(t,arguments)}}const{toString:El}=Object.prototype,{getPrototypeOf:Al}=Object,{iterator:Nl,toStringTag:Cl}=Symbol,_l=(Tl=Object.create(null),e=>{const t=El.call(e);return Tl[t]||(Tl[t]=t.slice(8,-1).toLowerCase())});var Tl;const Rl=e=>(e=e.toLowerCase(),t=>_l(t)===e),Pl=e=>t=>typeof t===e,{isArray:Ol}=Array,Il=Pl("undefined");function Dl(e){return null!==e&&!Il(e)&&null!==e.constructor&&!Il(e.constructor)&&Fl(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ul=Rl("ArrayBuffer");const Ml=Pl("string"),Fl=Pl("function"),zl=Pl("number"),Ll=e=>null!==e&&"object"==typeof e,$l=e=>{if("object"!==_l(e))return!1;const t=Al(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Cl in e||Nl in e)},Vl=Rl("Date"),Wl=Rl("File"),Bl=Rl("Blob"),Gl=Rl("FileList"),Hl=Rl("URLSearchParams"),[Kl,Zl,ql,Jl]=["ReadableStream","Request","Response","Headers"].map(Rl);function Yl(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),Ol(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(Dl(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),s=a.length;let o;for(n=0;n<s;n++)o=a[n],t.call(null,e[o],o,e)}}function Xl(e,t){if(Dl(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const Ql="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ed=e=>!Il(e)&&e!==Ql;const td=(rd="undefined"!=typeof Uint8Array&&Al(Uint8Array),e=>rd&&e instanceof rd);var rd;const nd=Rl("HTMLFormElement"),ad=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),sd=Rl("RegExp"),od=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Yl(r,(r,a)=>{let s;!1!==(s=t(r,a,e))&&(n[a]=s||r)}),Object.defineProperties(e,n)};const id=Rl("AsyncFunction"),cd=(ld="function"==typeof setImmediate,dd=Fl(Ql.postMessage),ld?setImmediate:dd?(ud=`axios@${Math.random()}`,fd=[],Ql.addEventListener("message",({source:e,data:t})=>{e===Ql&&t===ud&&fd.length&&fd.shift()()},!1),e=>{fd.push(e),Ql.postMessage(ud,"*")}):e=>setTimeout(e));var ld,dd,ud,fd;const pd="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ql):"undefined"!=typeof process&&process.nextTick||cd;var md={isArray:Ol,isArrayBuffer:Ul,isBuffer:Dl,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Fl(e.append)&&("formdata"===(t=_l(e))||"object"===t&&Fl(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ul(e.buffer),t},isString:Ml,isNumber:zl,isBoolean:e=>!0===e||!1===e,isObject:Ll,isPlainObject:$l,isEmptyObject:e=>{if(!Ll(e)||Dl(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Kl,isRequest:Zl,isResponse:ql,isHeaders:Jl,isUndefined:Il,isDate:Vl,isFile:Wl,isBlob:Bl,isRegExp:sd,isFunction:Fl,isStream:e=>Ll(e)&&Fl(e.pipe),isURLSearchParams:Hl,isTypedArray:td,isFileList:Gl,forEach:Yl,merge:function e(){const{caseless:t,skipUndefined:r}=ed(this)&&this||{},n={},a=(a,s)=>{const o=t&&Xl(n,s)||s;$l(n[o])&&$l(a)?n[o]=e(n[o],a):$l(a)?n[o]=e({},a):Ol(a)?n[o]=a.slice():r&&Il(a)||(n[o]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Yl(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Yl(t,(t,n)=>{r&&Fl(t)?Object.defineProperty(e,n,{value:jl(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,s,o;const i={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),s=a.length;s-- >0;)o=a[s],n&&!n(o,e,t)||i[o]||(t[o]=e[o],i[o]=!0);e=!1!==r&&Al(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:_l,kindOfTest:Rl,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Ol(e))return e;let t=e.length;if(!zl(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Nl]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:nd,hasOwnProperty:ad,hasOwnProp:ad,reduceDescriptors:od,freezeMethods:e=>{od(e,(t,r)=>{if(Fl(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Fl(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return Ol(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Xl,global:Ql,isContextDefined:ed,isSpecCompliantForm:function(e){return!!(e&&Fl(e.append)&&"FormData"===e[Cl]&&e[Nl])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Ll(e)){if(t.indexOf(e)>=0)return;if(Dl(e))return e;if(!("toJSON"in e)){t[n]=e;const a=Ol(e)?[]:{};return Yl(e,(e,t)=>{const s=r(e,n+1);!Il(s)&&(a[t]=s)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:id,isThenable:e=>e&&(Ll(e)||Fl(e))&&Fl(e.then)&&Fl(e.catch),setImmediate:cd,asap:pd,isIterable:e=>null!=e&&Fl(e[Nl])};let hd=class e extends Error{static from(t,r,n,a,s,o){const i=new e(t.message,r||t.code,n,a,s);return i.cause=t,i.name=t.name,o&&Object.assign(i,o),i}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:md.toJSONObject(this.config),code:this.code,status:this.status}}};hd.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",hd.ERR_BAD_OPTION="ERR_BAD_OPTION",hd.ECONNABORTED="ECONNABORTED",hd.ETIMEDOUT="ETIMEDOUT",hd.ERR_NETWORK="ERR_NETWORK",hd.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",hd.ERR_DEPRECATED="ERR_DEPRECATED",hd.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",hd.ERR_BAD_REQUEST="ERR_BAD_REQUEST",hd.ERR_CANCELED="ERR_CANCELED",hd.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",hd.ERR_INVALID_URL="ERR_INVALID_URL";function gd(e){return md.isPlainObject(e)||md.isArray(e)}function bd(e){return md.endsWith(e,"[]")?e.slice(0,-2):e}function yd(e,t,r){return e?e.concat(t).map(function(e,t){return e=bd(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const vd=md.toFlatObject(md,{},null,function(e){return/^is[A-Z]/.test(e)});function xd(e,t,r){if(!md.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=md.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!md.isUndefined(t[e])})).metaTokens,a=r.visitor||l,s=r.dots,o=r.indexes,i=(r.Blob||"undefined"!=typeof Blob&&Blob)&&md.isSpecCompliantForm(t);if(!md.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(md.isDate(e))return e.toISOString();if(md.isBoolean(e))return e.toString();if(!i&&md.isBlob(e))throw new hd("Blob is not supported. Use a Buffer instead.");return md.isArrayBuffer(e)||md.isTypedArray(e)?i&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let i=e;if(e&&!a&&"object"==typeof e)if(md.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(md.isArray(e)&&function(e){return md.isArray(e)&&!e.some(gd)}(e)||(md.isFileList(e)||md.endsWith(r,"[]"))&&(i=md.toArray(e)))return r=bd(r),i.forEach(function(e,n){!md.isUndefined(e)&&null!==e&&t.append(!0===o?yd([r],n,s):null===o?r:r+"[]",c(e))}),!1;return!!gd(e)||(t.append(yd(a,r,s),c(e)),!1)}const d=[],u=Object.assign(vd,{defaultVisitor:l,convertValue:c,isVisitable:gd});if(!md.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!md.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),md.forEach(r,function(r,s){!0===(!(md.isUndefined(r)||null===r)&&a.call(t,r,md.isString(s)?s.trim():s,n,u))&&e(r,n?n.concat(s):[s])}),d.pop()}}(e),t}function wd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Sd(e,t){this._pairs=[],e&&xd(e,this,t)}const kd=Sd.prototype;function jd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ed(e,t,r){if(!t)return e;const n=r&&r.encode||jd,a=md.isFunction(r)?{serialize:r}:r,s=a&&a.serialize;let o;if(o=s?s(t,a):md.isURLSearchParams(t)?t.toString():new Sd(t,a).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}kd.append=function(e,t){this._pairs.push([e,t])},kd.toString=function(e){const t=e?function(t){return e.call(this,t,wd)}:wd;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Ad{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){md.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Nd={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Cd={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Sd,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const _d="undefined"!=typeof window&&"undefined"!=typeof document,Td="object"==typeof navigator&&navigator||void 0,Rd=_d&&(!Td||["ReactNative","NativeScript","NS"].indexOf(Td.product)<0),Pd="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Od=_d&&window.location.href||"http://localhost";var Id={...Object.freeze({__proto__:null,hasBrowserEnv:_d,hasStandardBrowserEnv:Rd,hasStandardBrowserWebWorkerEnv:Pd,navigator:Td,origin:Od}),...Cd};function Dd(e){function t(e,r,n,a){let s=e[a++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),i=a>=e.length;if(s=!s&&md.isArray(n)?n.length:s,i)return md.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&md.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],a)&&md.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let s;for(n=0;n<a;n++)s=r[n],t[s]=e[s];return t}(n[s])),!o}if(md.isFormData(e)&&md.isFunction(e.entries)){const r={};return md.forEachEntry(e,(e,n)=>{t(function(e){return md.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const Ud={transitional:Nd,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=md.isObject(e);a&&md.isHTMLForm(e)&&(e=new FormData(e));if(md.isFormData(e))return n?JSON.stringify(Dd(e)):e;if(md.isArrayBuffer(e)||md.isBuffer(e)||md.isStream(e)||md.isFile(e)||md.isBlob(e)||md.isReadableStream(e))return e;if(md.isArrayBufferView(e))return e.buffer;if(md.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return xd(e,new Id.classes.URLSearchParams,{visitor:function(e,t,r,n){return Id.isNode&&md.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=md.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return xd(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(md.isString(e))try{return(t||JSON.parse)(e),md.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ud.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(md.isResponse(e)||md.isReadableStream(e))return e;if(e&&md.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw hd.from(e,hd.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Id.classes.FormData,Blob:Id.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};md.forEach(["delete","get","head","post","put","patch"],e=>{Ud.headers[e]={}});const Md=md.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Fd=Symbol("internals");function zd(e){return e&&String(e).trim().toLowerCase()}function Ld(e){return!1===e||null==e?e:md.isArray(e)?e.map(Ld):String(e)}function $d(e,t,r,n,a){return md.isFunction(n)?n.call(this,t,r):(a&&(t=r),md.isString(t)?md.isString(n)?-1!==t.indexOf(n):md.isRegExp(n)?n.test(t):void 0:void 0)}let Vd=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=zd(t);if(!a)throw new Error("header name must be a non-empty string");const s=md.findKey(n,a);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=Ld(e))}const s=(e,t)=>md.forEach(e,(e,r)=>a(e,r,t));if(md.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(md.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&Md[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(md.isObject(e)&&md.isIterable(e)){let r,n,a={};for(const t of e){if(!md.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?md.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}s(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=zd(e)){const r=md.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(md.isFunction(t))return t.call(this,e,r);if(md.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=zd(e)){const r=md.findKey(this,e);return!(!r||void 0===this[r]||t&&!$d(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=zd(e)){const a=md.findKey(r,e);!a||t&&!$d(0,r[a],a,t)||(delete r[a],n=!0)}}return md.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!$d(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return md.forEach(this,(n,a)=>{const s=md.findKey(r,a);if(s)return t[s]=Ld(n),void delete t[a];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();o!==a&&delete t[a],t[o]=Ld(n),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return md.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&md.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[Fd]=this[Fd]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=zd(e);t[n]||(!function(e,t){const r=md.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return md.isArray(e)?e.forEach(n):n(e),this}};function Wd(e,t){const r=this||Ud,n=t||r,a=Vd.from(n.headers);let s=n.data;return md.forEach(e,function(e){s=e.call(r,s,a.normalize(),t?t.status:void 0)}),a.normalize(),s}function Bd(e){return!(!e||!e.__CANCEL__)}Vd.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),md.reduceDescriptors(Vd.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),md.freezeMethods(Vd);let Gd=class extends hd{constructor(e,t,r){super(null==e?"canceled":e,hd.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Hd(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new hd("Request failed with status code "+r.status,[hd.ERR_BAD_REQUEST,hd.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Kd=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,s=0,o=0;return t=void 0!==t?t:1e3,function(i){const c=Date.now(),l=n[o];a||(a=c),r[s]=i,n[s]=c;let d=o,u=0;for(;d!==s;)u+=r[d++],d%=e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),c-a<t)return;const f=l&&c-l;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,s=1e3/t;const o=(t,s=Date.now())=>{a=s,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),i=t-a;i>=s?o(e,t):(r=e,n||(n=setTimeout(()=>{n=null,o(r)},s-i)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,i=s-n,c=a(i);n=s;e({loaded:s,total:o,progress:o?s/o:void 0,bytes:i,rate:c||void 0,estimated:c&&o&&s<=o?(o-s)/c:void 0,event:r,lengthComputable:null!=o,[t?"download":"upload"]:!0})},r)},Zd=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},qd=e=>(...t)=>md.asap(()=>e(...t));var Jd=Id.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Id.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Id.origin),Id.navigator&&/(msie|trident)/i.test(Id.navigator.userAgent)):()=>!0,Yd=Id.hasStandardBrowserEnv?{write(e,t,r,n,a,s,o){if("undefined"==typeof document)return;const i=[`${e}=${encodeURIComponent(t)}`];md.isNumber(r)&&i.push(`expires=${new Date(r).toUTCString()}`),md.isString(n)&&i.push(`path=${n}`),md.isString(a)&&i.push(`domain=${a}`),!0===s&&i.push("secure"),md.isString(o)&&i.push(`SameSite=${o}`),document.cookie=i.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Xd(e,t,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Qd=e=>e instanceof Vd?{...e}:e;function eu(e,t){t=t||{};const r={};function n(e,t,r,n){return md.isPlainObject(e)&&md.isPlainObject(t)?md.merge.call({caseless:n},e,t):md.isPlainObject(t)?md.merge({},t):md.isArray(t)?t.slice():t}function a(e,t,r,a){return md.isUndefined(t)?md.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function s(e,t){if(!md.isUndefined(t))return n(void 0,t)}function o(e,t){return md.isUndefined(t)?md.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function i(r,a,s){return s in t?n(r,a):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:i,headers:(e,t,r)=>a(Qd(e),Qd(t),0,!0)};return md.forEach(Object.keys({...e,...t}),function(n){const s=c[n]||a,o=s(e[n],t[n],n);md.isUndefined(o)&&s!==i||(r[n]=o)}),r}var tu=e=>{const t=eu({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:s,headers:o,auth:i}=t;if(t.headers=o=Vd.from(o),t.url=Ed(Xd(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),i&&o.set("Authorization","Basic "+btoa((i.username||"")+":"+(i.password?unescape(encodeURIComponent(i.password)):""))),md.isFormData(r))if(Id.hasStandardBrowserEnv||Id.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(md.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&o.set(e,r)})}if(Id.hasStandardBrowserEnv&&(n&&md.isFunction(n)&&(n=n(t)),n||!1!==n&&Jd(t.url))){const e=a&&s&&Yd.read(s);e&&o.set(a,e)}return t};var ru="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=tu(e);let a=n.data;const s=Vd.from(n.headers).normalize();let o,i,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=Vd.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());Hd(function(e){t(e),m()},function(e){r(e),m()},{data:u&&"text"!==u&&"json"!==u?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new hd("Request aborted",hd.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new hd(n,hd.ERR_NETWORK,e,h);a.event=t||null,r(a),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||Nd;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new hd(t,a.clarifyTimeoutError?hd.ETIMEDOUT:hd.ECONNABORTED,e,h)),h=null},void 0===a&&s.setContentType(null),"setRequestHeader"in h&&md.forEach(s.toJSON(),function(e,t){h.setRequestHeader(t,e)}),md.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=Kd(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([i,l]=Kd(f),h.upload.addEventListener("progress",i),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(o=t=>{h&&(r(!t||t.type?new Gd(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===Id.protocols.indexOf(b)?r(new hd("Unsupported protocol "+b+":",hd.ERR_BAD_REQUEST,e)):h.send(a||null)})};const nu=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,o();const t=e instanceof Error?e:this.reason;n.abort(t instanceof hd?t:new Gd(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,a(new hd(`timeout of ${t}ms exceeded`,hd.ETIMEDOUT))},t);const o=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:i}=n;return i.unsubscribe=()=>md.asap(o),i}},au=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},su=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},ou=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of su(e))yield*au(r,t)}(e,t);let s,o=0,i=e=>{s||(s=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return i(),void e.close();let s=n.byteLength;if(r){let e=o+=s;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw i(e),e}},cancel:e=>(i(e),a.return())},{highWaterMark:2})},{isFunction:iu}=md,cu=(({Request:e,Response:t})=>({Request:e,Response:t}))(md.global),{ReadableStream:lu,TextEncoder:du}=md.global,uu=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},fu=e=>{e=md.merge.call({skipUndefined:!0},cu,e);const{fetch:t,Request:r,Response:n}=e,a=t?iu(t):"function"==typeof fetch,s=iu(r),o=iu(n);if(!a)return!1;const i=a&&iu(lu),c=a&&("function"==typeof du?(l=new du,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=s&&i&&uu(()=>{let e=!1;const t=new r(Id.origin,{body:new lu,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=o&&i&&uu(()=>md.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new hd(`Response type '${e}' is not supported`,hd.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=md.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(md.isBlob(e))return e.size;if(md.isSpecCompliantForm(e)){const t=new r(Id.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return md.isArrayBufferView(e)||md.isArrayBuffer(e)?e.byteLength:(md.isURLSearchParams(e)&&(e+=""),md.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:o,data:i,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:y,withCredentials:v="same-origin",fetchOptions:x}=tu(e),w=t||fetch;b=b?(b+"").toLowerCase():"text";let S=nu([c,l&&l.toAbortSignal()],m),k=null;const j=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==o&&"head"!==o&&0!==(E=await p(y,i))){let e,t=new r(a,{method:"POST",body:i,duplex:"half"});if(md.isFormData(i)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=Zd(E,Kd(qd(g)));i=ou(t.body,65536,e,r)}}md.isString(v)||(v=v?"include":"omit");const t=s&&"credentials"in r.prototype,c={...x,signal:S,method:o.toUpperCase(),headers:y.normalize().toJSON(),body:i,duplex:"half",credentials:t?v:void 0};k=s&&new r(a,c);let l=await(s?w(k,x):w(a,c));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&j)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=md.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&Zd(t,Kd(qd(h),!0))||[];l=new n(ou(l.body,65536,r,()=>{a&&a(),j&&j()}),e)}b=b||"text";let A=await f[md.findKey(f,b)||"text"](l,e);return!m&&j&&j(),await new Promise((t,r)=>{Hd(t,r,{data:A,headers:Vd.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(j&&j(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new hd("Network Error",hd.ERR_NETWORK,e,k),{cause:t.cause||t});throw hd.from(t,t&&t.code,e,k)}}},pu=new Map,mu=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,s=[n,a,r];let o,i,c=s.length,l=pu;for(;c--;)o=s[c],i=l.get(o),void 0===i&&l.set(o,i=c?new Map:fu(t)),l=i;return i};mu();const hu={http:null,xhr:ru,fetch:{get:mu}};md.forEach(hu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const gu=e=>`- ${e}`,bu=e=>md.isFunction(e)||null===e||!1===e;var yu={getAdapter:function(e,t){e=md.isArray(e)?e:[e];const{length:r}=e;let n,a;const s={};for(let o=0;o<r;o++){let r;if(n=e[o],a=n,!bu(n)&&(a=hu[(r=String(n)).toLowerCase()],void 0===a))throw new hd(`Unknown adapter '${r}'`);if(a&&(md.isFunction(a)||(a=a.get(t))))break;s[r||"#"+o]=a}if(!a){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(gu).join("\n"):" "+gu(e[0]):"as no adapter specified";throw new hd("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:hu};function vu(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Gd(null,e)}function xu(e){vu(e),e.headers=Vd.from(e.headers),e.data=Wd.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return yu.getAdapter(e.adapter||Ud.adapter,e)(e).then(function(t){return vu(e),t.data=Wd.call(e,e.transformResponse,t),t.headers=Vd.from(t.headers),t},function(t){return Bd(t)||(vu(e),t&&t.response&&(t.response.data=Wd.call(e,e.transformResponse,t.response),t.response.headers=Vd.from(t.response.headers))),Promise.reject(t)})}const wu="1.13.4",Su={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Su[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const ku={};Su.transitional=function(e,t,r){function n(e,t){return"[Axios v"+wu+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,s)=>{if(!1===e)throw new hd(n(a," has been removed"+(t?" in "+t:"")),hd.ERR_DEPRECATED);return t&&!ku[a]&&(ku[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,s)}},Su.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var ju={assertOptions:function(e,t,r){if("object"!=typeof e)throw new hd("options must be an object",hd.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const s=n[a],o=t[s];if(o){const t=e[s],r=void 0===t||o(t,s,e);if(!0!==r)throw new hd("option "+s+" must be "+r,hd.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new hd("Unknown option "+s,hd.ERR_BAD_OPTION)}},validators:Su};const Eu=ju.validators;let Au=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ad,response:new Ad}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=eu(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&ju.assertOptions(r,{silentJSONParsing:Eu.transitional(Eu.boolean),forcedJSONParsing:Eu.transitional(Eu.boolean),clarifyTimeoutError:Eu.transitional(Eu.boolean)},!1),null!=n&&(md.isFunction(n)?t.paramsSerializer={serialize:n}:ju.assertOptions(n,{encode:Eu.function,serialize:Eu.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ju.assertOptions(t,{baseUrl:Eu.spelling("baseURL"),withXsrfToken:Eu.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=a&&md.merge(a.common,a[t.method]);a&&md.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=Vd.concat(s,a);const o=[];let i=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,o.unshift(e.fulfilled,e.rejected))});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let d,u=0;if(!i){const e=[xu.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){const e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=xu.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return Ed(Xd((e=eu(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};md.forEach(["delete","get","head","options"],function(e){Au.prototype[e]=function(t,r){return this.request(eu(r||{},{method:e,url:t,data:(r||{}).data}))}}),md.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(eu(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Au.prototype[e]=t(),Au.prototype[e+"Form"]=t(!0)});const Nu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Nu).forEach(([e,t])=>{Nu[t]=e});const Cu=function e(t){const r=new Au(t),n=jl(Au.prototype.request,r);return md.extend(n,Au.prototype,r,{allOwnKeys:!0}),md.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(eu(t,r))},n}(Ud);Cu.Axios=Au,Cu.CanceledError=Gd,Cu.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new Gd(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Cu.isCancel=Bd,Cu.VERSION=wu,Cu.toFormData=xd,Cu.AxiosError=hd,Cu.Cancel=Cu.CanceledError,Cu.all=function(e){return Promise.all(e)},Cu.spread=function(e){return function(t){return e.apply(null,t)}},Cu.isAxiosError=function(e){return md.isObject(e)&&!0===e.isAxiosError},Cu.mergeConfig=eu,Cu.AxiosHeaders=Vd,Cu.formToJSON=e=>Dd(md.isHTMLForm(e)?new FormData(e):e),Cu.getAdapter=yu.getAdapter,Cu.HttpStatusCode=Nu,Cu.default=Cu;const{Axios:_u,AxiosError:Tu,CanceledError:Ru,isCancel:Pu,CancelToken:Ou,VERSION:Iu,all:Du,Cancel:Uu,isAxiosError:Mu,spread:Fu,toFormData:zu,AxiosHeaders:Lu,HttpStatusCode:$u,formToJSON:Vu,getAdapter:Wu,mergeConfig:Bu}=Cu;const Gu=new class{constructor(e={}){this.client=Cu.create({baseURL:e.baseURL||"https://api.example.com",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=rt();return t&&(e.headers["x-session-id"]=t),e},e=>Promise.reject(e))}async get(e,t){const r=await this.client.get(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async post(e,t,r){const n=await this.client.post(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async put(e,t,r){const n=await this.client.put(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}async delete(e,t){const r=await this.client.delete(e,t);return{data:r.data,status:r.status,statusText:r.statusText,headers:r.headers}}async patch(e,t,r){const n=await this.client.patch(e,t,r);return{data:n.data,status:n.status,statusText:n.statusText,headers:n.headers}}setBaseURL(e){this.client.defaults.baseURL=e}setHeader(e,t){this.client.defaults.headers.common[e]=t}removeHeader(e){delete this.client.defaults.headers.common[e]}};function Hu(){const e=Gt(),r=Bt(e=>e.auth),n=Bt(e=>e.os),{serverUrl:a,orgId:s,auth:o}=n,{resetCurrentWorkspace:i,currentWorkspace:c}=tr(),l=t.useCallback(async()=>{e.auth(Me());try{const t=await Gu.post(`${a}/api/v1/auth/request`,{orgId:s,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(ze()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(ze()),Ie(t,{component:"useSaaSAuth",action:"signIn"}),t}},[a,s,o,e]),d=t.useCallback(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth($e()),i(),tt()}catch(e){Ie(e,{component:"useSaaSAuth",action:"signOut"}),tt()}},[e,i,o?.callbacks?.onSignOut]),u=t.useCallback(e=>{c?rr.openWorkspaceSettings(e):Ie(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[c]),f=t.useMemo(()=>Ke(r.status),[r.status]);return t.useMemo(()=>({user:r.session?.user,session:r.session,status:r.status,...f,signIn:l,signOut:d,openWorkspaceSettings:u}),[r.session,r.status,f,l,d,u])}function Ku(){const e=t.useContext(Xt);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}function Zu(){const e=Gt(),r=Bt(e=>e.os),{serverUrl:n,version:a,orgId:s,settings:o}=r,i=t.useRef(!1),c=t.useCallback(async t=>{if(i.current)return o||null;if(o)return o;if(!n||!a||!s)return null;i.current=!0;try{const r=nt(),o=await Ce(`${n}/api/${a}/public/${s}/settings`,{headers:r,signal:t});if(!o.ok)throw new Error("Failed to fetch settings");const i=await o.json();return e.os(mt(i)),i}catch(e){return De(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:n,version:a,orgId:s}}),null}finally{i.current=!1}},[n,a,s,o,e]);return Ht(async e=>{n&&a&&s&&!o&&!i.current&&await c(e)},[n,a,s,c],{onError:e=>De(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:n,version:a,orgId:s}})}),t.useMemo(()=>({settings:o,getSettings:c}),[o,c])}function qu(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function Ju(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var Yu,Xu=globalThis?.document?a.useLayoutEffect:()=>{},Qu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zo(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),ef={exports:{}},tf={};function rf(){if(Yu)return tf;Yu=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),l=c[0].inst,d=c[1];return s(function(){l.value=r,l.getSnapshot=t,i(l)&&d({inst:l})},[e,r,t]),a(function(){return i(l)&&d({inst:l}),e(function(){i(l)&&d({inst:l})})},[e]),o(r),r};return tf.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,tf}var nf,af,sf={};
20
+ */jd.displayName="Button";var Ed=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Vl(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),Cd=a.forwardRef((t,r)=>e.jsx(Ed.label,{...t,ref:r,onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(t.onMouseDown?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())}}));Cd.displayName="Label";var Nd=Cd;const Ad=Zl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_d=a.forwardRef(({className:t,...r},n)=>e.jsx(Nd,{ref:n,className:je(Ad(),t),...r}));_d.displayName=Nd.displayName;const Td=Ws,Rd=a.createContext({}),Pd=({...t})=>e.jsx(Rd.Provider,{value:{name:t.name},children:e.jsx(Vs,{...t})}),Od=()=>{const e=a.useContext(Rd),r=a.useContext(Id),{getFieldState:n,formState:s}=t.useContext($s),o=n(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=r;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},Id=a.createContext({}),Dd=a.forwardRef(({className:t,...r},n)=>{const s=a.useId();return e.jsx(Id.Provider,{value:{id:s},children:e.jsx("div",{ref:n,className:je("space-y-2",t),...r})})});Dd.displayName="FormItem";const Ud=a.forwardRef(({className:t,...r},n)=>{const{error:a,formItemId:s}=Od();return e.jsx(_d,{ref:n,className:je(a&&"text-destructive",t),htmlFor:s,...r})});Ud.displayName="FormLabel";const Fd=a.forwardRef(({...t},r)=>{const{error:n,formItemId:a,formDescriptionId:s,formMessageId:o}=Od();return e.jsx($l,{ref:r,id:a,"aria-describedby":n?`${s} ${o}`:`${s}`,"aria-invalid":!!n,...t})});Fd.displayName="FormControl";const Md=a.forwardRef(({className:t,...r},n)=>{const{formDescriptionId:a}=Od();return e.jsx("p",{ref:n,id:a,className:je("text-sm text-muted-foreground",t),...r})});Md.displayName="FormDescription";const zd=a.forwardRef(({className:t,children:r,...n},a)=>{const{error:s,formMessageId:o}=Od(),i=s?String(s?.message):r;return i?e.jsx("p",{ref:a,id:o,className:je("text-sm font-medium text-destructive",t),...n,children:i}):null});zd.displayName="FormMessage";const Ld=a.forwardRef(({className:t,type:r,...n},a)=>e.jsx("input",{type:r,className:je("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n}));function Vd({className:t,...r}){return e.jsx("div",{className:je("animate-pulse rounded-md bg-primary/10",t),...r})}Ld.displayName="Input";class $d extends Zt{constructor(e){super({...e,basePath:"beta",requireOrgId:!0})}getAuthHeaders(){return{}}async fetchConfig(){return this.fetchJson(`config?orgId=${encodeURIComponent(this.orgId)}`,{},"Failed to fetch beta form configuration")}async submitBetaUser(e){return this.fetchJson("submit",{method:"POST",body:JSON.stringify(e)},"Failed to submit beta user request")}}let Wd=class{constructor(e){this.api=new $d(e),this.orgId=e.orgId}async fetchConfig(){return this.api.fetchConfig()}async submitBetaUser(e){const t=e?.context??{},r=t?.country??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[1]:void 0),n=t?.language??("undefined"!=typeof navigator&&navigator.language?navigator.language.split("-")[0]:void 0),a=t?.timezone??("undefined"!=typeof Intl&&Intl.DateTimeFormat?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),s=t?.currency??("undefined"!=typeof Intl&&Intl.NumberFormat&&Intl.NumberFormat().resolvedOptions().currency?Intl.NumberFormat().resolvedOptions().currency:void 0);return this.api.submitBetaUser({orgId:this.orgId,formData:{...e,country:r,language:n,timezone:a,currency:s}})}};const Bd=Po("ZodISODateTime",(e,t)=>{kc.init(e,t),hu.init(e,t)});function Gd(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ti(t)})}(Bd,e)}const Kd=Po("ZodISODate",(e,t)=>{jc.init(e,t),hu.init(e,t)});function Hd(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...ti(t)})}(Kd,e)}const Zd=Po("ZodISOTime",(e,t)=>{Ec.init(e,t),hu.init(e,t)});function Jd(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ti(t)})}(Zd,e)}const qd=Po("ZodISODuration",(e,t)=>{Cc.init(e,t),hu.init(e,t)});function Yd(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...ti(t)})}(qd,e)}const Xd=Po("ZodError",(e,t)=>{li.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>n({issues:e}));else if("invalid_key"===a.code)n({issues:a.issues});else if("invalid_element"===a.code)n({issues:a.issues});else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Mo,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Mo,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Qd=ui(Xd),eu=pi(Xd),tu=hi(Xd),ru=bi(Xd),nu=vi(Xd),au=xi(Xd),su=wi(Xd),ou=Si(Xd),iu=ki(Xd),cu=ji(Xd),lu=Ei(Xd),du=Ci(Xd),uu=Po("ZodType",(e,t)=>(lc.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Al(e,"input"),output:Al(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=kl({...r,processors:t});return jl(e,n),El(n,e),Cl(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Go(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>ei(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Qd(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>tu(e,t,r),e.parseAsync=async(t,r)=>eu(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ru(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>nu(e,t,r),e.decode=(t,r)=>au(e,t,r),e.encodeAsync=async(t,r)=>su(e,t,r),e.decodeAsync=async(t,r)=>ou(e,t,r),e.safeEncode=(t,r)=>iu(e,t,r),e.safeDecode=(t,r)=>cu(e,t,r),e.safeEncodeAsync=async(t,r)=>lu(e,t,r),e.safeDecodeAsync=async(t,r)=>du(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ti(r)})}(af,e,t)}(t,r)),e.superRefine=t=>e.check(Sl(t)),e.overwrite=t=>e.check(wl(t)),e.optional=()=>Hu(e),e.exactOptional=()=>new Zu({type:"optional",innerType:e}),e.nullable=()=>qu(e),e.nullish=()=>Hu(qu(e)),e.nonoptional=t=>function(e,t){return new Qu({type:"nonoptional",innerType:e,...ti(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...ti(r)})}(zu,e,t);var t},e.or=t=>function(e,t){return new $u({type:"union",options:e,...ti(t)})}([e,t]),e.and=t=>new Wu({type:"intersection",left:e,right:t}),e.transform=t=>rf(e,new Gu({type:"transform",transform:t})),e.default=t=>{return r=t,new Yu({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():Yo(r)}});var r},e.prefault=t=>{return r=t,new Xu({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():Yo(r)}});var r},e.catch=t=>{return new ef({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>rf(e,t),e.readonly=()=>new nf({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return gl.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>gl.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return gl.get(e);const r=e.clone();return gl.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),fu=Po("_ZodString",(e,t)=>{dc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:s,format:o,patterns:i,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof s&&(n.maxLength=s),o&&(n.format=_l[o]??o,""===n.format&&delete n.format,"time"===o&&delete n.format),c&&(n.contentEncoding=c),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ec({check:"string_format",format:"regex",...ti(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new nc({check:"string_format",format:"includes",...ti(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new ac({check:"string_format",format:"starts_with",...ti(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new sc({check:"string_format",format:"ends_with",...ti(t),suffix:e})}(...t)),e.min=(...t)=>e.check(vl(...t)),e.max=(...t)=>e.check(yl(...t)),e.length=(...t)=>e.check(xl(...t)),e.nonempty=(...t)=>e.check(vl(1,...t)),e.lowercase=t=>e.check(function(e){return new tc({check:"string_format",format:"lowercase",...ti(e)})}(t)),e.uppercase=t=>e.check(function(e){return new rc({check:"string_format",format:"uppercase",...ti(e)})}(t)),e.trim=()=>e.check(wl(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return wl(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(wl(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(wl(e=>e.toUpperCase())),e.slugify=()=>e.check(wl(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),pu=Po("ZodString",(e,t)=>{dc.init(e,t),fu.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ti(t)})}(gu,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ti(t)})}(vu,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ti(t)})}(Iu,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ti(t)})}(xu,t)),e.guid=t=>e.check(bl(bu,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ti(t)})}(yu,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ti(t)})}(yu,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ti(t)})}(yu,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ti(t)})}(yu,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ti(t)})}(wu,t)),e.guid=t=>e.check(bl(bu,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ti(t)})}(Su,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ti(t)})}(ku,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ti(t)})}(ju,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ti(t)})}(Ru,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ti(t)})}(Pu,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ti(t)})}(Eu,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ti(t)})}(Cu,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ti(t)})}(Nu,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ti(t)})}(Au,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ti(t)})}(_u,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ti(t)})}(Tu,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ti(t)})}(Ou,t)),e.datetime=t=>e.check(Gd(t)),e.date=t=>e.check(Hd(t)),e.time=t=>e.check(Jd(t)),e.duration=t=>e.check(Yd(t))});function mu(e){return function(e,t){return new e({type:"string",...ti(t)})}(pu,e)}const hu=Po("ZodStringFormat",(e,t)=>{uc.init(e,t),fu.init(e,t)}),gu=Po("ZodEmail",(e,t)=>{mc.init(e,t),hu.init(e,t)}),bu=Po("ZodGUID",(e,t)=>{fc.init(e,t),hu.init(e,t)}),yu=Po("ZodUUID",(e,t)=>{pc.init(e,t),hu.init(e,t)}),vu=Po("ZodURL",(e,t)=>{hc.init(e,t),hu.init(e,t)}),xu=Po("ZodEmoji",(e,t)=>{gc.init(e,t),hu.init(e,t)}),wu=Po("ZodNanoID",(e,t)=>{bc.init(e,t),hu.init(e,t)}),Su=Po("ZodCUID",(e,t)=>{yc.init(e,t),hu.init(e,t)}),ku=Po("ZodCUID2",(e,t)=>{vc.init(e,t),hu.init(e,t)}),ju=Po("ZodULID",(e,t)=>{xc.init(e,t),hu.init(e,t)}),Eu=Po("ZodXID",(e,t)=>{wc.init(e,t),hu.init(e,t)}),Cu=Po("ZodKSUID",(e,t)=>{Sc.init(e,t),hu.init(e,t)}),Nu=Po("ZodIPv4",(e,t)=>{Nc.init(e,t),hu.init(e,t)}),Au=Po("ZodIPv6",(e,t)=>{Ac.init(e,t),hu.init(e,t)}),_u=Po("ZodCIDRv4",(e,t)=>{_c.init(e,t),hu.init(e,t)}),Tu=Po("ZodCIDRv6",(e,t)=>{Tc.init(e,t),hu.init(e,t)}),Ru=Po("ZodBase64",(e,t)=>{Pc.init(e,t),hu.init(e,t)}),Pu=Po("ZodBase64URL",(e,t)=>{Oc.init(e,t),hu.init(e,t)}),Ou=Po("ZodE164",(e,t)=>{Ic.init(e,t),hu.init(e,t)}),Iu=Po("ZodJWT",(e,t)=>{Dc.init(e,t),hu.init(e,t)}),Du=Po("ZodUnknown",(e,t)=>{Uc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function Uu(){return new Du({type:"unknown"})}const Fu=Po("ZodNever",(e,t)=>{Fc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function Mu(e){return function(e,t){return new e({type:"never",...ti(t)})}(Fu,e)}const zu=Po("ZodArray",(e,t)=>{zc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def,{minimum:o,maximum:i}=e._zod.bag;"number"==typeof o&&(a.minItems=o),"number"==typeof i&&(a.maxItems=i),a.type="array",a.items=jl(s.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(vl(t,r)),e.nonempty=t=>e.check(vl(1,t)),e.max=(t,r)=>e.check(yl(t,r)),e.length=(t,r)=>e.check(xl(t,r)),e.unwrap=()=>e.element});const Lu=Po("ZodObject",(e,t)=>{Bc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object",a.properties={};const o=s.shape;for(const e in o)a.properties[e]=jl(o[e],t,{...n,path:[...n.path,"properties",e]});const i=new Set(Object.keys(o)),c=new Set([...i].filter(e=>{const r=s.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===s.catchall?._zod.def.type?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=jl(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),Wo(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Bu({type:"enum",entries:r,...ti(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Uu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Uu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!qo(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Go(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Bo(this,"shape",r),r}});return ei(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!qo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Go(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Bo(this,"shape",r),r}});return ei(e,r)}(e,t),e.merge=t=>function(e,t){const r=Go(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Bo(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ei(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ei(e,Go(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return Bo(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Go(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return Bo(this,"shape",n),n},checks:[]});return ei(e,a)}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Go(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)a[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Bo(this,"shape",a),a},checks:[]});return ei(t,a)}(Ku,e,t[0]),e.required=(...t)=>function(e,t,r){const n=Go(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const t in r){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(a[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)a[t]=new e({type:"nonoptional",innerType:n[t]});return Bo(this,"shape",a),a}});return ei(t,n)}(Qu,e,t[0])});function Vu(e,t){const r={type:"object",shape:e??{},...ti(t)};return new Lu(r)}const $u=Po("ZodUnion",(e,t)=>{Kc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=!1===a.inclusive,o=a.options.map((e,r)=>jl(e,t,{...n,path:[...n.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=o:r.anyOf=o})(e,t,r,n),e.options=t.options});const Wu=Po("ZodIntersection",(e,t)=>{Hc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=jl(a.left,t,{...n,path:[...n.path,"allOf",0]}),o=jl(a.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,c=[...i(s)?s.allOf:[s],...i(o)?o.allOf:[o]];r.allOf=c})(e,t,r,n)});const Bu=Po("ZodEnum",(e,t)=>{qc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=Fo(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const a={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);a[n]=t.entries[n]}return new Bu({...t,checks:[],...ti(n),entries:a})},e.exclude=(e,n)=>{const a={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Bu({...t,checks:[],...ti(n),entries:a})}});const Gu=Po("ZodTransform",(e,t)=>{Yc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new Io(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(ii(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(ii(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Ku=Po("ZodOptional",(e,t)=>{Qc.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Tl(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Hu(e){return new Ku({type:"optional",innerType:e})}const Zu=Po("ZodExactOptional",(e,t)=>{el.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>Tl(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Ju=Po("ZodNullable",(e,t)=>{tl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s=jl(a.innerType,t,n),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=a.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function qu(e){return new Ju({type:"nullable",innerType:e})}const Yu=Po("ZodDefault",(e,t)=>{rl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;jl(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Xu=Po("ZodPrefault",(e,t)=>{al.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;jl(a.innerType,t,n),t.seen.get(e).ref=a.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const Qu=Po("ZodNonOptional",(e,t)=>{sl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;jl(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const ef=Po("ZodCatch",(e,t)=>{il.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let s;jl(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const tf=Po("ZodPipe",(e,t)=>{cl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,s="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;jl(s,t,n),t.seen.get(e).ref=s})(e,t,0,n),e.in=t.in,e.out=t.out});function rf(e,t){return new tf({type:"pipe",in:e,out:t})}const nf=Po("ZodReadonly",(e,t)=>{dl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;jl(a.innerType,t,n),t.seen.get(e).ref=a.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const af=Po("ZodCustom",(e,t)=>{fl.init(e,t),uu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});const sf=Vu({name:mu().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[a-zA-Z\s]*$/,"Name can only contain letters and spaces"),email:mu().min(1,"Please enter your email address").email("Please enter a valid email address").max(100,"Email must be less than 100 characters").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"Please enter a valid email format (e.g., name@domain.com)")}),of={en:{nameLabel:"Name",emailLabel:"Email",submitText:"Submit",submittingText:"Submitting...",errorMessage:"An error occurred"},es:{nameLabel:"Nombre",emailLabel:"Correo electrónico",submitText:"Enviar",submittingText:"Enviando...",errorMessage:"Ocurrió un error"},fr:{nameLabel:"Nom",emailLabel:"Email",submitText:"Soumettre",submittingText:"Soumission...",errorMessage:"Une erreur est survenue"},de:{nameLabel:"Name",emailLabel:"E-Mail",submitText:"Absenden",submittingText:"Wird gesendet...",errorMessage:"Ein Fehler ist aufgetreten"},zh:{nameLabel:"姓名",emailLabel:"电子邮件",submitText:"提交",submittingText:"提交中...",errorMessage:"发生错误"},ja:{nameLabel:"名前",emailLabel:"メールアドレス",submitText:"送信",submittingText:"送信中...",errorMessage:"エラーが発生しました"},ko:{nameLabel:"이름",emailLabel:"이메일",submitText:"제출",submittingText:"제출 중...",errorMessage:"오류가 발생했습니다"}};function cf({screen:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsx("p",{className:"text-2xl font-bold",children:t?.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?.description})]})}function lf({logo:t}){return"string"==typeof t?e.jsx("img",{src:t,alt:"Logo",className:"max-h-24"}):e.jsx("img",{src:t.bucket?.url,alt:"Logo",className:"max-h-24"})}function df(){const e=t.useContext(Za);if(void 0===e)throw new Error("useUserFeatures must be used within a UserProvider");return{features:e.features,isLoading:e.isLoading,error:e.error,refreshFeatures:e.refreshFeatures,isFeatureEnabled:t=>Boolean(e.features[t])}}function uf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}function ff(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...e)=>t.current?.(...e),[])}var pf,mf=globalThis?.document?a.useLayoutEffect:()=>{},hf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Vl(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),gf={exports:{}},bf={};function yf(){if(pf)return bf;pf=1;var e=t;var r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,a=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),l=c[0].inst,d=c[1];return s(function(){l.value=r,l.getSnapshot=t,i(l)&&d({inst:l})},[e,r,t]),a(function(){return i(l)&&d({inst:l}),e(function(){i(l)&&d({inst:l})})},[e]),o(r),r};return bf.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,bf}var vf,xf,wf={};
21
21
  /**
22
22
  * @license React
23
23
  * use-sync-external-store-shim.development.js
@@ -26,5 +26,5 @@ var oi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
26
26
  *
27
27
  * This source code is licensed under the MIT license found in the
28
28
  * LICENSE file in the root directory of this source tree.
29
- */function of(){return nf||(nf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};sf.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),sf}function cf(){return af||(af=1,"production"===process.env.NODE_ENV?ef.exports=rf():ef.exports=of()),ef.exports}var lf=cf();function df(){return()=>{}}var uf="Avatar",[ff]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const c=r=>{const{scope:n,children:s,...c}=r,l=n?.[t]?.[i]||o,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:s})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||o,l=a.useContext(c);if(l)return l;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},qu(s,...r)]}(uf),[pf,mf]=ff(uf),hf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(pf,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(Qu.span,{...s,ref:r})})});hf.displayName=uf;var gf="AvatarImage",bf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,c=mf(gf,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=lf.useSyncExternalStore(df,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,c]=a.useState(()=>xf(o,e));return Xu(()=>{c(xf(o,e))},[o,e]),Xu(()=>{const e=e=>()=>{c(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=Ju(e=>{o(e),c.onImageLoadingStatusChange(e)});return Xu(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(Qu.img,{...i,ref:r,src:s}):null});bf.displayName=gf;var yf="AvatarFallback",vf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=mf(yf,n),[c,l]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>l(!0),s);return()=>window.clearTimeout(e)}},[s]),c&&"loaded"!==i.imageLoadingStatus?e.jsx(Qu.span,{...o,ref:r}):null});function xf(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}vf.displayName=yf;var wf=hf,Sf=bf,kf=vf;const jf=a.forwardRef(({className:t,...r},n)=>e.jsx(wf,{ref:n,className:ke("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));jf.displayName=wf.displayName;const Ef=a.forwardRef(({className:t,...r},n)=>e.jsx(Sf,{ref:n,className:ke("aspect-square h-full w-full",t),...r}));Ef.displayName=Sf.displayName;const Af=a.forwardRef(({className:t,...r},n)=>e.jsx(kf,{ref:n,className:ke("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function Nf(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Cf(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const c=r=>{const{scope:n,children:s,...c}=r,l=n?.[t]?.[i]||o,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:s})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||o,l=a.useContext(c);if(l)return l;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},_f(s,...r)]}function _f(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}Af.displayName=kf.displayName;var Tf=a[" useId ".trim().toString()]||(()=>{}),Rf=0;function Pf(e){const[t,r]=a.useState(Tf());return Xu(()=>{r(e=>e??String(Rf++))},[e]),e||(t?`radix-${t}`:"")}var Of=a[" useInsertionEffect ".trim().toString()]||Xu;function If({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Of(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,n])}const d=a.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[c,e,o,i]);return[l,d]}function Df(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Uf=Symbol("radix.slottable");function Mf(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Uf}var Ff=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=Df(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(Mf);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var zf,Lf="dismissableLayer.update",$f="dismissableLayer.pointerDownOutside",Vf="dismissableLayer.focusOutside",Wf=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bf=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(Wf),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Bo(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),x=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=v,k=function(e,t=globalThis?.document){const r=Ju(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){Hf($f,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),c?.(e),e.defaultPrevented||l?.())},m),j=function(e,t=globalThis?.document){const r=Ju(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){Hf(Vf,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=Ju(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{x===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(zf=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Gf(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=zf)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Gf())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(Lf,e),()=>document.removeEventListener(Lf,e)},[]),e.jsx(Ff.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Nf(t.onFocusCapture,j.onFocusCapture),onBlurCapture:Nf(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Nf(t.onPointerDownCapture,k.onPointerDownCapture)})});Bf.displayName="DismissableLayer";function Gf(){const e=new CustomEvent(Lf);document.dispatchEvent(e)}function Hf(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(Wf),s=a.useRef(null),o=Bo(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Ff.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var Kf="focusScope.autoFocusOnMount",Zf="focusScope.autoFocusOnUnmount",qf={bubbles:!1,cancelable:!0},Jf=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=Ju(o),f=Ju(i),p=a.useRef(null),m=Bo(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:ep(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||ep(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&ep(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[s,l,h.paused]),a.useEffect(()=>{if(l){tp.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(Kf,qf);l.addEventListener(Kf,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ep(n,{select:t}),document.activeElement!==r)return}((e=Yf(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&ep(l))}return()=>{l.removeEventListener(Kf,u),setTimeout(()=>{const e=new CustomEvent(Zf,qf);l.addEventListener(Zf,f),l.dispatchEvent(e),e.defaultPrevented||ep(t??document.body,{select:!0}),l.removeEventListener(Zf,f),tp.remove(h)},0)}}var e},[l,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=Yf(e),r=Xf(t,e),n=Xf(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&ep(s,{select:!0})):(e.preventDefault(),n&&ep(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Ff.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function Yf(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Xf(e,t){for(const r of e)if(!Qf(r,{upTo:t}))return r}function Qf(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function ep(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Jf.displayName="FocusScope";var tp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=rp(e,t),e.unshift(t)},remove(t){e=rp(e,t),e[0]?.resume()}}}();function rp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var np=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,c]=a.useState(!1);Xu(()=>c(!0),[]);const l=s||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(Ff.div,{...o,ref:n}),l):null});np.displayName="Portal";var ap=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[c,l]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=sp(n.current);o.current="mounted"===c?e:"none"},[c]),Xu(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=sp(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,l]),Xu(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=sp(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(l("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=sp(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=Bo(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function sp(e){return e?.animationName||"none"}ap.displayName="Presence";var op=0;function ip(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cp()),document.body.insertAdjacentElement("beforeend",e[1]??cp()),op++,()=>{1===op&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),op--}},[])}function cp(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var lp=function(){return lp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},lp.apply(this,arguments)};function dp(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var up="right-scroll-bar-position",fp="width-before-scroll-bar";function pp(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var mp="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,hp=new WeakMap;function gp(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return pp(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return mp(function(){var t=hp.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||pp(e,null)}),n.forEach(function(e){r.has(e)||pp(e,a)})}hp.set(o,e)},[e]),o}function bp(e){return e}var yp=function(e){var t=e.sideCar,r=dp(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,lp({},r))};yp.isSideCarExport=!0;var vp=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=bp);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=lp({async:!0,ssr:!1},e),t}(),xp=function(){},wp=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:xp,onWheelCapture:xp,onTouchMoveCapture:xp}),s=n[0],o=n[1],i=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,v=void 0===y?"div":y,x=e.gapMode,w=dp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=gp([r,t]),j=lp(lp({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:vp,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:x}),i?a.cloneElement(a.Children.only(c),lp(lp({},j),{ref:k})):a.createElement(v,lp({},j,{className:l,ref:k}),c))});wp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},wp.classNames={fullWidth:fp,zeroRight:up};function Sp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var kp=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Sp())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},jp=function(){var e,t=(e=kp(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},Ep={left:0,top:0,right:0,gap:0},Ap=function(e){return parseInt(e||"",10)||0},Np=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Ep;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Ap(r),Ap(n),Ap(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Cp=jp(),_p="data-scroll-locked",Tp=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(_p,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(up," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(fp," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(up," .").concat(up," {\n right: 0 ").concat(n,";\n }\n \n .").concat(fp," .").concat(fp," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(_p,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Rp=function(){var e=parseInt(document.body.getAttribute(_p)||"0",10);return isFinite(e)?e:0},Pp=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(_p,(Rp()+1).toString()),function(){var e=Rp()-1;e<=0?document.body.removeAttribute(_p):document.body.setAttribute(_p,e.toString())}},[]);var o=a.useMemo(function(){return Np(s)},[s]);return a.createElement(Cp,{styles:Tp(o,!t,s,r?"":"!important")})},Op=!1;if("undefined"!=typeof window)try{var Ip=Object.defineProperty({},"passive",{get:function(){return Op=!0,!0}});window.addEventListener("test",Ip,Ip),window.removeEventListener("test",Ip,Ip)}catch(e){Op=!1}var Dp=!!Op&&{passive:!1},Up=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Mp=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Fp(e,n)){var a=zp(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Fp=function(e,t){return"v"===e?function(e){return Up(e,"overflowY")}(t):function(e){return Up(e,"overflowX")}(t)},zp=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},Lp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$p=function(e){return[e.deltaX,e.deltaY]},Vp=function(e){return e&&"current"in e?e.current:e},Wp=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Bp=0,Gp=[];function Hp(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Kp,Zp=(Kp=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(Bp++)[0],o=a.useState(jp)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(Vp),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=Lp(e),o=r.current,c="deltaX"in e?e.deltaX:o[0]-s[0],l="deltaY"in e?e.deltaY:o[1]-s[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Mp(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Mp(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(c||l)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),c=!1,l=s>0,d=0,u=0;do{if(!o)break;var f=zp(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Fp(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=a.useCallback(function(e){var r=e;if(Gp.length&&Gp[Gp.length-1]===o){var n="deltaY"in r?$p(r):Lp(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var s=(i.current.shards||[]).map(Vp).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?c(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:Hp(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=Lp(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,$p(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,Lp(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return Gp.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Dp),document.addEventListener("touchmove",l,Dp),document.addEventListener("touchstart",u,Dp),function(){Gp=Gp.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,Dp),document.removeEventListener("touchmove",l,Dp),document.removeEventListener("touchstart",u,Dp)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:Wp(s)}):null,m?a.createElement(Pp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},vp.useMedium(Kp),yp),qp=a.forwardRef(function(e,t){return a.createElement(wp,lp({},e,{ref:t,sideCar:Zp}))});qp.classNames=wp.classNames;var Jp=new WeakMap,Yp=new WeakMap,Xp={},Qp=0,em=function(e){return e&&(e.host||em(e.parentNode))},tm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=em(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);Xp[r]||(Xp[r]=new WeakMap);var s=Xp[r],o=[],i=new Set,c=new Set(a),l=function(e){e&&!i.has(e)&&(i.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(Jp.get(e)||0)+1,l=(s.get(e)||0)+1;Jp.set(e,c),s.set(e,l),o.push(e),1===c&&a&&Yp.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),i.clear(),Qp++,function(){o.forEach(function(e){var t=Jp.get(e)-1,a=s.get(e)-1;Jp.set(e,t),s.set(e,a),t||(Yp.has(e)||e.removeAttribute(n),Yp.delete(e)),a||e.removeAttribute(r)}),--Qp||(Jp=new WeakMap,Jp=new WeakMap,Yp=new WeakMap,Xp={})}},rm=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),tm(n,a,r,"aria-hidden")):function(){return null}};function nm(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var am=Symbol("radix.slottable");function sm(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===am}var om="Dialog",[im,cm]=Cf(om),[lm,dm]=im(om),um=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=t,l=a.useRef(null),d=a.useRef(null),[u,f]=If({prop:s,defaultProp:o??!1,onChange:i,caller:om});return e.jsx(lm,{scope:r,triggerRef:l,contentRef:d,contentId:Pf(),titleId:Pf(),descriptionId:Pf(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};um.displayName=om;var fm="DialogTrigger",pm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=dm(fm,n),o=Bo(r,s.triggerRef);return e.jsx(Ff.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Om(s.open),...a,ref:o,onClick:Nf(t.onClick,s.onOpenToggle)})});pm.displayName=fm;var mm="DialogPortal",[hm,gm]=im(mm,{forceMount:void 0}),bm=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=dm(mm,r);return e.jsx(hm,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(ap,{present:n||i.open,children:e.jsx(np,{asChild:!0,container:o,children:t})}))})};bm.displayName=mm;var ym="DialogOverlay",vm=a.forwardRef((t,r)=>{const n=gm(ym,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=dm(ym,t.__scopeDialog);return o.modal?e.jsx(ap,{present:a||o.open,children:e.jsx(wm,{...s,ref:r})}):null});vm.displayName=ym;var xm=function(t){const r=nm(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(sm);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),wm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=dm(ym,n);return e.jsx(qp,{as:xm,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Ff.div,{"data-state":Om(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Sm="DialogContent",km=a.forwardRef((t,r)=>{const n=gm(Sm,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=dm(Sm,t.__scopeDialog);return e.jsx(ap,{present:a||o.open,children:o.modal?e.jsx(jm,{...s,ref:r}):e.jsx(Em,{...s,ref:r})})});km.displayName=Sm;var jm=a.forwardRef((t,r)=>{const n=dm(Sm,t.__scopeDialog),s=a.useRef(null),o=Bo(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return rm(e)},[]),e.jsx(Am,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nf(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Nf(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Nf(t.onFocusOutside,e=>e.preventDefault())})}),Em=a.forwardRef((t,r)=>{const n=dm(Sm,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(Am,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Am=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=t,l=dm(Sm,n),d=a.useRef(null),u=Bo(r,d);return ip(),e.jsxs(e.Fragment,{children:[e.jsx(Jf,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(Bf,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Om(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Mm,{titleId:l.titleId}),e.jsx(Fm,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Nm="DialogTitle",Cm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=dm(Nm,n);return e.jsx(Ff.h2,{id:s.titleId,...a,ref:r})});Cm.displayName=Nm;var _m="DialogDescription",Tm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=dm(_m,n);return e.jsx(Ff.p,{id:s.descriptionId,...a,ref:r})});Tm.displayName=_m;var Rm="DialogClose",Pm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=dm(Rm,n);return e.jsx(Ff.button,{type:"button",...a,ref:r,onClick:Nf(t.onClick,()=>s.onOpenChange(!1))})});function Om(e){return e?"open":"closed"}Pm.displayName=Rm;var Im="DialogTitleWarning",[Dm,Um]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(Im,{contentName:Sm,titleName:Nm,docsSlug:"dialog"}),Mm=({titleId:e})=>{const t=Um(Im),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Fm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Um("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},zm=um,Lm=pm,$m=bm,Vm=vm,Wm=km,Bm=Cm,Gm=Tm,Hm=Pm;function Km(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var Zm=["color"],qm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Km(e,Zm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Jm=["color"],Ym=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Km(e,Jm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),Xm=["color"],Qm=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Km(e,Xm);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),eh=["color"],th=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=Km(e,eh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const rh=zm,nh=Lm,ah=$m,sh=a.forwardRef(({className:t,...r},n)=>e.jsx(Vm,{ref:n,className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));sh.displayName=Vm.displayName;const oh=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(Jt);return e.jsxs(ah,{container:o,children:[e.jsx(sh,{}),e.jsxs(Wm,{ref:s,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs(Hm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Qm,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});oh.displayName=Wm.displayName;const ih=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});ih.displayName="DialogHeader";const ch=a.forwardRef(({className:t,...r},n)=>e.jsx(Bm,{ref:n,className:ke("text-lg font-semibold leading-none tracking-tight",t),...r}));ch.displayName=Bm.displayName;const lh=a.forwardRef(({className:t,...r},n)=>e.jsx(Gm,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));function dh(t){const r=uh(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(ph);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function uh(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}lh.displayName=Gm.displayName;var fh=Symbol("radix.slottable");function ph(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===fh}function mh(r){const n=r+"CollectionProvider",[a,s]=Cf(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),c=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};c.displayName=n;const l=r+"CollectionSlot",d=dh(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=Bo(r,i(l,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=l;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=dh(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,c=t.useRef(null),l=Bo(n,c),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(c,{ref:c,...o}),()=>{d.itemMap.delete(c)})),e.jsx(m,{[p]:"",ref:l,children:s})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var hh=a.createContext(void 0);function gh(e){const t=a.useContext(hh);return e||t||"ltr"}var bh="rovingFocusGroup.onEntryFocus",yh={bubbles:!1,cancelable:!0},vh="RovingFocusGroup",[xh,wh,Sh]=mh(vh),[kh,jh]=Cf(vh,[Sh]),[Eh,Ah]=kh(vh),Nh=a.forwardRef((t,r)=>e.jsx(xh.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(xh.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Ch,{...t,ref:r})})}));Nh.displayName=vh;var Ch=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Bo(r,m),g=gh(i),[b,y]=If({prop:c,defaultProp:l??null,onChange:d,caller:vh}),[v,x]=a.useState(!1),w=Ju(u),S=wh(n),k=a.useRef(!1),[j,E]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(bh,w),()=>e.removeEventListener(bh,w)},[w]),e.jsx(Eh,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>y(e),[y]),onItemShiftTab:a.useCallback(()=>x(!0),[]),onFocusableItemAdd:a.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>E(e=>e-1),[]),children:e.jsx(Ff.div,{tabIndex:v||0===j?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:Nf(t.onMouseDown,()=>{k.current=!0}),onFocus:Nf(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(bh,yh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Ph([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Nf(t.onBlur,()=>x(!1))})})}),_h="RovingFocusGroupItem",Th=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:c,...l}=t,d=Pf(),u=i||d,f=Ah(_h,n),p=f.currentTabStopId===u,m=wh(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(xh.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Ff.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:Nf(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:Nf(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:Nf(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Rh[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Ph(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=b}):c})})});Th.displayName=_h;var Rh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ph(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Oh=Nh,Ih=Th;function Dh(e){const[t,r]=a.useState(void 0);return Xu(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Uh(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Mh="Radio",[Fh,zh]=Cf(Mh),[Lh,$h]=Fh(Mh),Vh=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:c,value:l="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Bo(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(Lh,{scope:n,checked:o,disabled:c,children:[e.jsx(Ff.button,{type:"button",role:"radio","aria-checked":o,"data-state":Hh(o),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:Nf(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(Gh,{control:p,bubbles:!g.current,name:s,value:l,checked:o,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});Vh.displayName=Mh;var Wh="RadioIndicator",Bh=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=$h(Wh,n);return e.jsx(ap,{present:a||o.checked,children:e.jsx(Ff.span,{"data-state":Hh(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});Bh.displayName=Wh;var Gh=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const c=a.useRef(null),l=Bo(c,i),d=Uh(n),u=Dh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Ff.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Hh(e){return e?"checked":"unchecked"}Gh.displayName="RadioBubbleInput";var Kh=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Zh="RadioGroup",[qh]=Cf(Zh,[jh,zh]),Jh=jh(),Yh=zh(),[Xh,Qh]=qh(Zh),eg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=Jh(n),h=gh(d),[g,b]=If({prop:o,defaultProp:s??null,onChange:f,caller:Zh});return e.jsx(Xh,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:b,children:e.jsx(Oh,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(Ff.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});eg.displayName=Zh;var tg="RadioGroupItem",rg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=Qh(tg,n),c=i.disabled||s,l=Jh(n),d=Yh(n),u=a.useRef(null),f=Bo(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{Kh.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(Ih,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(Vh,{disabled:c,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:Nf(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Nf(o.onFocus,()=>{m.current&&u.current?.click()})})})});rg.displayName=tg;var ng=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=Yh(n);return e.jsx(Bh,{...s,...a,ref:r})});ng.displayName="RadioGroupIndicator";var ag=eg,sg=rg,og=ng;const ig=a.forwardRef(({className:t,...r},n)=>e.jsx(ag,{className:ke("grid gap-2",t),...r,ref:n}));ig.displayName=ag.displayName;const cg=a.forwardRef(({className:t,...r},n)=>e.jsx(sg,{ref:n,className:ke("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(og,{className:"flex items-center justify-center",children:e.jsx(Ym,{className:"h-3.5 w-3.5 fill-primary"})})}));function lg(e,[t,r]){return Math.min(r,Math.max(t,e))}cg.displayName=sg.displayName;var dg="ScrollArea",[ug]=Cf(dg),[fg,pg]=ug(dg),mg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...c}=t,[l,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,y]=a.useState(null),[v,x]=a.useState(0),[w,S]=a.useState(0),[k,j]=a.useState(!1),[E,A]=a.useState(!1),N=Bo(r,e=>d(e)),C=gh(o);return e.jsx(fg,{scope:n,type:s,dir:C,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:A,onCornerWidthChange:x,onCornerHeightChange:S,children:e.jsx(Ff.div,{dir:C,...c,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});mg.displayName=dg;var hg="ScrollAreaViewport",gg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,c=pg(hg,n),l=Bo(r,a.useRef(null),c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Ff.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});gg.displayName=hg;var bg="ScrollAreaScrollbar",yg=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=pg(bg,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:c}=o,l="horizontal"===t.orientation;return a.useEffect(()=>(l?i(!0):c(!0),()=>{l?i(!1):c(!1)}),[l,i,c]),"hover"===o.type?e.jsx(vg,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(xg,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(wg,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(Sg,{...s,ref:r}):null});yg.displayName=bg;var vg=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=pg(bg,t.__scopeScrollArea),[i,c]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(ap,{present:n||i,children:e.jsx(wg,{"data-state":i?"visible":"hidden",...s,ref:r})})}),xg=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=pg(bg,t.__scopeScrollArea),i="horizontal"===t.orientation,c=$g(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,c]),e.jsx(ap,{present:n||"hidden"!==l,children:e.jsx(Sg,{"data-state":"hidden"===l?"hidden":"visible",...s,ref:r,onPointerEnter:Nf(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Nf(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),wg=a.forwardRef((t,r)=>{const n=pg(bg,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=$g(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return Vg(n.viewport,d),Vg(n.content,d),e.jsx(ap,{present:s||i,children:e.jsx(Sg,{"data-state":i?"visible":"hidden",...o,ref:r})})}),Sg=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=pg(bg,t.__scopeScrollArea),i=a.useRef(null),c=a.useRef(0),[l,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Dg(l.viewport,l.content),f={...s,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Ug(r),s=a/2,o=t||s,i=a-o,c=r.scrollbar.paddingStart+o,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Fg([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(kg,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Mg(o.viewport.scrollLeft,l,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(jg,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Mg(o.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),kg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=pg(bg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Bo(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(Ng,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ug(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),zg(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Ig(c.paddingLeft),paddingEnd:Ig(c.paddingRight)}})}})}),jg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=pg(bg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Bo(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx(Ng,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ug(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),zg(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Ig(c.paddingTop),paddingEnd:Ig(c.paddingBottom)}})}})}),[Eg,Ag]=ug(bg),Ng=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=pg(bg,n),[g,b]=a.useState(null),y=Bo(r,e=>b(e)),v=a.useRef(null),x=a.useRef(""),w=h.viewport,S=s.content-s.viewport,k=Ju(f),j=Ju(d),E=$g(p,10);function A(e){if(v.current){const t=e.clientX-v.current.left,r=e.clientY-v.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,k]),a.useEffect(j,[s,j]),Vg(g,E),Vg(h.content,E),e.jsx(Eg,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:Ju(i),onThumbPointerUp:Ju(c),onThumbPositionChange:j,onThumbPointerDown:Ju(l),children:e.jsx(Ff.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:Nf(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),A(e)}}),onPointerMove:Nf(t.onPointerMove,A),onPointerUp:Nf(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),Cg="ScrollAreaThumb",_g=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=Ag(Cg,t.__scopeScrollArea);return e.jsx(ap,{present:n||s.hasThumb,children:e.jsx(Tg,{ref:r,...a})})}),Tg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=pg(Cg,n),c=Ag(Cg,n),{onThumbPositionChange:l}=c,d=Bo(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=$g(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Lg(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(Ff.div,{"data-state":c.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Nf(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:Nf(t.onPointerUp,c.onThumbPointerUp)})});_g.displayName=Cg;var Rg="ScrollAreaCorner",Pg=a.forwardRef((t,r)=>{const n=pg(Rg,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Og,{...t,ref:r}):null});Pg.displayName=Rg;var Og=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=pg(Rg,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return Vg(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),Vg(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),c(e)}),u?e.jsx(Ff.div,{...s,ref:r,style:{width:i,height:l,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function Ig(e){return e?parseInt(e,10):0}function Dg(e,t){const r=e/t;return isNaN(r)?0:r}function Ug(e){const t=Dg(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Mg(e,t,r="ltr"){const n=Ug(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,c=lg(e,"ltr"===r?[0,o]:[-1*o,0]);return Fg([0,o],[0,i])(c)}function Fg(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function zg(e,t){return e>0&&e<t}var Lg=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function $g(e,t){const r=Ju(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Vg(e,t){const r=Ju(t);Xu(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var Wg=mg,Bg=gg,Gg=Pg;const Hg=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Wg,{ref:a,className:ke("relative overflow-hidden",t),...n,children:[e.jsx(Bg,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Kg,{}),e.jsx(Gg,{})]}));Hg.displayName=Wg.displayName;const Kg=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(yg,{ref:a,orientation:r,className:ke("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(_g,{className:ke("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));Kg.displayName=yg.displayName;var Zg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Zo(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),qg="horizontal",Jg=["horizontal","vertical"],Yg=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=qg,...s}=t,o=function(e){return Jg.includes(e)}(a)?a:qg,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(Zg.div,{"data-orientation":o,...i,...s,ref:r})});Yg.displayName="Separator";var Xg=Yg;const Qg=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(Xg,{ref:s,decorative:n,orientation:r,className:ke("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));Qg.displayName=Xg.displayName;var eb=Symbol("radix.slottable");var tb="AlertDialog",[rb]=Cf(tb,[cm]),nb=cm(),ab=t=>{const{__scopeAlertDialog:r,...n}=t,a=nb(r);return e.jsx(zm,{...a,...n,modal:!0})};ab.displayName=tb;var sb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=nb(n);return e.jsx(Lm,{...s,...a,ref:r})});sb.displayName="AlertDialogTrigger";var ob=t=>{const{__scopeAlertDialog:r,...n}=t,a=nb(r);return e.jsx($m,{...a,...n})};ob.displayName="AlertDialogPortal";var ib=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=nb(n);return e.jsx(Vm,{...s,...a,ref:r})});ib.displayName="AlertDialogOverlay";var cb="AlertDialogContent",[lb,db]=rb(cb),ub=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=eb,r}("AlertDialogContent"),fb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=nb(n),c=a.useRef(null),l=Bo(r,c),d=a.useRef(null);return e.jsx(Dm,{contentName:cb,titleName:pb,docsSlug:"alert-dialog",children:e.jsx(lb,{scope:n,cancelRef:d,children:e.jsxs(Wm,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:Nf(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(ub,{children:s}),e.jsx(xb,{contentRef:c})]})})})});fb.displayName=cb;var pb="AlertDialogTitle",mb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=nb(n);return e.jsx(Bm,{...s,...a,ref:r})});mb.displayName=pb;var hb="AlertDialogDescription",gb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=nb(n);return e.jsx(Gm,{...s,...a,ref:r})});gb.displayName=hb;var bb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=nb(n);return e.jsx(Hm,{...s,...a,ref:r})});bb.displayName="AlertDialogAction";var yb="AlertDialogCancel",vb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=db(yb,n),o=nb(n),i=Bo(r,s);return e.jsx(Hm,{...o,...a,ref:i})});vb.displayName=yb;var xb=({contentRef:e})=>{const t=`\`${cb}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${cb}\` by passing a \`${hb}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${cb}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},wb=ib,Sb=fb,kb=bb,jb=vb,Eb=mb,Ab=gb;const Nb=ab,Cb=sb,_b=ob,Tb=a.forwardRef(({className:t,...r},n)=>e.jsx(wb,{className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));Tb.displayName=wb.displayName;const Rb=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(Jt);return e.jsxs(_b,{container:s,children:[e.jsx(Tb,{}),e.jsx(Sb,{ref:n,className:ke("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Rb.displayName=Sb.displayName;const Pb=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col space-y-2 text-center sm:text-left",t),...r});Pb.displayName="AlertDialogHeader";const Ob=({className:t,...r})=>e.jsx("div",{className:ke("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Ob.displayName="AlertDialogFooter";const Ib=a.forwardRef(({className:t,...r},n)=>e.jsx(Eb,{ref:n,className:ke("text-lg font-semibold",t),...r}));Ib.displayName=Eb.displayName;const Db=a.forwardRef(({className:t,...r},n)=>e.jsx(Ab,{ref:n,className:ke("text-sm text-muted-foreground",t),...r}));Db.displayName=Ab.displayName;const Ub=a.forwardRef(({className:t,...r},n)=>e.jsx(kb,{ref:n,className:ke(Ri(),t),...r}));Ub.displayName=kb.displayName;const Mb=a.forwardRef(({className:t,...r},n)=>e.jsx(jb,{ref:n,className:ke(Ri({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Fb(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(qi,{className:"h-10 w-full"}),e.jsx(qi,{className:"h-10 w-full"}),e.jsx(qi,{className:"h-10 w-full"})]})}Mb.displayName=jb.displayName;const zb=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=tr(),o=Bt(e=>e.auth.session?.user||null);if(!r)return e.jsx(Fb,{});const i=Ut(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs(Nb,{children:[e.jsx(Cb,{asChild:!0,children:e.jsxs(Pi,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Rb,{children:[e.jsxs(Pb,{children:[e.jsx(Ib,{children:"Are you absolutely sure?"}),e.jsxs(Db,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Ob,{children:[e.jsx(Mb,{disabled:n,children:"Cancel"}),e.jsx(Ub,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){Ie(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(vi,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Lb="Switch",[$b]=Cf(Lb),[Vb,Wb]=$b(Lb),Bb=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:c,disabled:l,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Bo(r,e=>h(e)),b=a.useRef(!1),y=!m||(f||!!m.closest("form")),[v,x]=If({prop:o,defaultProp:i??!1,onChange:u,caller:Lb});return e.jsxs(Vb,{scope:n,checked:v,disabled:l,children:[e.jsx(Ff.button,{type:"button",role:"switch","aria-checked":v,"aria-required":c,"data-state":Zb(v),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:Nf(t.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&e.jsx(Kb,{control:m,bubbles:!b.current,name:s,value:d,checked:v,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Bb.displayName=Lb;var Gb="SwitchThumb",Hb=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=Wb(Gb,n);return e.jsx(Ff.span,{"data-state":Zb(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});Hb.displayName=Gb;var Kb=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const c=a.useRef(null),l=Bo(c,i),d=Uh(n),u=Dh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Zb(e){return e?"checked":"unchecked"}Kb.displayName="SwitchBubbleInput";var qb=Bb,Jb=Hb;const Yb=a.forwardRef(({className:t,...r},n)=>e.jsx(qb,{className:ke("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(Jb,{className:ke("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Yb.displayName=qb.displayName;const Xb=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),{allFeatures:i,updateFeature:c,getWorkspace:l}=tr(),[d,u]=t.useState(null),f=Bt(e=>e.auth.session?.user||null);if(t.useEffect(()=>{l(r).then(u)},[r]),!d)return e.jsx(Fb,{});const p=Dt(d,f?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!i.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),i.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:i.map(t=>{const r=d?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],l=n[t.slug],f=!0===l?"Enabling":!1===l?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(vi,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):e.jsx(Yb,{disabled:!p,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(d){a(r=>({...r,[e]:t})),o(null);try{const r=await c(d._id,e,t);u(r);const n=i.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{o(null)},5e3)}catch(t){Ie(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:d._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})};function Qb(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const ey=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],ty=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,c]=t.useState(),[l,d]=t.useState(null),{updateWorkspace:u}=tr(),f=Bt(e=>e.auth.session?.user||null),p=Pn({resolver:$o(Zc({name:wc().min(2,{message:"Workspace name must be at least 2 characters."}),image:wc().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Fb,{});const m=Dt(r,f?.id??null);return e.jsxs("div",{children:[l&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:l})]}),!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Fi,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){a(!0),d(null);try{await u(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){Ie(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Li,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Wi,{children:[e.jsx(Bi,{children:"Name"}),e.jsx(Gi,{children:e.jsx(Zi,{placeholder:"My Awesome Workspace",...t,disabled:!m})}),e.jsx(Ki,{})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Mi,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Hi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(ig,{value:s,disabled:!m,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(cg,{value:"emoji",id:"emoji"}),e.jsxs(Mi,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(ji,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(cg,{value:"url",id:"url"}),e.jsxs(Mi,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(yi,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&p.watch("image")?.trim()&&e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview"})]})]}),m&&e.jsx(Hg,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:ey.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",Qb(e))})(t),disabled:!m,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Li,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Wi,{children:[e.jsx(Bi,{children:"Image URL"}),e.jsx(Gi,{children:e.jsx(Zi,{placeholder:"https://example.com/image.png",...t,disabled:!m})}),e.jsx(Hi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Ki,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:m&&e.jsx(Pi,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var ry=.999,ny=/[\\\/_+.#"@\[\(\{&]/,ay=/[\\\/_+.#"@\[\(\{&]/g,sy=/[\s-]/,oy=/[\s-]/g;function iy(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var c,l,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(c=iy(e,t,r,n,p+1,s+1,o))>m&&(p===a?c*=1:ny.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(ay))&&a>0&&(c*=Math.pow(ry,d.length))):sy.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(oy))&&a>0&&(c*=Math.pow(ry,u.length))):(c*=.17,a>0&&(c*=Math.pow(ry,p-a))),e.charAt(p)!==t.charAt(s)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(l=iy(e,t,r,n,p+1,s+2,o))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return o[i]=m,m}function cy(e){return e.toLowerCase().replace(oy," ")}function ly(e,t,r){return iy(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,cy(e),cy(t),0,0,{})}var dy='[cmdk-group=""]',uy='[cmdk-group-items=""]',fy='[cmdk-item=""]',py=`${fy}:not([aria-disabled="true"])`,my="cmdk-item-select",hy="data-value",gy=(e,t,r)=>ly(e,t,r),by=a.createContext(void 0),yy=()=>a.useContext(by),vy=a.createContext(void 0),xy=()=>a.useContext(vy),wy=a.createContext(void 0),Sy=a.forwardRef((e,t)=>{let r=Uy(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Uy(()=>new Set),s=Uy(()=>new Map),o=Uy(()=>new Map),i=Uy(()=>new Set),c=Iy(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,v=Pf(),x=Pf(),w=Pf(),S=a.useRef(null),k=zy();Dy(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),Dy(()=>{k(6,T)},[]);let j=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),N(),k(1,C);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(v))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,j.emit()}),n||k(5,T),void 0!==(null==(s=c.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=c.current).onValueChange)||i.call(o,e))}}j.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),E=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,A(t,n)),k(2,()=>{N(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{_(),N(),r.current.value||C(),j.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&C(),j.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:v,inputId:w,labelId:x,listInnerRef:S}),[]);function A(e,t){var n,a;let s=null!=(a=null==(n=c.current)?void 0:n.filter)?a:gy;return e?s(e,r.current.search,t):0}function N(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(uy);t?t.appendChild(e.parentElement===t?e:e.closest(`${uy} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${uy} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${dy}[${hy}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function C(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(hy);j.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let l=0;for(let s of n.current){let n=A(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&l++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(dy))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${fy}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(py))||[])}function O(e){let t=P()[e];t&&j.setState("value",t.getAttribute(hy))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=c.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&j.setState("value",s.getAttribute(hy))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(dy);for(;n&&!t;)n=e>0?Py(n,dy):Oy(n,dy),t=null==n?void 0:n.querySelector(py);t?j.setState("value",t.getAttribute(hy)):I(e)}let U=()=>O(P().length-1),M=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},F=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Ff.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":b&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(my);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:$y},l),Ly(e,e=>a.createElement(vy.Provider,{value:j},a.createElement(by.Provider,{value:E},e))))}),ky=a.forwardRef((e,t)=>{var r,n;let s=Pf(),o=a.useRef(null),i=a.useContext(wy),c=yy(),l=Iy(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;Dy(()=>{if(!d)return c.item(s,null==i?void 0:i.id)},[d]);let u=Fy(s,o,[e.value,e.children,o],e.keywords),f=xy(),p=My(e=>e.value&&e.value===u.current),m=My(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(s)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(my,h),()=>t.removeEventListener(my,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:v,forceMount:x,keywords:w,...S}=e;return a.createElement(Ff.div,{ref:Wo(o,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||c.getDisablePointerSelection()?void 0:g,onClick:b?void 0:h},e.children)}),jy=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Pf(),c=a.useRef(null),l=a.useRef(null),d=Pf(),u=yy(),f=My(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));Dy(()=>u.group(i),[]),Fy(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Ff.div,{ref:Wo(c,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Ly(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(wy.Provider,{value:p},e))))}),Ey=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=My(e=>!e.search);return r||o?a.createElement(Ff.div,{ref:Wo(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Ay=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=xy(),i=My(e=>e.search),c=My(e=>e.selectedItemId),l=yy();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Ff.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),Ny=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),c=My(e=>e.selectedItemId),l=yy();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Ff.div,{ref:Wo(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},Ly(e,e=>a.createElement("div",{ref:Wo(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),Cy=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...c}=e;return a.createElement(zm,{open:r,onOpenChange:n},a.createElement($m,{container:i},a.createElement(Vm,{"cmdk-overlay":"",className:s}),a.createElement(Wm,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(Sy,{ref:t,...c}))))}),_y=a.forwardRef((e,t)=>My(e=>0===e.filtered.count)?a.createElement(Ff.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Ty=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Ff.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Ly(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Ry=Object.assign(Sy,{List:Ny,Item:ky,Input:Ay,Group:jy,Separator:Ey,Dialog:Cy,Empty:_y,Loading:Ty});function Py(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function Oy(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function Iy(e){let t=a.useRef(e);return Dy(()=>{t.current=e}),t}var Dy="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function Uy(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function My(e){let t=xy(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function Fy(e,t,r,n=[]){let s=a.useRef(),o=yy();return Dy(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),c=n.map(e=>e.trim());o.value(e,i,c),null==(a=t.current)||a.setAttribute(hy,i),s.current=i}),s}var zy=()=>{let[e,t]=a.useState(),r=Uy(()=>new Map);return Dy(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function Ly({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var $y={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Vy=a.forwardRef(({className:t,...r},n)=>e.jsx(Ry,{ref:n,className:ke("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Vy.displayName=Ry.displayName;const Wy=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(th,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Ry.Input,{ref:n,className:ke("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));Wy.displayName=Ry.Input.displayName;const By=a.forwardRef(({className:t,...r},n)=>e.jsx(Ry.List,{ref:n,className:ke("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));By.displayName=Ry.List.displayName;a.forwardRef((t,r)=>e.jsx(Ry.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Ry.Empty.displayName;const Gy=a.forwardRef(({className:t,...r},n)=>e.jsx(Ry.Group,{ref:n,className:ke("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));Gy.displayName=Ry.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Ry.Separator,{ref:n,className:ke("-mx-1 h-px bg-border",t),...r})).displayName=Ry.Separator.displayName;const Hy=a.forwardRef(({className:t,...r},n)=>e.jsx(Ry.Item,{ref:n,className:ke("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));Hy.displayName=Ry.Item.displayName;const Ky=["top","right","bottom","left"],Zy=Math.min,qy=Math.max,Jy=Math.round,Yy=Math.floor,Xy=e=>({x:e,y:e}),Qy={left:"right",right:"left",bottom:"top",top:"bottom"},ev={start:"end",end:"start"};function tv(e,t,r){return qy(e,Zy(t,r))}function rv(e,t){return"function"==typeof e?e(t):e}function nv(e){return e.split("-")[0]}function av(e){return e.split("-")[1]}function sv(e){return"x"===e?"y":"x"}function ov(e){return"y"===e?"height":"width"}const iv=new Set(["top","bottom"]);function cv(e){return iv.has(nv(e))?"y":"x"}function lv(e){return sv(cv(e))}function dv(e){return e.replace(/start|end/g,e=>ev[e])}const uv=["left","right"],fv=["right","left"],pv=["top","bottom"],mv=["bottom","top"];function hv(e,t,r,n){const a=av(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?fv:uv:t?uv:fv;case"left":case"right":return t?pv:mv;default:return[]}}(nv(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(dv)))),s}function gv(e){return e.replace(/left|right|bottom|top/g,e=>Qy[e])}function bv(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function yv(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function vv(e,t,r){let{reference:n,floating:a}=e;const s=cv(t),o=lv(t),i=ov(o),c=nv(t),l="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(av(t)){case"start":p[o]-=f*(r&&l?-1:1);break;case"end":p[o]+=f*(r&&l?-1:1)}return p}async function xv(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=rv(t,e),m=bv(p),h=i[f?"floating"===u?"reference":"floating":u],g=yv(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:l,rootBoundary:d,strategy:c})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),v=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},x=yv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:y,strategy:c}):b);return{top:(g.top-x.top+m.top)/v.y,bottom:(x.bottom-g.bottom+m.bottom)/v.y,left:(g.left-x.left+m.left)/v.x,right:(x.right-g.right+m.right)/v.x}}function wv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sv(e){return Ky.some(t=>e[t]>=0)}const kv=new Set(["left","top"]);function jv(){return"undefined"!=typeof window}function Ev(e){return Cv(e)?(e.nodeName||"").toLowerCase():"#document"}function Av(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Nv(e){var t;return null==(t=(Cv(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Cv(e){return!!jv()&&(e instanceof Node||e instanceof Av(e).Node)}function _v(e){return!!jv()&&(e instanceof Element||e instanceof Av(e).Element)}function Tv(e){return!!jv()&&(e instanceof HTMLElement||e instanceof Av(e).HTMLElement)}function Rv(e){return!(!jv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Av(e).ShadowRoot)}const Pv=new Set(["inline","contents"]);function Ov(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Gv(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Pv.has(a)}const Iv=new Set(["table","td","th"]);function Dv(e){return Iv.has(Ev(e))}const Uv=[":popover-open",":modal"];function Mv(e){return Uv.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const Fv=["transform","translate","scale","rotate","perspective"],zv=["transform","translate","scale","rotate","perspective","filter"],Lv=["paint","layout","strict","content"];function $v(e){const t=Vv(),r=_v(e)?Gv(e):e;return Fv.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||zv.some(e=>(r.willChange||"").includes(e))||Lv.some(e=>(r.contain||"").includes(e))}function Vv(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const Wv=new Set(["html","body","#document"]);function Bv(e){return Wv.has(Ev(e))}function Gv(e){return Av(e).getComputedStyle(e)}function Hv(e){return _v(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kv(e){if("html"===Ev(e))return e;const t=e.assignedSlot||e.parentNode||Rv(e)&&e.host||Nv(e);return Rv(t)?t.host:t}function Zv(e){const t=Kv(e);return Bv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tv(t)&&Ov(t)?t:Zv(t)}function qv(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=Zv(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Av(a);if(s){const e=Jv(o);return t.concat(o,o.visualViewport||[],Ov(a)?a:[],e&&r?qv(e):[])}return t.concat(a,qv(a,[],r))}function Jv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yv(e){const t=Gv(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Tv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=Jy(r)!==s||Jy(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function Xv(e){return _v(e)?e:e.contextElement}function Qv(e){const t=Xv(e);if(!Tv(t))return Xy(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=Yv(t);let o=(s?Jy(r.width):r.width)/n,i=(s?Jy(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const ex=Xy(0);function tx(e){const t=Av(e);return Vv()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ex}function rx(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=Xv(e);let o=Xy(1);t&&(n?_v(n)&&(o=Qv(n)):o=Qv(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Av(e))&&t}(s,r,n)?tx(s):Xy(0);let c=(a.left+i.x)/o.x,l=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Av(s),t=n&&_v(n)?Av(n):n;let r=e,a=Jv(r);for(;a&&n&&t!==r;){const e=Qv(a),t=a.getBoundingClientRect(),n=Gv(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=s,l+=o,r=Av(a),a=Jv(r)}}return yv({width:d,height:u,x:c,y:l})}function nx(e,t){const r=Hv(e).scrollLeft;return t?t.left+r:rx(Nv(e)).left+r}function ax(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-nx(e,r),y:r.top+t.scrollTop}}const sx=new Set(["absolute","fixed"]);function ox(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Av(e),n=Nv(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,c=0;if(a){s=a.width,o=a.height;const e=Vv();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=nx(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else l<=25&&(s+=l);return{width:s,height:o,x:i,y:c}}(e,r);else if("document"===t)n=function(e){const t=Nv(e),r=Hv(e),n=e.ownerDocument.body,a=qy(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=qy(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+nx(e);const i=-r.scrollTop;return"rtl"===Gv(n).direction&&(o+=qy(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(Nv(e));else if(_v(t))n=function(e,t){const r=rx(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Tv(e)?Qv(e):Xy(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=tx(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return yv(n)}function ix(e,t){const r=Kv(e);return!(r===t||!_v(r)||Bv(r))&&("fixed"===Gv(r).position||ix(r,t))}function cx(e,t,r){const n=Tv(t),a=Nv(t),s="fixed"===r,o=rx(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const c=Xy(0);function l(){c.x=nx(a)}if(n||!n&&!s)if(("body"!==Ev(t)||Ov(a))&&(i=Hv(t)),n){const e=rx(t,!0,s,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();s&&!n&&a&&l();const d=!a||n||s?Xy(0):ax(a,i);return{x:o.left+i.scrollLeft-c.x-d.x,y:o.top+i.scrollTop-c.y-d.y,width:o.width,height:o.height}}function lx(e){return"static"===Gv(e).position}function dx(e,t){if(!Tv(e)||"fixed"===Gv(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Nv(e)===r&&(r=r.ownerDocument.body),r}function ux(e,t){const r=Av(e);if(Mv(e))return r;if(!Tv(e)){let t=Kv(e);for(;t&&!Bv(t);){if(_v(t)&&!lx(t))return t;t=Kv(t)}return r}let n=dx(e,t);for(;n&&Dv(n)&&lx(n);)n=dx(n,t);return n&&Bv(n)&&lx(n)&&!$v(n)?r:n||function(e){let t=Kv(e);for(;Tv(t)&&!Bv(t);){if($v(t))return t;if(Mv(t))return null;t=Kv(t)}return null}(e)||r}const fx={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=Nv(n),i=!!t&&Mv(t.floating);if(n===o||i&&s)return r;let c={scrollLeft:0,scrollTop:0},l=Xy(1);const d=Xy(0),u=Tv(n);if((u||!u&&!s)&&(("body"!==Ev(n)||Ov(o))&&(c=Hv(n)),Tv(n))){const e=rx(n);l=Qv(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?Xy(0):ax(o,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Nv,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?Mv(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=qv(e,[],!1).filter(e=>_v(e)&&"body"!==Ev(e)),a=null;const s="fixed"===Gv(e).position;let o=s?Kv(e):e;for(;_v(o)&&!Bv(o);){const t=Gv(o),r=$v(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&sx.has(a.position)||Ov(o)&&!r&&ix(e,o))?n=n.filter(e=>e!==o):a=t,o=Kv(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],c=o.reduce((e,r)=>{const n=ox(t,r,a);return e.top=qy(n.top,e.top),e.right=Zy(n.right,e.right),e.bottom=Zy(n.bottom,e.bottom),e.left=qy(n.left,e.left),e},ox(t,i,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:ux,getElementRects:async function(e){const t=this.getOffsetParent||ux,r=this.getDimensions,n=await r(e.floating);return{reference:cx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=Yv(e);return{width:t,height:r}},getScale:Qv,isElement:_v,isRTL:function(e){return"rtl"===Gv(e).direction}};function px(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mx(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=Xv(e),d=a||s?[...l?qv(l):[],...qv(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=l&&i?function(e,t){let r,n=null;const a=Nv(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,c){void 0===i&&(i=!1),void 0===c&&(c=1),s();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(i||t(),!f||!p)return;const m={rootMargin:-Yy(u)+"px "+-Yy(a.clientWidth-(d+f))+"px "+-Yy(a.clientHeight-(u+p))+"px "+-Yy(d)+"px",threshold:qy(0,Zy(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||px(l,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(l,r):null;let f,p=-1,m=null;o&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?rx(e):null;return c&&function t(){const n=rx(e);h&&!px(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const hx=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=nv(r),i=av(r),c="y"===cv(r),l=kv.has(o)?-1:1,d=s&&c?-1:1,u=rv(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:o}}}}},gx=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:i={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=rv(e,t),l={x:r,y:n},d=await xv(t,c),u=cv(nv(a)),f=sv(u);let p=l[f],m=l[u];if(s){const e="y"===f?"bottom":"right";p=tv(p+d["y"===f?"top":"left"],p,p-d[e])}if(o){const e="y"===u?"bottom":"right";m=tv(m+d["y"===u?"top":"left"],m,m-d[e])}const h=i.fn({...t,[f]:p,[u]:m});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[f]:s,[u]:o}}}}}},bx=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=rv(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=nv(a),y=cv(i),v=nv(i)===i,x=await(null==c.isRTL?void 0:c.isRTL(l.floating)),w=f||(v||!h?[gv(i)]:function(e){const t=gv(e);return[dv(e),t,dv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...hv(i,h,m,x));const k=[i,...w],j=await xv(t,g),E=[];let A=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&E.push(j[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=av(e),a=lv(e),s=ov(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=gv(o)),[o,gv(o)]}(a,o,x);E.push(j[e[0]],j[e[1]])}if(A=[...A,{placement:a,overflows:E}],!E.every(e=>e<=0)){var N,C;const e=((null==(N=s.flip)?void 0:N.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==cv(t))||A.every(e=>cv(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:A},reset:{placement:t}}}let r=null==(C=A.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:C.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=A.filter(e=>{if(S){const t=cv(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},yx=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:c=()=>{},...l}=rv(e,t),d=await xv(t,l),u=nv(a),f=av(a),p="y"===cv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,v=m-d.left-d.right,x=Zy(h-d[g],y),w=Zy(m-d[b],v),S=!t.middlewareData.shift;let k=x,j=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(j=v),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=qy(d.left,0),t=qy(d.right,0),r=qy(d.top,0),n=qy(d.bottom,0);p?j=m-2*(0!==e||0!==t?e+t:qy(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:qy(d.top,d.bottom))}await c({...t,availableWidth:j,availableHeight:k});const E=await o.getDimensions(i.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},vx=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=rv(e,t);switch(n){case"referenceHidden":{const e=wv(await xv(t,{...a,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Sv(e)}}}case"escaped":{const e=wv(await xv(t,{...a,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Sv(e)}}}default:return{}}}}},xx=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:c}=t,{element:l,padding:d=0}=rv(e,t)||{};if(null==l)return{};const u=bv(d),f={x:r,y:n},p=lv(a),m=ov(p),h=await o.getDimensions(l),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",x=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(l));let k=S?S[v]:0;k&&await(null==o.isElement?void 0:o.isElement(S))||(k=i.floating[v]||s.floating[m]);const j=x/2-w/2,E=k/2-h[m]/2-1,A=Zy(u[b],E),N=Zy(u[y],E),C=A,_=k-h[m]-N,T=k/2-h[m]/2+j,R=tv(C,T,_),P=!c.arrow&&null!=av(a)&&T!==R&&s.reference[m]/2-(T<C?A:N)-h[m]/2<0,O=P?T<C?T-C:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),wx=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:c=!0,crossAxis:l=!0}=rv(e,t),d={x:r,y:n},u=cv(a),f=sv(u);let p=d[f],m=d[u];const h=rv(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var b,y;const e="y"===f?"width":"height",t=kv.has(nv(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Sx=(e,t,r)=>{const n=new Map,a={platform:fx,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),c=await(null==o.isRTL?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=vv(l,n,c),f=n,p={},m=0;for(let r=0;r<i.length;r++){const{name:s,fn:h}=i[r],{x:g,y:b,data:y,reset:v}=await h({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});d=null!=g?g:d,u=null!=b?b:u,p={...p,[s]:{...p[s],...y}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(l=!0===v.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):v.rects),({x:d,y:u}=vv(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var kx="undefined"!=typeof document?t.useLayoutEffect:function(){};function jx(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!jx(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!jx(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Ex(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ax(e,t){const r=Ex(e);return Math.round(t*r)/r}function Nx(e){const t=a.useRef(e);return kx(()=>{t.current=e}),t}const Cx=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?xx({element:r.current,padding:n}).fn(t):{}:r?xx({element:r,padding:n}).fn(t):{};var a}}),_x=(e,t)=>({...hx(e),options:[e,t]}),Tx=(e,t)=>({...gx(e),options:[e,t]}),Rx=(e,t)=>({...wx(e),options:[e,t]}),Px=(e,t)=>({...bx(e),options:[e,t]}),Ox=(e,t)=>({...yx(e),options:[e,t]}),Ix=(e,t)=>({...vx(e),options:[e,t]}),Dx=(e,t)=>({...Cx(e),options:[e,t]});var Ux=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Ff.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ux.displayName="Arrow";var Mx=Ux,Fx="Popper",[zx,Lx]=Cf(Fx),[$x,Vx]=zx(Fx),Wx=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx($x,{scope:r,anchor:s,onAnchorChange:o,children:n})};Wx.displayName=Fx;var Bx="PopperAnchor",Gx=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=Vx(Bx,n),c=a.useRef(null),l=Bo(r,c),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||c.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Ff.div,{...o,ref:l})});Gx.displayName=Bx;var Hx="PopperContent",[Kx,Zx]=zx(Hx),qx=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:c="center",alignOffset:l=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,v=Vx(Hx,n),[x,w]=a.useState(null),S=Bo(r,e=>w(e)),[k,j]=a.useState(null),E=Dh(k),A=E?.width??0,N=E?.height??0,C=o+("center"!==c?"-"+c:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(Qx),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:M}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:c}={},transform:l=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);jx(m,n)||h(n);const[g,b]=a.useState(null),[y,v]=a.useState(null),x=a.useCallback(e=>{e!==j.current&&(j.current=e,b(e))},[]),w=a.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),S=i||g,k=c||y,j=a.useRef(null),E=a.useRef(null),A=a.useRef(f),N=null!=d,C=Nx(d),_=Nx(o),T=Nx(u),R=a.useCallback(()=>{if(!j.current||!E.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),Sx(j.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!jx(A.current,t)&&(A.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);kx(()=>{!1===u&&A.current.isPositioned&&(A.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);kx(()=>(P.current=!0,()=>{P.current=!1}),[]),kx(()=>{if(S&&(j.current=S),k&&(E.current=k),S&&k){if(C.current)return C.current(S,k,R);R()}},[S,k,R,C,N]);const O=a.useMemo(()=>({reference:j,floating:E,setReference:x,setFloating:w}),[x,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Ax(I.floating,f.x),n=Ax(I.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Ex(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:C,whileElementsMounted:(...e)=>mx(...e,{animationFrame:"always"===g}),elements:{reference:v.anchor},middleware:[_x({mainAxis:i+N,alignmentAxis:l}),u&&Tx({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Rx():void 0,...P}),u&&Px({...P}),Ox({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),k&&Dx({element:k,padding:d}),ew({arrowWidth:A,arrowHeight:N}),h&&Ix({strategy:"referenceHidden",...P})]}),[F,z]=tw(D),L=Ju(b);Xu(()=>{U&&L?.()},[U,L]);const $=M.arrow?.x,V=M.arrow?.y,W=0!==M.arrow?.centerOffset,[B,G]=a.useState();return Xu(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(" "),...M.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(Kx,{scope:n,placedSide:F,onArrowChange:j,arrowX:$,arrowY:V,shouldHideArrow:W,children:e.jsx(Ff.div,{"data-side":F,"data-align":z,...y,ref:S,style:{...y.style,animation:U?void 0:"none"}})})})});qx.displayName=Hx;var Jx="PopperArrow",Yx={top:"bottom",right:"left",bottom:"top",left:"right"},Xx=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=Zx(Jx,n),o=Yx[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(Mx,{...a,ref:r,style:{...a.style,display:"block"}})})});function Qx(e){return null!==e}Xx.displayName=Jx;var ew=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[c,l]=tw(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===c?(p=s?d:`${u}px`,m=-i+"px"):"top"===c?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===c?(p=-i+"px",m=s?d:`${f}px`):"left"===c&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function tw(e){const[t,r="center"]=e.split("-");return[t,r]}var rw=Wx,nw=Gx,aw=qx,sw=Xx;function ow(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var iw=Symbol("radix.slottable");function cw(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===iw}var lw="Popover",[dw]=Cf(lw,[Lx]),uw=Lx(),[fw,pw]=dw(lw),mw=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!1}=t,l=uw(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=If({prop:s,defaultProp:o??!1,onChange:i,caller:lw});return e.jsx(rw,{...l,children:e.jsx(fw,{scope:r,contentId:Pf(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:c,children:n})})};mw.displayName=lw;var hw="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=pw(hw,n),i=uw(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=o;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx(nw,{...i,...s,ref:r})}).displayName=hw;var gw="PopoverTrigger",bw=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=pw(gw,n),o=uw(n),i=Bo(r,s.triggerRef),c=e.jsx(Ff.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":_w(s.open),...a,ref:i,onClick:Nf(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:e.jsx(nw,{asChild:!0,...o,children:c})});bw.displayName=gw;var yw="PopoverPortal",[vw,xw]=dw(yw,{forceMount:void 0}),ww=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=pw(yw,r);return e.jsx(vw,{scope:r,forceMount:n,children:e.jsx(ap,{present:n||o.open,children:e.jsx(np,{asChild:!0,container:s,children:a})})})};ww.displayName=yw;var Sw="PopoverContent",kw=a.forwardRef((t,r)=>{const n=xw(Sw,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=pw(Sw,t.__scopePopover);return e.jsx(ap,{present:a||o.open,children:o.modal?e.jsx(Ew,{...s,ref:r}):e.jsx(Aw,{...s,ref:r})})});kw.displayName=Sw;var jw=function(t){const r=ow(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(cw);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),Ew=a.forwardRef((t,r)=>{const n=pw(Sw,t.__scopePopover),s=a.useRef(null),o=Bo(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return rm(e)},[]),e.jsx(qp,{as:jw,allowPinchZoom:!0,children:e.jsx(Nw,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nf(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Nf(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Nf(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Aw=a.forwardRef((t,r)=>{const n=pw(Sw,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(Nw,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Nw=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=t,p=pw(Sw,n),m=uw(n);return ip(),e.jsx(Jf,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(Bf,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(aw,{"data-state":_w(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Cw="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=pw(Cw,n);return e.jsx(Ff.button,{type:"button",...a,ref:r,onClick:Nf(t.onClick,()=>s.onOpenChange(!1))})}).displayName=Cw;function _w(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=uw(n);return e.jsx(sw,{...s,...a,ref:r})}).displayName="PopoverArrow";var Tw=ww,Rw=kw;const Pw=mw,Ow=bw,Iw=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(Jt);return e.jsx(Tw,{container:i,children:e.jsx(Rw,{ref:o,align:r,sideOffset:n,className:ke("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})})});function Dw({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,c]=t.useState(n??""),[l,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&c(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(Pw,{open:l,onOpenChange:d,children:[e.jsx(Ow,{asChild:!0,children:e.jsxs(Pi,{variant:"outline",role:"combobox","aria-expanded":l,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(fi,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Iw,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(Vy,{children:[e.jsx(Wy,{placeholder:s}),e.jsx(By,{children:e.jsx(Gy,{children:r.map(t=>e.jsxs(Hy,{className:ke("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,c(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(ui,{className:ke("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}Iw.displayName=Rw.displayName;const Uw={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},Mw={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},Fw=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=Mw[e.code]||"USD",r=Uw[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function zw({value:t,onChange:r}){const n=Fw.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(Dw,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const Lw=Fw.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),$w=Array.from(new Set(Lw.map(e=>e.value))).map(e=>Lw.find(t=>t.value===e)).filter(e=>void 0!==e);function Vw({value:t,onChange:r}){const n=$w.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(Dw,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let Ww=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];Ww=Ww.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),Ww.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const Bw=Ww.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function Gw({value:t,onChange:r}){const n=Bw.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(Dw,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const Hw=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function Kw({value:t,onChange:r}){const n=Hw.map(e=>({value:e.value,label:e.text}));return e.jsx(Dw,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const Zw=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=tr(),[s,o]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),[u,f]=t.useState(null),p=Pn({resolver:$o(Zc({name:wc().min(2,{message:"Name must be at least 2 characters."}),country:wc().optional(),timezone:wc().optional(),language:wc().optional(),currency:wc().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Fi,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),setTimeout(()=>{f(null)},5e3)}catch(e){Ie(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(Zi,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Li,{disabled:s,control:p.control,name:"name",render:({field:t})=>e.jsxs(Wi,{children:[e.jsx(Bi,{children:"Name"}),e.jsx(Gi,{children:e.jsx(Zi,{...t})}),e.jsx(Ki,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(Gw,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(zw,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(Vw,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(Kw,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(Pi,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(Pi,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Fb,{})},qw=(e,t="usd")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase(),minimumFractionDigits:2}).format(e/100),Jw=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",Yw=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},Xw=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:c}=kl(t,a),l=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(Pi,{variant:"ghost",size:"sm",progress:o,onClick:c,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(Pi,{variant:"outline",size:"sm",onClick:c,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!l?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Fb,{})}):l?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${Yw(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:qw(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Created: ",Jw(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Due: ",Jw(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",qw(t.amount_paid,t.currency)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(Pi,{size:"sm",onClick:()=>window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(gi,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(Pi,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(hi,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},t.id)})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(bi,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(Pi,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},Qw=t.lazy(()=>Promise.resolve().then(function(){return Pk}).then(e=>({default:e.default}))),eS=e=>{switch(e){case"monthly":return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly";default:return"Unknown"}},tS=e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric"}).format(t)}catch{return""}},rS=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:c}=Sl(n),{createCheckoutSession:l}=xl(n),{cancelSubscription:d,loading:u}=(e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(!1),[o,i]=t.useState(null);return{cancelSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");s(!0),i(null);try{return await n.cancelSubscriptionAtPeriodEnd(e)}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw i(r),Ie(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{s(!1)}},[n,e]),loading:a,error:o}})(n),{resumeSubscription:f,loading:p}=(e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(!1),[o,i]=t.useState(null);return{resumeSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");s(!0),i(null);try{return await n.resumeSubscription(e)}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw i(r),Ie(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{s(!1)}},[n,e]),loading:a,error:o}})(n),{versions:m,loading:h,error:g,refetch:b}=vl(n),y=s||h,v=o||g,{currentVersion:x,latestVersion:w,isDeprecated:S,whatsNew:k,plansToShow:j}=t.useMemo(()=>{const e=m?.currentVersion,t=m?.availableVersions||[],r=null!==a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[m,a?.subscription]),[E,A]=t.useState(!1),[N,C]=t.useState(null),[_,T]=t.useState(null),[R,P]=t.useState(!1),[O,I]=t.useState(!1),[D,U]=t.useState(!1),[M,F]=t.useState("subscription"),z=async()=>{await Promise.all([c(),b()])};if(y&&!a&&!m)return e.jsx(Fb,{});const L=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[v&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:v}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(Pi,{variant:"outline",size:"sm",onClick:z,disabled:y,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:y?"Retrying...":"Retry"})]}),N&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:N})]}),e.jsx(Pi,{variant:"outline",size:"sm",onClick:()=>C(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),_&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(Pi,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>F("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>F("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===M?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(vi,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),S&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Ci,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",x?.version||"N/A"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),k&&(k.newPlans.length>0||k.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[k.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:k.newPlans.map(e=>e.plan.name).join(", ")})]}),k.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:k.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(Pi,{variant:"outline",size:"sm",onClick:()=>P(!0),children:"Change Plan"}):!a?.subscription&&j&&j.length>0?e.jsx(Pi,{size:"sm",onClick:()=>P(!0),children:"View Pricing Plans"}):null,e.jsx(Pi,{variant:"ghost",size:"sm",progress:y,onClick:z,disabled:y||E,children:y?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=((e,t)=>{if(!e||!t?.stripePrices)return null;const r=t.stripePrices;return r.monthlyPriceId===e||r.monthly===e?"monthly":r.yearlyPriceId===e||r.yearly===e?"yearly":r.quarterlyPriceId===e?"quarterly":null})(a.subscription.stripePriceId,a.planVersion),r=t&&a.planVersion?.basePricing?a.planVersion.basePricing[t]:null,n=null!=r?0===r?"Free":`$${(r/100).toFixed(2)}`:null,s="monthly"===t?"/month":"quarterly"===t?"/quarter":"yearly"===t?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(S?"border-amber-300":"border-gray-200"),children:[e.jsxs("div",{className:"p-5 "+(S?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&"Active","trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&tS(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends ",tS(a.subscription.stripeCurrentPeriodEnd),")"]}),S&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(Ci,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600",children:a.plan.description})]}),e.jsxs("div",{className:"text-right ml-4",children:[e.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:n||"N/A"}),n&&"Free"!==n&&s&&e.jsx("span",{className:"text-sm text-gray-500",children:s})]}),t&&e.jsxs("span",{className:"text-xs text-gray-500 mt-1 inline-block",children:["Billed ",eS(t).toLowerCase()]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&tS(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[e.jsx(di,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:tS(a.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),S&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",x?.version||"N/A"," - A newer version is available"]}),"active"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:a.subscription.cancelAtPeriodEnd?e.jsx(Pi,{variant:"outline",size:"sm",onClick:()=>U(!0),disabled:E||u||p,progress:p,children:"Resume Subscription"}):e.jsx(Pi,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>I(!0),disabled:E||u||p,progress:u||E,children:u||E?"Canceling...":"Cancel Subscription"})})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ci,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(Pi,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>F("invoices"),children:"View Invoices"})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(di,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:tS(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:tS(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=(e=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const t=[],r=[],n=[];return e.subscriptionItems.forEach(a=>{const s=a.slug;if("feature"===a.type){const r=e.features?.[s]??!1;t.push({item:a,enabled:r})}else if("limit"===a.type){const t=e.limits?.[s]??0;r.push({item:a,value:t})}else if("quota"===a.type){const t=e.quotas?.[s]??null;null!=t&&n.push({item:a,value:t})}}),{features:t,limits:r,quotas:n}})(a.planVersion);return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"p-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-6",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),e.jsx("ul",{className:"space-y-2",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"mt-0.5 flex-shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"✓":"—"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),e.jsx("ul",{className:"space-y-2",children:t.limits.map(({item:t,value:r})=>e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]})},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-2",children:t.quotas.map(({item:t,value:r})=>{const n="object"==typeof r&&null!==r&&"included"in r?`${r.included}${r.overage?` (+${r.overage})`:""}`:String(r);return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:n})]})},t._id)})})]})]})}):null})()]})})():e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(pi,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),j&&j.length>0&&e.jsx(Pi,{size:"sm",onClick:()=>P(!0),children:"View Pricing Plans"})]})]}),!m&&!y&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),v&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",v]}),!v&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(Pi,{variant:"outline",size:"sm",progress:y,onClick:z,disabled:y,className:"mt-4",children:y?"Refreshing...":"Refresh"})]})]}),"invoices"===M&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(vi,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(Xw,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>F("subscription"),limit:20})]}),j&&j.length>0&&e.jsx(t.Suspense,{fallback:R?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(vi,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(Qw,{open:R,onOpenChange:P,planVersions:j,currentPlanVersionId:L||null,currentStripePriceId:a?.subscription?.stripePriceId,onSelectPlan:async(e,t="monthly")=>{if(!n)return;const r=j?.find(t=>t._id===e),s=r?.stripePrices?.["monthly"===t?"monthlyPriceId":"yearly"===t?"yearlyPriceId":"quarterlyPriceId"]||r?.stripePrices?.["monthly"===t?"monthly":"yearly"],o=a?.subscription?.stripePriceId;if(!s||!o||s!==o){A(!0),C(null),T(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await l({planVersionId:e,billingInterval:t,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);T("Subscription updated successfully!"),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";C(t)}finally{A(!1),setTimeout(()=>{C(null),T(null)},5e3)}}},loading:E||y})}),e.jsx(Nb,{open:D,onOpenChange:U,children:e.jsxs(Rb,{children:[e.jsxs(Pb,{children:[e.jsx(Ib,{children:"Resume Subscription"}),e.jsx(Db,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ci,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&tS(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:tS(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"•"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Ob,{children:[e.jsx(Mb,{disabled:p,children:"Keep Canceled"}),e.jsx(Ub,{onClick:async()=>{if(n){U(!1),A(!0),C(null),T(null);try{await f(),T("Subscription has been resumed."),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";C(t)}finally{A(!1),setTimeout(()=>{C(null),T(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx(Nb,{open:O,onOpenChange:I,children:e.jsxs(Rb,{children:[e.jsxs(Pb,{children:[e.jsx(Ib,{children:"Cancel Subscription"}),e.jsx(Db,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&tS(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:tS(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Ob,{children:[e.jsx(Mb,{disabled:u,children:"Keep Subscription"}),e.jsx(Ub,{onClick:async()=>{if(n){I(!1),A(!0),C(null),T(null);try{await d(),T("Subscription will be canceled at the end of the billing period."),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";C(t)}finally{A(!1),setTimeout(()=>{C(null),T(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function nS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Wo(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var aS=Symbol("radix.slottable");function sS(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aS}var oS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Ff.span,{...t,ref:r,style:{...oS,...t.style}})).displayName="VisuallyHidden";var iS=[" ","Enter","ArrowUp","ArrowDown"],cS=[" ","Enter"],lS="Select",[dS,uS,fS]=mh(lS),[pS]=Cf(lS,[fS,Lx]),mS=Lx(),[hS,gS]=pS(lS),[bS,yS]=pS(lS),vS=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:c,defaultValue:l,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=mS(r),[y,v]=a.useState(null),[x,w]=a.useState(null),[S,k]=a.useState(!1),j=gh(u),[E,A]=If({prop:s,defaultProp:o??!1,onChange:i,caller:lS}),[N,C]=If({prop:c,defaultProp:l,onChange:d,caller:lS}),_=a.useRef(null),T=!y||(g||!!y.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(rw,{...b,children:e.jsxs(hS,{required:h,scope:r,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Pf(),value:N,onValueChange:C,open:E,onOpenChange:A,dir:j,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(dS.Provider,{scope:r,children:e.jsx(bS,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(nk,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>C(e.target.value),disabled:m,form:g,children:[void 0===N?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};vS.displayName=lS;var xS="SelectTrigger",wS=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=mS(n),c=gS(xS,n),l=c.disabled||s,d=Bo(r,c.onTriggerChange),u=uS(n),f=a.useRef("touch"),[p,m,h]=sk(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=ok(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return e.jsx(nw,{asChild:!0,...i,children:e.jsx(Ff.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":ak(c.value)?"":void 0,...o,ref:d,onClick:Nf(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Nf(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:Nf(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||iS.includes(e.key)&&(g(),e.preventDefault())})})})});wS.displayName=xS;var SS="SelectValue",kS=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...c}=t,l=gS(SS,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==o,f=Bo(r,l.onValueNodeChange);return Xu(()=>{d(u)},[d,u]),e.jsx(Ff.span,{...c,ref:f,style:{pointerEvents:"none"},children:ak(l.value)?e.jsx(e.Fragment,{children:i}):o})});kS.displayName=SS;var jS=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Ff.span,{"aria-hidden":!0,...s,ref:r,children:a||"▼"})});jS.displayName="SelectIcon";var ES=t=>e.jsx(np,{asChild:!0,...t});ES.displayName="SelectPortal";var AS="SelectContent",NS=a.forwardRef((t,r)=>{const n=gS(AS,t.__scopeSelect),[o,i]=a.useState();if(Xu(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(_S,{scope:t.__scopeSelect,children:e.jsx(dS.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(PS,{...t,ref:r})});NS.displayName=AS;var CS=10,[_S,TS]=pS(AS),RS=function(t){const r=nS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(sS);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),PS=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...v}=t,x=gS(AS,n),[w,S]=a.useState(null),[k,j]=a.useState(null),E=Bo(r,e=>S(e)),[A,N]=a.useState(null),[C,_]=a.useState(null),T=uS(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return rm(w)},[w]),ip();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,k]),D=a.useCallback(()=>I([A,w]),[I,A,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:M}=x;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),M.current=null};return null!==M.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,M]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[F,z]=sk(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=ok(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&(N(e),n&&(O.current=!0))},[x.value]),$=a.useCallback(()=>w?.focus(),[w]),V=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&_(e)},[x.value]),W="popper"===s?IS:OS,B=W===IS?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return e.jsx(_S,{scope:n,content:w,viewport:k,onViewportChange:j,itemRefCallback:L,selectedItem:A,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:D,selectedItemText:C,position:s,isPositioned:R,searchRef:F,children:e.jsx(qp,{as:RS,allowPinchZoom:!0,children:e.jsx(Jf,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Nf(o,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(Bf,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:e.jsx(W,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Nf(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});PS.displayName="SelectContentImpl";var OS=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=gS(AS,n),c=TS(AS,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Bo(r,e=>f(e)),m=uS(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:v,focusSelectedItem:x}=c,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&b&&y&&v){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=v.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,c=Math.max(i,t.width),d=window.innerWidth-CS,u=lg(s,[CS,Math.max(CS,d-c)]);l.style.minWidth=i+"px",l.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,c=Math.max(i,t.width),d=window.innerWidth-CS,u=lg(s,[CS,Math.max(CS,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),o=window.innerHeight-2*CS,c=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),x=f+p+c+parseInt(d.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),j=parseInt(S.paddingBottom,10),E=e.top+e.height/2-CS,A=o-E,N=y.offsetHeight/2,C=f+p+(y.offsetTop+N),_=x-C;if(C<=E){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=C+Math.max(A,N+(e?j:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(E,f+b.offsetTop+(e?k:0)+N)+_;l.style.height=t+"px",b.scrollTop=C-E+b.offsetTop}l.style.margin=`${CS}px 0`,l.style.minHeight=w+"px",l.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,b,y,v,i.dir,s]);Xu(()=>w(),[w]);const[S,k]=a.useState();Xu(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const j=a.useCallback(e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)},[w,x]);return e.jsx(DS,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Ff.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});OS.displayName="SelectItemAlignedPosition";var IS=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=CS,...o}=t,i=mS(n);return e.jsx(aw,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});IS.displayName="SelectPopperPosition";var[DS,US]=pS(AS,{}),MS="SelectViewport",FS=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=TS(MS,n),c=US(MS,n),l=Bo(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(dS.Slot,{scope:n,children:e.jsx(Ff.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Nf(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=c;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*CS,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});FS.displayName=MS;var zS="SelectGroup",[LS,$S]=pS(zS);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Pf();return e.jsx(LS,{scope:n,id:s,children:e.jsx(Ff.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=zS;var VS="SelectLabel",WS=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=$S(VS,n);return e.jsx(Ff.div,{id:s.id,...a,ref:r})});WS.displayName=VS;var BS="SelectItem",[GS,HS]=pS(BS),KS=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...c}=t,l=gS(BS,n),d=TS(BS,n),u=l.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Bo(r,e=>d.itemRefCallback?.(e,s,o)),b=Pf(),y=a.useRef("touch"),v=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(GS,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(dS.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Ff.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...c,ref:g,onFocus:Nf(c.onFocus,()=>h(!0)),onBlur:Nf(c.onBlur,()=>h(!1)),onClick:Nf(c.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:Nf(c.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:Nf(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:Nf(c.onPointerMove,e=>{y.current=e.pointerType,o?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Nf(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Nf(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(cS.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});KS.displayName=BS;var ZS="SelectItemText",qS=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...c}=t,l=gS(ZS,n),d=TS(ZS,n),u=HS(ZS,n),f=yS(ZS,n),[p,m]=a.useState(null),h=Bo(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:v}=f;return Xu(()=>(y(b),()=>v(b)),[y,v,b]),e.jsxs(e.Fragment,{children:[e.jsx(Ff.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?s.createPortal(c.children,l.valueNode):null]})});qS.displayName=ZS;var JS="SelectItemIndicator",YS=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return HS(JS,n).isSelected?e.jsx(Ff.span,{"aria-hidden":!0,...a,ref:r}):null});YS.displayName=JS;var XS="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=TS(XS,t.__scopeSelect),s=US(XS,t.__scopeSelect),[o,i]=a.useState(!1),c=Bo(r,s.onScrollButtonChange);return Xu(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(ek,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=XS;var QS="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=TS(QS,t.__scopeSelect),s=US(QS,t.__scopeSelect),[o,i]=a.useState(!1),c=Bo(r,s.onScrollButtonChange);return Xu(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(ek,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=QS;var ek=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=TS("SelectScrollButton",n),c=a.useRef(null),l=uS(n),d=a.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),Xu(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(Ff.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:Nf(o.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(s,50))}),onPointerMove:Nf(o.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(s,50))}),onPointerLeave:Nf(o.onPointerLeave,()=>{d()})})}),tk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Ff.div,{"aria-hidden":!0,...a,ref:r})});tk.displayName="SelectSeparator";var rk="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=mS(n),o=gS(rk,n),i=TS(rk,n);return o.open&&"popper"===i.position?e.jsx(sw,{...s,...a,ref:r}):null}).displayName=rk;var nk=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=Bo(s,o),c=Uh(r);return a.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),e.jsx(Ff.select,{...n,style:{...oS,...n.style},ref:i,defaultValue:r})});function ak(e){return""===e||void 0===e}function sk(e){const t=Ju(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function ok(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}nk.displayName="SelectBubbleInput";var ik=wS,ck=jS,lk=ES,dk=NS,uk=FS,fk=WS,pk=KS,mk=qS,hk=YS,gk=tk;const bk=vS,yk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ik,{ref:a,className:ke("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(ck,{asChild:!0,children:e.jsx(qm,{className:"h-4 w-4 opacity-50"})})]}));yk.displayName=ik.displayName;const vk=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(Jt);return e.jsx(lk,{container:i,children:e.jsx(dk,{ref:o,className:ke("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx(uk,{className:ke("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});vk.displayName=dk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(fk,{ref:n,className:ke("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=fk.displayName;const xk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(pk,{ref:a,className:ke("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(hk,{children:e.jsx(Ym,{className:"h-4 w-4"})})}),e.jsx(mk,{children:r})]}));xk.displayName=pk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(gk,{ref:n,className:ke("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=gk.displayName;const wk=({workspace:r})=>{const n=Bt(e=>e.auth.session?.user||null),[a,s]=t.useState(0),[o,i]=t.useState(!1),[c,l]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=tr(),{settings:h}=Zu();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{l(e)}).catch(e=>{Ie(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const g=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Fb,{});const b=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=c.map(e=>({...e,...b(e.user)})),v=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,x="admin"===v,w=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e.jsxs("div",{children:[!x&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),x&&e.jsxs("div",{className:"mb-4",children:[w&&e.jsx(Sk,{onInvite:g,workspaceId:r._id}),!w&&e.jsx("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),e.jsx("div",{children:e.jsx(Pi,{variant:"ghost",size:"sm",onClick:g,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:y.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(bk,{disabled:s||!x||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(Dt(r,a)?Ie(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{g()}).catch(e=>{Ie(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(yk,{children:e.jsx(kS,{placeholder:"Select a role"})}),e.jsx(vk,{children:r?.roles.map(t=>e.jsx(xk,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(vi,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!s&&!o&&x&&e.jsx(Pi,{variant:"destructive",size:"sm",startIcon:e.jsx(Ni,{}),onClick:()=>{var e;e=t.id,Dt(r,e)?Ie(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{Ie(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===c.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Sk({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[c,l]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),{addUser:m,getWorkspace:h}=tr(),[g,b]=t.useState(null),{settings:y}=Zu(),v=y?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(b)},[n]);const x=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(Mi,{children:"Invite member by email"}),e.jsx(Zi,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(Mi,{children:"Role"}),e.jsxs(bk,{value:o,onValueChange:i,children:[e.jsx(yk,{children:e.jsx(kS,{placeholder:"Select a role"})}),e.jsx(vk,{children:v.map(t=>e.jsx(xk,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(Pi,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await m(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{Ie(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{x()},6e3)})):u("Invalid email address format")},disabled:c||!a||!o,children:c?"Inviting...":`Invite as ${o}`})})]})}const kk=({workspace:t,section:r,setSection:n})=>{const a=Bt(e=>e.auth.session?.user||null),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id;return e.jsxs("div",{className:"w-56 h-full flex flex-col space-y-6",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:ke("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(jk,{title:"Account",children:e.jsx(Ek,{activeSection:r,icon:e.jsx(_i,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(jk,{title:"Workspace",children:[e.jsx(Ek,{activeSection:r,icon:e.jsx(ki,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(Ek,{activeSection:r,icon:e.jsx(Ti,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(Ek,{activeSection:r,icon:e.jsx(pi,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(Ek,{activeSection:r,icon:e.jsx(Ei,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),s&&e.jsx(Ek,{activeSection:r,icon:e.jsx(Ci,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function jk({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function Ek({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:ke("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const Ak=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,y=c||m;if(!r)return null;const v=e.jsx(Pi,{variant:"outline",size:"icon",children:e.jsx(ki,{className:"h-4 w-4"})});return e.jsxs(rh,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(nh,{asChild:!0,children:d||v}),e.jsxs(oh,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(lh,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(kk,{workspace:r,section:b,setSection:y}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(ch,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(Zw,{workspace:r}),"general"===b&&e.jsx(ty,{workspace:r}),"users"===b&&e.jsx(wk,{workspace:r}),"subscription"===b&&e.jsx(rS,{workspace:r}),"features"===b&&e.jsx(Xb,{workspaceId:r._id?.toString()}),"danger"===b&&e.jsx(zb,{workspace:r})]})]})]})]})};var Nk=Object.freeze({__proto__:null,WorkspaceSettingsDialog:Ak,default:Ak});function Ck(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,c=o===r._id,l=r.subscription??null,d=l?.plan??null,u=d?.name??"";return e.jsxs("div",{className:ke("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(jf,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(Ef,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(Af,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Ti,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:[e.jsx(mi,{className:"h-3 w-3"}),e.jsxs("span",{className:"text-xs",children:["Subscription: ",u]})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(Pi,{size:"sm",disabled:null!==o||c,progress:c,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{Ie(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(Ak,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function _k(r){const{switching:n}=tr(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[c,l]=t.useState("🏢"),[d,u]=t.useState(!1),{createWorkspace:f}=tr(),p=Pn({resolver:$o(Zc({name:wc().min(2,{message:"Workspace name must be at least 2 characters."}),image:wc().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(rh,{open:a,onOpenChange:s,children:[e.jsx(nh,{asChild:!0,children:e.jsxs(Pi,{className:"w-full rounded-none",disabled:n,children:[e.jsx(xi,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(oh,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(ih,{children:[e.jsx(ch,{children:"Create New Workspace"}),e.jsx(lh,{children:"Create a new workspace to get started."})]}),e.jsx(Fi,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=Qb(c);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),l("🏢"),i("emoji"),r?.onCreated?.()}catch(t){Ie(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Li,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Wi,{children:[e.jsx(Bi,{children:"Workspace Name"}),e.jsx(Gi,{children:e.jsx(Zi,{placeholder:"My Awesome Workspace",...t})}),e.jsx(Ki,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(Mi,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Hi,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(ig,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(cg,{value:"emoji",id:"emoji"}),e.jsxs(Mi,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(ji,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(cg,{value:"url",id:"url"}),e.jsxs(Mi,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(yi,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),e.jsx(Hg,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:ey.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),p.setValue("image",Qb(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Li,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Wi,{children:[e.jsx(Bi,{children:"Image URL"}),e.jsx(Gi,{children:e.jsx(Zi,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Hi,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(Ki,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(Pi,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),l("🏢"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(Pi,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(vi,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const Tk=e=>{if(null==e)return"Free";if(0===e)return"Free";return`$${(e/100).toFixed(2)}`},Rk=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var Pk=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,onSelectPlan:i,loading:c=!1})=>{const[l,d]=t.useState(!1),[u,f]=t.useState(null),p=t.useMemo(()=>((e,t)=>{if(!e)return null;for(const r of t){const t=r.stripePrices;if(t){if(t.monthlyPriceId===e||t.monthly===e)return"monthly";if(t.yearlyPriceId===e||t.yearly===e)return"yearly";if(t.quarterlyPriceId===e)return"quarterly"}}return null})(o,a),[o,a]),[m,h]=t.useState(p||"monthly");t.useEffect(()=>{r&&h(p||"monthly")},[r,p]);const g=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),b=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(g),y=b.filter(e=>"feature"===e.type),v=b.filter(e=>"limit"===e.type),x=b.filter(e=>"quota"===e.type),w=c||l,S=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},k=(e,t)=>"feature"===t.type?e.features?.[t.slug]??!1:"limit"===t.type?e.limits?.[t.slug]??null:"quota"===t.type?e.quotas?.[t.slug]??null:null,j=(e,t)=>"feature"===t.type?!0===e?"✓":"—":"limit"===t.type?null!=e?String(e):"—":"quota"===t.type?"object"==typeof e&&null!==e&&"included"in e?`${e.included}${e.overage?` (+${e.overage})`:""}`:null!=e?String(e):"—":"—";return e.jsx(rh,{open:r,onOpenChange:n,children:e.jsxs(oh,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between p-6 border-b",children:[e.jsxs("div",{children:[e.jsx(ch,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(lh,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e.jsx("div",{className:"flex items-center gap-1 p-1 bg-slate-100 rounded-lg",children:["monthly","quarterly","yearly"].map(t=>{const r=p===t;return e.jsx("button",{onClick:()=>h(t),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(m===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:0===g.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:e.jsx("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*g.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),g.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),g.map(t=>{const r=t._id===s,a=(e=>{const t=e._id===s,r=p===m;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${S(m)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=g.findIndex(e=>e._id===s),a=g.findIndex(t=>t._id===e._id);return-1===n||-1===a?{label:"Select",variant:"default",disabled:!1}:a<n?{label:"Downgrade",variant:"outline",disabled:!1}:a>n?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(t),o=w&&t._id===u,h=(e=>{const t=e.basePricing;return t?t[m]??null:null})(t),b=t.basePricing?.monthly??0,y="monthly"!==m&&null!==h?((e,t,r)=>{if(!e||0===e)return null;let n;switch(r){case"yearly":n=t/12;break;case"quarterly":n=t/3;break;default:return null}const a=(e-n)/e*100;return a>0?Math.round(a):null})(b,h,m):null;return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:Tk(h)}),null!==h&&h>0&&e.jsx("span",{className:"text-sm text-slate-500",children:Rk(m)})]}),null!==y&&y>0&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",y,"% vs monthly"]})]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(Pi,{className:"mt-auto w-full",variant:a.variant,disabled:a.disabled||w,progress:o,onClick:()=>(async e=>{if(!(e===s&&p===m||c||l)){d(!0),f(e);try{await i(e,m),n(!1)}catch(e){}finally{d(!1),f(null)}}})(t._id),children:o?"Processing...":a.label})]})},t._id)})]})}),e.jsxs("tbody",{children:[y.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:g.length,className:"border-t border-slate-200 bg-slate-100"})]}),y.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),g.map(r=>{const n=k(r,t),a=j(n,t),o="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(o?"text-emerald-600":"—"===a?"text-slate-400":"text-slate-700"),children:a})},r._id)})]},t._id))]}),v.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:g.length,className:"border-t border-slate-200 bg-slate-100"})]}),v.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),g.map(r=>{const n=k(r,t),a=j(n,t);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===a?"text-slate-400":"text-slate-700"),children:a})},r._id)})]},t._id))]}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:g.length,className:"border-t border-slate-200 bg-slate-100"})]}),x.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),g.map(r=>{const n=k(r,t),a=j(n,t);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===a?"text-slate-400":"text-slate-700"),children:a})},r._id)})]},t._id))]})]})]})})})})]})})}});exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:c=!0,showSuccessMessage:l=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:y,isLoading:v,isSubmitting:x,error:w,config:S,success:k,message:j}=(()=>{const e=Bt(e=>e.os),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[c,l]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{(async()=>{s(!0);const t=new Ji(e),r=await t.fetchConfig();n(r),s(!1)})()},[e]),{isLoading:a,isSubmitting:o,config:r,error:c,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return l(e),{success:!1,message:e}}try{i(!0),l(null),u(!1),p(null);const r=new Ji(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return l(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(pl).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),b(!0)),w&&b(!0)},[k,l,w]);const E={...pl[o||f],...i},A=Pn({resolver:$o(fl),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&A.setFocus("name")},[c,A]);const N=A.formState.isValid&&!x;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:v?e.jsxs("div",{className:ke("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(qi,{className:"h-24 w-24 rounded-lg"}),e.jsx(qi,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(qi,{className:"h-4 w-16"}),e.jsx(qi,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(qi,{className:"h-4 w-16"}),e.jsx(qi,{className:"h-10 w-full"})]}),e.jsx(qi,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(hl,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx($r,{...A,children:e.jsxs("form",{onSubmit:A.handleSubmit(async e=>{try{const t=await y(e);t.success?(r?.(),A.reset(),l&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:E.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":x,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(ml,{screen:S?.screen?.register}),e.jsx(Li,{control:A.control,name:"name",render:({field:t})=>e.jsxs(Wi,{className:s,children:[e.jsx(Bi,{children:E.nameLabel}),e.jsx(Gi,{children:e.jsx(Zi,{...t})}),e.jsx(Hi,{}),e.jsx(Ki,{})]})}),e.jsx(Li,{control:A.control,name:"email",render:({field:t})=>e.jsxs(Wi,{className:s,children:[e.jsx(Bi,{children:E.emailLabel}),e.jsx(Gi,{children:e.jsx(Zi,{...t})}),e.jsx(Hi,{}),e.jsx(Ki,{})]})}),e.jsx(Pi,{type:"submit",disabled:!N,className:s,children:x?E.submittingText:E.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(Pi,{type:"button",onClick:()=>{b(!1),A.reset()},className:s,children:"Try Again"})})]}),g&&m&&j&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(ml,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,loading:i,error:c,refetch:l}=gl(t);return i?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(qi,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(qi,{className:"h-64 rounded-lg"},t))})]}):c?a?e.jsx(e.Fragment,{children:a(c)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:c}):e.jsx(e.Fragment,{children:r({loading:i,error:c,items:s,plans:o,refetch:l})})},exports.SaaSOSProvider=or,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=Hu();return r!==exports.AuthStatus.authenticated?null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Hu();return n.includes(a?.role??"")?t:r||null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=Hu();return r===exports.AuthStatus.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ku();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Ku();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=tr(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=tr(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=Hu(),{currentWorkspace:s}=tr(),o=s?.users.find(e=>e._id===a?.id);return o&&n.includes(o?.role??"")?t:r||null},exports.WorkspaceSwitcher=function(r){const{workspaces:n,currentWorkspace:a,loading:s,refreshing:o,switchingToId:i}=Bt(e=>e.workspaces),c=Bt(e=>e.auth.session?.user),{settings:l}=Zu(),[d,u]=t.useState(!1),[f,p]=t.useState(0),[m,h]=t.useState(""),{fetchWorkspaces:g,getFeatures:b,refreshWorkspaces:y,setCurrentWorkspace:v,switchToWorkspace:x,workspaces:w}=tr(),S=s||o;t.useEffect(()=>{0===w.length?(g(),b()):b()},[]),t.useEffect(()=>{f>0&&y()},[f]);const k=w.length>0?w:n,j=k.filter(e=>e._id!==a?._id).filter(e=>e.name.toLowerCase().includes(m.toLowerCase())),E=l?.workspace.maxWorkspaces??Number.MAX_VALUE,A=k?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===c?.id?.toString()).length,N=E>(A??0);return e.jsxs(rh,{open:d,onOpenChange:u,children:[e.jsx(nh,{children:r.trigger?.(S,a)}),e.jsxs(oh,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(ih,{children:[e.jsxs(ch,{className:"flex items-center gap-2",children:[e.jsx(li,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(lh,{children:"Select a workspace to switch to or create a new one."})]}),!c&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),c&&e.jsxs("div",{className:"flex flex-col gap-4",children:[a&&e.jsx(Ck,{workspace:a,isCurrentWorkspace:!0,switchToWorkspace:x,switchingToId:i,onClose:()=>u(!1),setCurrentWorkspace:v,setOpen:u,workspacesToUse:k}),e.jsx(Qg,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",j.length,")"]}),e.jsx("div",{children:e.jsx(Pi,{progress:o,disabled:o,variant:"ghost",onClick:function(){p(e=>e+1)},startIcon:e.jsx(wi,{}),children:o?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Si,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Zi,{placeholder:"Search workspaces...",value:m,onChange:e=>h(e.target.value),className:"pl-10"})]}),s?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(vi,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===j.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(li,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:m?"No workspaces found":"No workspaces available"})]}):e.jsx(Hg,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:j.map(t=>{const r=t._id===a?._id;return e.jsx(Ck,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:x,switchingToId:i,onClose:()=>u(!1),setCurrentWorkspace:v,setOpen:u,workspacesToUse:k},t._id)})})})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx(Qg,{}),e.jsx(_k,{onCreated:()=>{g()}})]})]})]})]})},exports.eventEmitter=qt,exports.useCreateCheckoutSession=xl,exports.useInvoice=(e,r)=>{const n=Bt(e=>e.os),a=t.useMemo(()=>new er(n),[n.serverUrl,n.version,n.orgId]),[s,o]=t.useState(null),[i,c]=t.useState(!1),[l,d]=t.useState(null),u=t.useCallback(async()=>{if(e&&r){c(!0),d(null);try{const t=await a.getInvoice(e,r);o(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";d(n),Ie(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{c(!1)}}else o(null)},[a,e,r]);return t.useEffect(()=>{u()},[u]),{invoice:s,loading:i,error:l,refetch:u}},exports.useInvoices=kl,exports.usePlanGroup=yl,exports.usePlanGroupVersions=vl,exports.usePublicPlanGroupVersion=e=>{const r=Bt(e=>e.os),n=t.useMemo(()=>new er(r),[r.serverUrl,r.version,r.orgId]),[a,s]=t.useState(null),[o,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e){i(!0),l(null);try{const t=await n.getPlanGroupVersion(e);s(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";l(r),Ie(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{i(!1)}}else s(null)},[n,e]);return t.useEffect(()=>{d()},[d]),{planGroupVersion:a,loading:o,error:c,refetch:d}},exports.usePublicPlans=gl,exports.useSaaSAuth=Hu,exports.useSaaSSettings=Zu,exports.useSaaSWorkspaces=tr,exports.useSubscription=bl,exports.useSubscriptionManagement=Sl,exports.useUpdateSubscription=wl,exports.useUserAttributes=function(){const e=t.useContext(Xt);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=Ku;
29
+ */function Sf(){return vf||(vf=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=t,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,o=r.useLayoutEffect,i=r.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(t,d){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var u=d();if(!l){var f=d();n(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=a({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return o(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[t,u,d]),s(function(){return e(p)&&m({inst:p}),t(function(){e(p)&&m({inst:p})})},[t]),i(u),u};wf.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),wf}function kf(){return xf||(xf=1,"production"===process.env.NODE_ENV?gf.exports=yf():gf.exports=Sf()),gf.exports}var jf=kf();function Ef(){return()=>{}}var Cf="Avatar",[Nf]=function(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s);o.displayName=r+"Context";const i=n.length;n=[...n,s];const c=r=>{const{scope:n,children:s,...c}=r,l=n?.[t]?.[i]||o,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:s})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||o,l=a.useContext(c);if(l)return l;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},uf(s,...r)]}(Cf),[Af,_f]=Nf(Cf),Tf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,...s}=t,[o,i]=a.useState("idle");return e.jsx(Af,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:e.jsx(hf.span,{...s,ref:r})})});Tf.displayName=Cf;var Rf="AvatarImage",Pf=a.forwardRef((t,r)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:o=()=>{},...i}=t,c=_f(Rf,n),l=function(e,{referrerPolicy:t,crossOrigin:r}){const n=jf.useSyncExternalStore(Ef,()=>!0,()=>!1),s=a.useRef(null),o=n?(s.current||(s.current=new window.Image),s.current):null,[i,c]=a.useState(()=>Df(o,e));return mf(()=>{c(Df(o,e))},[o,e]),mf(()=>{const e=e=>()=>{c(e)};if(!o)return;const n=e("loaded"),a=e("error");return o.addEventListener("load",n),o.addEventListener("error",a),t&&(o.referrerPolicy=t),"string"==typeof r&&(o.crossOrigin=r),()=>{o.removeEventListener("load",n),o.removeEventListener("error",a)}},[o,r,t]),i}(s,i),d=ff(e=>{o(e),c.onImageLoadingStatusChange(e)});return mf(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?e.jsx(hf.img,{...i,ref:r,src:s}):null});Pf.displayName=Rf;var Of="AvatarFallback",If=a.forwardRef((t,r)=>{const{__scopeAvatar:n,delayMs:s,...o}=t,i=_f(Of,n),[c,l]=a.useState(void 0===s);return a.useEffect(()=>{if(void 0!==s){const e=window.setTimeout(()=>l(!0),s);return()=>window.clearTimeout(e)}},[s]),c&&"loaded"!==i.imageLoadingStatus?e.jsx(hf.span,{...o,ref:r}):null});function Df(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}If.displayName=Of;var Uf=Tf,Ff=Pf,Mf=If;const zf=a.forwardRef(({className:t,...r},n)=>e.jsx(Uf,{ref:n,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));zf.displayName=Uf.displayName;const Lf=a.forwardRef(({className:t,...r},n)=>e.jsx(Ff,{ref:n,className:je("aspect-square h-full w-full",t),...r}));Lf.displayName=Ff.displayName;const Vf=a.forwardRef(({className:t,...r},n)=>e.jsx(Mf,{ref:n,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));function $f(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Wf(t,r=[]){let n=[];const s=()=>{const e=n.map(e=>a.createContext(e));return function(r){const n=r?.[t]||e;return a.useMemo(()=>({[`__scope${t}`]:{...r,[t]:n}}),[r,n])}};return s.scopeName=t,[function(r,s){const o=a.createContext(s),i=n.length;n=[...n,s];const c=r=>{const{scope:n,children:s,...c}=r,l=n?.[t]?.[i]||o,d=a.useMemo(()=>c,Object.values(c));return e.jsx(l.Provider,{value:d,children:s})};return c.displayName=r+"Provider",[c,function(e,n){const c=n?.[t]?.[i]||o,l=a.useContext(c);if(l)return l;if(void 0!==s)return s;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},Bf(s,...r)]}function Bf(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const n=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}Vf.displayName=Mf.displayName;var Gf=a[" useId ".trim().toString()]||(()=>{}),Kf=0;function Hf(e){const[t,r]=a.useState(Gf());return mf(()=>{r(e=>e??String(Kf++))},[e]),e||(t?`radix-${t}`:"")}var Zf=a[" useInsertionEffect ".trim().toString()]||mf;function Jf({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,i]=function({defaultProp:e,onChange:t}){const[r,n]=a.useState(e),s=a.useRef(r),o=a.useRef(t);return Zf(()=>{o.current=t},[t]),a.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:s;{const t=a.useRef(void 0!==e);a.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${n} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=c},[c,n])}const d=a.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&i.current?.(r)}else o(t)},[c,e,o,i]);return[l,d]}function qf(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yf=Symbol("radix.slottable");function Xf(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Yf}var Qf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=function(t){const r=qf(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(Xf);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{});var ep,tp="dismissableLayer.update",rp="dismissableLayer.pointerDownOutside",np="dismissableLayer.focusOutside",ap=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),sp=a.forwardRef((t,r)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:l,...d}=t,u=a.useContext(ap),[f,p]=a.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=a.useState({}),g=Fl(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),x=f?b.indexOf(f):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=v,k=function(e,t=globalThis?.document){const r=ff(e),n=a.useRef(!1),s=a.useRef(()=>{});return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){let n=function(){ip(rp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",s.current),s.current=n,t.addEventListener("click",s.current,{once:!0})):n()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",e),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(o?.(e),c?.(e),e.defaultPrevented||l?.())},m),j=function(e,t=globalThis?.document){const r=ff(e),n=a.useRef(!1);return a.useEffect(()=>{const e=e=>{if(e.target&&!n.current){ip(np,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(i?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=ff(e);a.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{x===u.layers.size-1&&(s?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),a.useEffect(()=>{if(f)return n&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(ep=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),op(),()=>{n&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=ep)}},[f,m,n,u]),a.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),op())},[f,u]),a.useEffect(()=>{const e=()=>h({});return document.addEventListener(tp,e),()=>document.removeEventListener(tp,e)},[]),e.jsx(Qf.div,{...d,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:$f(t.onFocusCapture,j.onFocusCapture),onBlurCapture:$f(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:$f(t.onPointerDownCapture,k.onPointerDownCapture)})});sp.displayName="DismissableLayer";function op(){const e=new CustomEvent(tp);document.dispatchEvent(e)}function ip(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?function(e,t){e&&s.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}a.forwardRef((t,r)=>{const n=a.useContext(ap),s=a.useRef(null),o=Fl(r,s);return a.useEffect(()=>{const e=s.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),e.jsx(Qf.div,{...t,ref:o})}).displayName="DismissableLayerBranch";var cp="focusScope.autoFocusOnMount",lp="focusScope.autoFocusOnUnmount",dp={bubbles:!1,cancelable:!0},up=a.forwardRef((t,r)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=t,[l,d]=a.useState(null),u=ff(o),f=ff(i),p=a.useRef(null),m=Fl(r,e=>d(e)),h=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(s){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:hp(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||hp(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&hp(l)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return l&&n.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[s,l,h.paused]),a.useEffect(()=>{if(l){gp.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(cp,dp);l.addEventListener(cp,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(hp(n,{select:t}),document.activeElement!==r)return}((e=fp(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&hp(l))}return()=>{l.removeEventListener(cp,u),setTimeout(()=>{const e=new CustomEvent(lp,dp);l.addEventListener(lp,f),l.dispatchEvent(e),e.defaultPrevented||hp(t??document.body,{select:!0}),l.removeEventListener(lp,f),gp.remove(h)},0)}}var e},[l,u,f,h]);const g=a.useCallback(e=>{if(!n&&!s)return;if(h.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){const t=e.currentTarget,[a,s]=function(e){const t=fp(e),r=pp(t,e),n=pp(t.reverse(),e);return[r,n]}(t);a&&s?e.shiftKey||r!==s?e.shiftKey&&r===a&&(e.preventDefault(),n&&hp(s,{select:!0})):(e.preventDefault(),n&&hp(a,{select:!0})):r===t&&e.preventDefault()}},[n,s,h.paused]);return e.jsx(Qf.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function fp(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function pp(e,t){for(const r of e)if(!mp(r,{upTo:t}))return r}function mp(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function hp(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}up.displayName="FocusScope";var gp=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=bp(e,t),e.unshift(t)},remove(t){e=bp(e,t),e[0]?.resume()}}}();function bp(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var yp=a.forwardRef((t,n)=>{const{container:s,...o}=t,[i,c]=a.useState(!1);mf(()=>c(!0),[]);const l=s||i&&globalThis?.document?.body;return l?r.createPortal(e.jsx(Qf.div,{...o,ref:n}),l):null});yp.displayName="Portal";var vp=e=>{const{present:t,children:r}=e,n=function(e){const[t,r]=a.useState(),n=a.useRef(null),s=a.useRef(e),o=a.useRef("none"),i=e?"mounted":"unmounted",[c,l]=function(e,t){return a.useReducer((e,r)=>t[e][r]??e,e)}(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const e=xp(n.current);o.current="mounted"===c?e:"none"},[c]),mf(()=>{const t=n.current,r=s.current;if(r!==e){const n=o.current,a=xp(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}s.current=e}},[e,l]),mf(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,a=a=>{const o=xp(n.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(l("ANIMATION_END"),!s.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},i=e=>{e.target===t&&(o.current=xp(n.current))};return t.addEventListener("animationstart",i),t.addEventListener("animationcancel",a),t.addEventListener("animationend",a),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",i),t.removeEventListener("animationcancel",a),t.removeEventListener("animationend",a)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:a.useCallback(e=>{n.current=e?getComputedStyle(e):null,r(e)},[])}}(t),s="function"==typeof r?r({present:n.isPresent}):a.Children.only(r),o=Fl(n.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(s));return"function"==typeof r||n.isPresent?a.cloneElement(s,{ref:o}):null};function xp(e){return e?.animationName||"none"}vp.displayName="Presence";var wp=0;function Sp(){a.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kp()),document.body.insertAdjacentElement("beforeend",e[1]??kp()),wp++,()=>{1===wp&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),wp--}},[])}function kp(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var jp=function(){return jp=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},jp.apply(this,arguments)};function Ep(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var Cp="right-scroll-bar-position",Np="width-before-scroll-bar";function Ap(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var _p="undefined"!=typeof window?a.useLayoutEffect:a.useEffect,Tp=new WeakMap;function Rp(e,r){var n,a,s,o=(n=null,a=function(t){return e.forEach(function(e){return Ap(e,t)})},(s=t.useState(function(){return{value:n,callback:a,facade:{get current(){return s.value},set current(e){var t=s.value;t!==e&&(s.value=e,s.callback(e,t))}}}})[0]).callback=a,s.facade);return _p(function(){var t=Tp.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||Ap(e,null)}),n.forEach(function(e){r.has(e)||Ap(e,a)})}Tp.set(o,e)},[e]),o}function Pp(e){return e}var Op=function(e){var t=e.sideCar,r=Ep(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return a.createElement(n,jp({},r))};Op.isSideCarExport=!0;var Ip=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Pp);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var a=t(e,n);return r.push(a),function(){r=r.filter(function(e){return e!==a})}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var a=r;r=[],a.forEach(e),t=r}var s=function(){var r=t;t=[],r.forEach(e)},o=function(){return Promise.resolve().then(s)};o(),r={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=jp({async:!0,ssr:!1},e),t}(),Dp=function(){},Up=a.forwardRef(function(e,t){var r=a.useRef(null),n=a.useState({onScrollCapture:Dp,onWheelCapture:Dp,onTouchMoveCapture:Dp}),s=n[0],o=n[1],i=e.forwardProps,c=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,v=void 0===y?"div":y,x=e.gapMode,w=Ep(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Rp([r,t]),j=jp(jp({},w),s);return a.createElement(a.Fragment,null,u&&a.createElement(S,{sideCar:Ip,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:o,allowPinchZoom:!!b,lockRef:r,gapMode:x}),i?a.cloneElement(a.Children.only(c),jp(jp({},j),{ref:k})):a.createElement(v,jp({},j,{className:l,ref:k}),c))});Up.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Up.classNames={fullWidth:Np,zeroRight:Cp};function Fp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Mp=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Fp())&&(a=r,(n=t).styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zp=function(){var e,t=(e=Mp(),function(t,r){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},Lp={left:0,top:0,right:0,gap:0},Vp=function(e){return parseInt(e||"",10)||0},$p=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Lp;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[Vp(r),Vp(n),Vp(a)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Wp=zp(),Bp="data-scroll-locked",Gp=function(e,t,r,n){var a=e.left,s=e.top,o=e.right,i=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(i,"px ").concat(n,";\n }\n body[").concat(Bp,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(i,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Cp," {\n right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(Np," {\n margin-right: ").concat(i,"px ").concat(n,";\n }\n \n .").concat(Cp," .").concat(Cp," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Np," .").concat(Np," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Bp,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(i,"px;\n }\n")},Kp=function(){var e=parseInt(document.body.getAttribute(Bp)||"0",10);return isFinite(e)?e:0},Hp=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=void 0===n?"margin":n;a.useEffect(function(){return document.body.setAttribute(Bp,(Kp()+1).toString()),function(){var e=Kp()-1;e<=0?document.body.removeAttribute(Bp):document.body.setAttribute(Bp,e.toString())}},[]);var o=a.useMemo(function(){return $p(s)},[s]);return a.createElement(Wp,{styles:Gp(o,!t,s,r?"":"!important")})},Zp=!1;if("undefined"!=typeof window)try{var Jp=Object.defineProperty({},"passive",{get:function(){return Zp=!0,!0}});window.addEventListener("test",Jp,Jp),window.removeEventListener("test",Jp,Jp)}catch(e){Zp=!1}var qp=!!Zp&&{passive:!1},Yp=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},Xp=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Qp(e,n)){var a=em(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Qp=function(e,t){return"v"===e?function(e){return Yp(e,"overflowY")}(t):function(e){return Yp(e,"overflowX")}(t)},em=function(e,t){return"v"===e?function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]}(t):function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t)},tm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rm=function(e){return[e.deltaX,e.deltaY]},nm=function(e){return e&&"current"in e?e.current:e},am=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},sm=0,om=[];function im(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var cm,lm=(cm=function(e){var t=a.useRef([]),r=a.useRef([0,0]),n=a.useRef(),s=a.useState(sm++)[0],o=a.useState(zp)[0],i=a.useRef(e);a.useEffect(function(){i.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([e.lockRef.current],(e.shards||[]).map(nm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=a.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=tm(e),o=r.current,c="deltaX"in e?e.deltaX:o[0]-s[0],l="deltaY"in e?e.deltaY:o[1]-s[1],d=e.target,u=Math.abs(c)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var m=Xp(u,d);if(!m)return!0;if(m?a=u:(a="v"===u?"h":"v",m=Xp(u,d)),!m)return!1;if(!n.current&&"changedTouches"in e&&(c||l)&&(n.current=a),!a)return!0;var h=n.current||a;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),s=a*n,o=r.target,i=t.contains(o),c=!1,l=s>0,d=0,u=0;do{if(!o)break;var f=em(e,o),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Qp(e,o)&&(d+=m,u+=p);var h=o.parentNode;o=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!i&&o!==document.body||i&&(t.contains(o)||t===o));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=a.useCallback(function(e){var r=e;if(om.length&&om[om.length-1]===o){var n="deltaY"in r?rm(r):tm(r),a=t.current.filter(function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,a=n,t[0]===a[0]&&t[1]===a[1]);var t,a})[0];if(a&&a.should)r.cancelable&&r.preventDefault();else if(!a){var s=(i.current.shards||[]).map(nm).filter(Boolean).filter(function(e){return e.contains(r.target)});(s.length>0?c(r,s[0]):!i.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=a.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:im(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),u=a.useCallback(function(e){r.current=tm(e),n.current=void 0},[]),f=a.useCallback(function(t){d(t.type,rm(t),t.target,c(t,e.lockRef.current))},[]),p=a.useCallback(function(t){d(t.type,tm(t),t.target,c(t,e.lockRef.current))},[]);a.useEffect(function(){return om.push(o),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,qp),document.addEventListener("touchmove",l,qp),document.addEventListener("touchstart",u,qp),function(){om=om.filter(function(e){return e!==o}),document.removeEventListener("wheel",l,qp),document.removeEventListener("touchmove",l,qp),document.removeEventListener("touchstart",u,qp)}},[]);var m=e.removeScrollBar,h=e.inert;return a.createElement(a.Fragment,null,h?a.createElement(o,{styles:am(s)}):null,m?a.createElement(Hp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Ip.useMedium(cm),Op),dm=a.forwardRef(function(e,t){return a.createElement(Up,jp({},e,{ref:t,sideCar:lm}))});dm.classNames=Up.classNames;var um=new WeakMap,fm=new WeakMap,pm={},mm=0,hm=function(e){return e&&(e.host||hm(e.parentNode))},gm=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=hm(t);return r&&e.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(e){return Boolean(e)})}(t,Array.isArray(e)?e:[e]);pm[r]||(pm[r]=new WeakMap);var s=pm[r],o=[],i=new Set,c=new Set(a),l=function(e){e&&!i.has(e)&&(i.add(e),l(e.parentNode))};a.forEach(l);var d=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(i.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(um.get(e)||0)+1,l=(s.get(e)||0)+1;um.set(e,c),s.set(e,l),o.push(e),1===c&&a&&fm.set(e,!0),1===l&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),i.clear(),mm++,function(){o.forEach(function(e){var t=um.get(e)-1,a=s.get(e)-1;um.set(e,t),s.set(e,a),t||(fm.has(e)||e.removeAttribute(n),fm.delete(e)),a||e.removeAttribute(r)}),--mm||(um=new WeakMap,um=new WeakMap,fm=new WeakMap,pm={})}},bm=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),gm(n,a,r,"aria-hidden")):function(){return null}};function ym(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vm=Symbol("radix.slottable");function xm(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===vm}var wm="Dialog",[Sm,km]=Wf(wm),[jm,Em]=Sm(wm),Cm=t=>{const{__scopeDialog:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=t,l=a.useRef(null),d=a.useRef(null),[u,f]=Jf({prop:s,defaultProp:o??!1,onChange:i,caller:wm});return e.jsx(jm,{scope:r,triggerRef:l,contentRef:d,contentId:Hf(),titleId:Hf(),descriptionId:Hf(),open:u,onOpenChange:f,onOpenToggle:a.useCallback(()=>f(e=>!e),[f]),modal:c,children:n})};Cm.displayName=wm;var Nm="DialogTrigger",Am=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=Em(Nm,n),o=Fl(r,s.triggerRef);return e.jsx(Qf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Zm(s.open),...a,ref:o,onClick:$f(t.onClick,s.onOpenToggle)})});Am.displayName=Nm;var _m="DialogPortal",[Tm,Rm]=Sm(_m,{forceMount:void 0}),Pm=t=>{const{__scopeDialog:r,forceMount:n,children:s,container:o}=t,i=Em(_m,r);return e.jsx(Tm,{scope:r,forceMount:n,children:a.Children.map(s,t=>e.jsx(vp,{present:n||i.open,children:e.jsx(yp,{asChild:!0,container:o,children:t})}))})};Pm.displayName=_m;var Om="DialogOverlay",Im=a.forwardRef((t,r)=>{const n=Rm(Om,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=Em(Om,t.__scopeDialog);return o.modal?e.jsx(vp,{present:a||o.open,children:e.jsx(Um,{...s,ref:r})}):null});Im.displayName=Om;var Dm=function(t){const r=ym(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(xm);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("DialogOverlay.RemoveScroll"),Um=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=Em(Om,n);return e.jsx(dm,{as:Dm,allowPinchZoom:!0,shards:[s.contentRef],children:e.jsx(Qf.div,{"data-state":Zm(s.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Fm="DialogContent",Mm=a.forwardRef((t,r)=>{const n=Rm(Fm,t.__scopeDialog),{forceMount:a=n.forceMount,...s}=t,o=Em(Fm,t.__scopeDialog);return e.jsx(vp,{present:a||o.open,children:o.modal?e.jsx(zm,{...s,ref:r}):e.jsx(Lm,{...s,ref:r})})});Mm.displayName=Fm;var zm=a.forwardRef((t,r)=>{const n=Em(Fm,t.__scopeDialog),s=a.useRef(null),o=Fl(r,n.contentRef,s);return a.useEffect(()=>{const e=s.current;if(e)return bm(e)},[]),e.jsx(Vm,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$f(t.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:$f(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:$f(t.onFocusOutside,e=>e.preventDefault())})}),Lm=a.forwardRef((t,r)=>{const n=Em(Fm,t.__scopeDialog),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(Vm,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Vm=a.forwardRef((t,r)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=t,l=Em(Fm,n),d=a.useRef(null),u=Fl(r,d);return Sp(),e.jsxs(e.Fragment,{children:[e.jsx(up,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:e.jsx(sp,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Zm(l.open),...c,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(Xm,{titleId:l.titleId}),e.jsx(Qm,{contentRef:d,descriptionId:l.descriptionId})]})]})}),$m="DialogTitle",Wm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=Em($m,n);return e.jsx(Qf.h2,{id:s.titleId,...a,ref:r})});Wm.displayName=$m;var Bm="DialogDescription",Gm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=Em(Bm,n);return e.jsx(Qf.p,{id:s.descriptionId,...a,ref:r})});Gm.displayName=Bm;var Km="DialogClose",Hm=a.forwardRef((t,r)=>{const{__scopeDialog:n,...a}=t,s=Em(Km,n);return e.jsx(Qf.button,{type:"button",...a,ref:r,onClick:$f(t.onClick,()=>s.onOpenChange(!1))})});function Zm(e){return e?"open":"closed"}Hm.displayName=Km;var Jm="DialogTitleWarning",[qm,Ym]=function(t,r){const n=a.createContext(r),s=t=>{const{children:r,...s}=t,o=a.useMemo(()=>s,Object.values(s));return e.jsx(n.Provider,{value:o,children:r})};return s.displayName=t+"Provider",[s,function(e){const s=a.useContext(n);if(s)return s;if(void 0!==r)return r;throw new Error(`\`${e}\` must be used within \`${t}\``)}]}(Jm,{contentName:Fm,titleName:$m,docsSlug:"dialog"}),Xm=({titleId:e})=>{const t=Ym(Jm),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.\n\nIf you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return a.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Qm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ym("DialogDescriptionWarning").contentName}}.`;return a.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},eh=Cm,th=Am,rh=Pm,nh=Im,ah=Mm,sh=Wm,oh=Gm,ih=Hm;function ch(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var lh=["color"],dh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=ch(e,lh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),uh=["color"],fh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=ch(e,uh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),ph=["color"],mh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=ch(e,ph);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))}),hh=["color"],gh=t.forwardRef(function(e,r){var n=e.color,a=void 0===n?"currentColor":n,s=ch(e,hh);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:r}),t.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const bh=eh,yh=th,vh=rh,xh=a.forwardRef(({className:t,...r},n)=>e.jsx(nh,{ref:n,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));xh.displayName=nh.displayName;const wh=a.forwardRef(({className:t,children:r,...n},s)=>{const{container:o}=a.useContext(Ga);return e.jsxs(vh,{container:o,children:[e.jsx(xh,{}),e.jsxs(ah,{ref:s,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...n,children:[r,e.jsxs(ih,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(mh,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});wh.displayName=ah.displayName;const Sh=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});Sh.displayName="DialogHeader";const kh=a.forwardRef(({className:t,...r},n)=>e.jsx(sh,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",t),...r}));kh.displayName=sh.displayName;const jh=a.forwardRef(({className:t,...r},n)=>e.jsx(oh,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));function Eh(t){const r=Ch(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(Ah);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}function Ch(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}jh.displayName=oh.displayName;var Nh=Symbol("radix.slottable");function Ah(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nh}function _h(r){const n=r+"CollectionProvider",[a,s]=Wf(n),[o,i]=a(n,{collectionRef:{current:null},itemMap:new Map}),c=r=>{const{scope:n,children:a}=r,s=t.useRef(null),i=t.useRef(new Map).current;return e.jsx(o,{scope:n,itemMap:i,collectionRef:s,children:a})};c.displayName=n;const l=r+"CollectionSlot",d=Eh(l),u=t.forwardRef((t,r)=>{const{scope:n,children:a}=t,s=Fl(r,i(l,n).collectionRef);return e.jsx(d,{ref:s,children:a})});u.displayName=l;const f=r+"CollectionItemSlot",p="data-radix-collection-item",m=Eh(f),h=t.forwardRef((r,n)=>{const{scope:a,children:s,...o}=r,c=t.useRef(null),l=Fl(n,c),d=i(f,a);return t.useEffect(()=>(d.itemMap.set(c,{ref:c,...o}),()=>{d.itemMap.delete(c)})),e.jsx(m,{[p]:"",ref:l,children:s})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(e){const n=i(r+"CollectionConsumer",e),a=t.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),r=Array.from(n.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return r},[n.collectionRef,n.itemMap]);return a},s]}var Th=a.createContext(void 0);function Rh(e){const t=a.useContext(Th);return e||t||"ltr"}var Ph="rovingFocusGroup.onEntryFocus",Oh={bubbles:!1,cancelable:!0},Ih="RovingFocusGroup",[Dh,Uh,Fh]=_h(Ih),[Mh,zh]=Wf(Ih,[Fh]),[Lh,Vh]=Mh(Ih),$h=a.forwardRef((t,r)=>e.jsx(Dh.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Dh.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Wh,{...t,ref:r})})}));$h.displayName=Ih;var Wh=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=t,m=a.useRef(null),h=Fl(r,m),g=Rh(i),[b,y]=Jf({prop:c,defaultProp:l??null,onChange:d,caller:Ih}),[v,x]=a.useState(!1),w=ff(u),S=Uh(n),k=a.useRef(!1),[j,E]=a.useState(0);return a.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Ph,w),()=>e.removeEventListener(Ph,w)},[w]),e.jsx(Lh,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:b,onItemFocus:a.useCallback(e=>y(e),[y]),onItemShiftTab:a.useCallback(()=>x(!0),[]),onFocusableItemAdd:a.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:a.useCallback(()=>E(e=>e-1),[]),children:e.jsx(Qf.div,{tabIndex:v||0===j?-1:0,"data-orientation":s,...p,ref:h,style:{outline:"none",...t.style},onMouseDown:$f(t.onMouseDown,()=>{k.current=!0}),onFocus:$f(t.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(Ph,Oh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Hh([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:$f(t.onBlur,()=>x(!1))})})}),Bh="RovingFocusGroupItem",Gh=a.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:c,...l}=t,d=Hf(),u=i||d,f=Vh(Bh,n),p=f.currentTabStopId===u,m=Uh(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return a.useEffect(()=>{if(s)return h(),()=>g()},[s,h,g]),e.jsx(Dh.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:e.jsx(Qf.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:$f(t.onMouseDown,e=>{s?f.onItemFocus(u):e.preventDefault()}),onFocus:$f(t.onFocus,()=>f.onItemFocus(u)),onKeyDown:$f(t.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,r){const n=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(n)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)?void 0:Kh[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=m().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();const n=r.indexOf(e.currentTarget);r=f.loop?function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(r,n+1):r.slice(n+1)}setTimeout(()=>Hh(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=b}):c})})});Gh.displayName=Bh;var Kh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hh(e,t=!1){const r=document.activeElement;for(const n of e){if(n===r)return;if(n.focus({preventScroll:t}),document.activeElement!==r)return}}var Zh=$h,Jh=Gh;function qh(e){const[t,r]=a.useState(void 0);return mf(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let a,s;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Yh(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xh="Radio",[Qh,eg]=Wf(Xh),[tg,rg]=Qh(Xh),ng=a.forwardRef((t,r)=>{const{__scopeRadio:n,name:s,checked:o=!1,required:i,disabled:c,value:l="on",onCheck:d,form:u,...f}=t,[p,m]=a.useState(null),h=Fl(r,e=>m(e)),g=a.useRef(!1),b=!p||(u||!!p.closest("form"));return e.jsxs(tg,{scope:n,checked:o,disabled:c,children:[e.jsx(Qf.button,{type:"button",role:"radio","aria-checked":o,"data-state":ig(o),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onClick:$f(t.onClick,e=>{o||d?.(),b&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),b&&e.jsx(og,{control:p,bubbles:!g.current,name:s,value:l,checked:o,required:i,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});ng.displayName=Xh;var ag="RadioIndicator",sg=a.forwardRef((t,r)=>{const{__scopeRadio:n,forceMount:a,...s}=t,o=rg(ag,n);return e.jsx(vp,{present:a||o.checked,children:e.jsx(Qf.span,{"data-state":ig(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})})});sg.displayName=ag;var og=a.forwardRef(({__scopeRadio:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const c=a.useRef(null),l=Fl(c,i),d=Yh(n),u=qh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx(Qf.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ig(e){return e?"checked":"unchecked"}og.displayName="RadioBubbleInput";var cg=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lg="RadioGroup",[dg]=Wf(lg,[zh,eg]),ug=zh(),fg=eg(),[pg,mg]=dg(lg),hg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:s,value:o,required:i=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=t,m=ug(n),h=Rh(d),[g,b]=Jf({prop:o,defaultProp:s??null,onChange:f,caller:lg});return e.jsx(pg,{scope:n,name:a,required:i,disabled:c,value:g,onValueChange:b,children:e.jsx(Zh,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:e.jsx(Qf.div,{role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});hg.displayName=lg;var gg="RadioGroupItem",bg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,disabled:s,...o}=t,i=mg(gg,n),c=i.disabled||s,l=ug(n),d=fg(n),u=a.useRef(null),f=Fl(r,u),p=i.value===o.value,m=a.useRef(!1);return a.useEffect(()=>{const e=e=>{cg.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),e.jsx(Jh,{asChild:!0,...l,focusable:!c,active:p,children:e.jsx(ng,{disabled:c,required:i.required,checked:p,...d,...o,name:i.name,ref:f,onCheck:()=>i.onValueChange(o.value),onKeyDown:$f(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:$f(o.onFocus,()=>{m.current&&u.current?.click()})})})});bg.displayName=gg;var yg=a.forwardRef((t,r)=>{const{__scopeRadioGroup:n,...a}=t,s=fg(n);return e.jsx(sg,{...s,...a,ref:r})});yg.displayName="RadioGroupIndicator";var vg=hg,xg=bg,wg=yg;const Sg=a.forwardRef(({className:t,...r},n)=>e.jsx(vg,{className:je("grid gap-2",t),...r,ref:n}));Sg.displayName=vg.displayName;const kg=a.forwardRef(({className:t,...r},n)=>e.jsx(xg,{ref:n,className:je("aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(wg,{className:"flex items-center justify-center",children:e.jsx(fh,{className:"h-3.5 w-3.5 fill-primary"})})}));function jg(e,[t,r]){return Math.min(r,Math.max(t,e))}kg.displayName=xg.displayName;var Eg="ScrollArea",[Cg]=Wf(Eg),[Ng,Ag]=Cg(Eg),_g=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...c}=t,[l,d]=a.useState(null),[u,f]=a.useState(null),[p,m]=a.useState(null),[h,g]=a.useState(null),[b,y]=a.useState(null),[v,x]=a.useState(0),[w,S]=a.useState(0),[k,j]=a.useState(!1),[E,C]=a.useState(!1),N=Fl(r,e=>d(e)),A=Rh(o);return e.jsx(Ng,{scope:n,type:s,dir:A,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:j,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:x,onCornerHeightChange:S,children:e.jsx(Qf.div,{dir:A,...c,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});_g.displayName=Eg;var Tg="ScrollAreaViewport",Rg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=t,c=Ag(Tg,n),l=Fl(r,a.useRef(null),c.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),e.jsx(Qf.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Rg.displayName=Tg;var Pg="ScrollAreaScrollbar",Og=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=Ag(Pg,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:c}=o,l="horizontal"===t.orientation;return a.useEffect(()=>(l?i(!0):c(!0),()=>{l?i(!1):c(!1)}),[l,i,c]),"hover"===o.type?e.jsx(Ig,{...s,ref:r,forceMount:n}):"scroll"===o.type?e.jsx(Dg,{...s,ref:r,forceMount:n}):"auto"===o.type?e.jsx(Ug,{...s,ref:r,forceMount:n}):"always"===o.type?e.jsx(Fg,{...s,ref:r}):null});Og.displayName=Pg;var Ig=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=Ag(Pg,t.__scopeScrollArea),[i,c]=a.useState(!1);return a.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[o.scrollArea,o.scrollHideDelay]),e.jsx(vp,{present:n||i,children:e.jsx(Ug,{"data-state":i?"visible":"hidden",...s,ref:r})})}),Dg=a.forwardRef((t,r)=>{const{forceMount:n,...s}=t,o=Ag(Pg,t.__scopeScrollArea),i="horizontal"===t.orientation,c=rb(()=>d("SCROLL_END"),100),[l,d]=(u="hidden",f={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},a.useReducer((e,t)=>f[e][t]??e,u));var u,f;return a.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,o.scrollHideDelay,d]),a.useEffect(()=>{const e=o.viewport,t=i?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),c()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[o.viewport,i,d,c]),e.jsx(vp,{present:n||"hidden"!==l,children:e.jsx(Fg,{"data-state":"hidden"===l?"hidden":"visible",...s,ref:r,onPointerEnter:$f(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:$f(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Ug=a.forwardRef((t,r)=>{const n=Ag(Pg,t.__scopeScrollArea),{forceMount:s,...o}=t,[i,c]=a.useState(!1),l="horizontal"===t.orientation,d=rb(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;c(l?e:t)}},10);return nb(n.viewport,d),nb(n.content,d),e.jsx(vp,{present:s||i,children:e.jsx(Fg,{"data-state":i?"visible":"hidden",...o,ref:r})})}),Fg=a.forwardRef((t,r)=>{const{orientation:n="vertical",...s}=t,o=Ag(Pg,t.__scopeScrollArea),i=a.useRef(null),c=a.useRef(0),[l,d]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=qg(l.viewport,l.content),f={...s,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>i.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Yg(r),s=a/2,o=t||s,i=a-o,c=r.scrollbar.paddingStart+o,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Qg([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===n?e.jsx(Mg,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Xg(o.viewport.scrollLeft,l,o.dir);i.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}}):"vertical"===n?e.jsx(zg,{...f,ref:r,onThumbPositionChange:()=>{if(o.viewport&&i.current){const e=Xg(o.viewport.scrollTop,l);i.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}}):null}),Mg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=Ag(Pg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Fl(r,d,i.onScrollbarXChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx($g,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===i.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===i.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Yg(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.x),onDragScroll:e=>t.onDragScroll(e.x),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollLeft+e.deltaX;t.onWheelScroll(n),eb(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Jg(c.paddingLeft),paddingEnd:Jg(c.paddingRight)}})}})}),zg=a.forwardRef((t,r)=>{const{sizes:n,onSizesChange:s,...o}=t,i=Ag(Pg,t.__scopeScrollArea),[c,l]=a.useState(),d=a.useRef(null),u=Fl(r,d,i.onScrollbarYChange);return a.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),e.jsx($g,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Yg(n)+"px",...t.style},onThumbPointerDown:e=>t.onThumbPointerDown(e.y),onDragScroll:e=>t.onDragScroll(e.y),onWheelScroll:(e,r)=>{if(i.viewport){const n=i.viewport.scrollTop+e.deltaY;t.onWheelScroll(n),eb(n,r)&&e.preventDefault()}},onResize:()=>{d.current&&i.viewport&&c&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Jg(c.paddingTop),paddingEnd:Jg(c.paddingBottom)}})}})}),[Lg,Vg]=Cg(Pg),$g=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=t,h=Ag(Pg,n),[g,b]=a.useState(null),y=Fl(r,e=>b(e)),v=a.useRef(null),x=a.useRef(""),w=h.viewport,S=s.content-s.viewport,k=ff(f),j=ff(d),E=rb(p,10);function C(e){if(v.current){const t=e.clientX-v.current.left,r=e.clientY-v.current.top;u({x:t,y:r})}}return a.useEffect(()=>{const e=e=>{const t=e.target,r=g?.contains(t);r&&k(e,S)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,g,S,k]),a.useEffect(j,[s,j]),nb(g,E),nb(h.content,E),e.jsx(Lg,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:ff(i),onThumbPointerUp:ff(c),onThumbPositionChange:j,onThumbPointerDown:ff(l),children:e.jsx(Qf.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:$f(t.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:$f(t.onPointerMove,C),onPointerUp:$f(t.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=x.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),Wg="ScrollAreaThumb",Bg=a.forwardRef((t,r)=>{const{forceMount:n,...a}=t,s=Vg(Wg,t.__scopeScrollArea);return e.jsx(vp,{present:n||s.hasThumb,children:e.jsx(Gg,{ref:r,...a})})}),Gg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,style:s,...o}=t,i=Ag(Wg,n),c=Vg(Wg,n),{onThumbPositionChange:l}=c,d=Fl(r,e=>c.onThumbChange(e)),u=a.useRef(void 0),f=rb(()=>{u.current&&(u.current(),u.current=void 0)},100);return a.useEffect(()=>{const e=i.viewport;if(e){const t=()=>{if(f(),!u.current){const t=tb(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[i.viewport,f,l]),e.jsx(Qf.div,{"data-state":c.hasThumb?"visible":"hidden",...o,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:$f(t.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:$f(t.onPointerUp,c.onThumbPointerUp)})});Bg.displayName=Wg;var Kg="ScrollAreaCorner",Hg=a.forwardRef((t,r)=>{const n=Ag(Kg,t.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?e.jsx(Zg,{...t,ref:r}):null});Hg.displayName=Kg;var Zg=a.forwardRef((t,r)=>{const{__scopeScrollArea:n,...s}=t,o=Ag(Kg,n),[i,c]=a.useState(0),[l,d]=a.useState(0),u=Boolean(i&&l);return nb(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),d(e)}),nb(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),c(e)}),u?e.jsx(Qf.div,{...s,ref:r,style:{width:i,height:l,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...t.style}}):null});function Jg(e){return e?parseInt(e,10):0}function qg(e,t){const r=e/t;return isNaN(r)?0:r}function Yg(e){const t=qg(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Xg(e,t,r="ltr"){const n=Yg(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,o=t.content-t.viewport,i=s-n,c=jg(e,"ltr"===r?[0,o]:[-1*o,0]);return Qg([0,o],[0,i])(c)}function Qg(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function eb(e,t){return e>0&&e<t}var tb=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,i=r.top!==s.top;(o||i)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function rb(e,t){const r=ff(e),n=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),a.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function nb(e,t){const r=ff(t);mf(()=>{let t=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.unobserve(e)}}},[e,r])}var ab=_g,sb=Rg,ob=Hg;const ib=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(ab,{ref:a,className:je("relative overflow-hidden",t),...n,children:[e.jsx(sb,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(cb,{}),e.jsx(ob,{})]}));ib.displayName=ab.displayName;const cb=a.forwardRef(({className:t,orientation:r="vertical",...n},a)=>e.jsx(Og,{ref:a,orientation:r,className:je("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(Bg,{className:je("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));cb.displayName=Og.displayName;var lb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=Vl(`Primitive.${r}`),s=a.forwardRef((t,a)=>{const{asChild:s,...o}=t,i=s?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e.jsx(i,{...o,ref:a})});return s.displayName=`Primitive.${r}`,{...t,[r]:s}},{}),db="horizontal",ub=["horizontal","vertical"],fb=a.forwardRef((t,r)=>{const{decorative:n,orientation:a=db,...s}=t,o=function(e){return ub.includes(e)}(a)?a:db,i=n?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"};return e.jsx(lb.div,{"data-orientation":o,...i,...s,ref:r})});fb.displayName="Separator";var pb=fb;const mb=a.forwardRef(({className:t,orientation:r="horizontal",decorative:n=!0,...a},s)=>e.jsx(pb,{ref:s,decorative:n,orientation:r,className:je("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",t),...a}));mb.displayName=pb.displayName;var hb=Symbol("radix.slottable");var gb="AlertDialog",[bb]=Wf(gb,[km]),yb=km(),vb=t=>{const{__scopeAlertDialog:r,...n}=t,a=yb(r);return e.jsx(eh,{...a,...n,modal:!0})};vb.displayName=gb;var xb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=yb(n);return e.jsx(th,{...s,...a,ref:r})});xb.displayName="AlertDialogTrigger";var wb=t=>{const{__scopeAlertDialog:r,...n}=t,a=yb(r);return e.jsx(rh,{...a,...n})};wb.displayName="AlertDialogPortal";var Sb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=yb(n);return e.jsx(nh,{...s,...a,ref:r})});Sb.displayName="AlertDialogOverlay";var kb="AlertDialogContent",[jb,Eb]=bb(kb),Cb=function(t){const r=({children:t})=>e.jsx(e.Fragment,{children:t});return r.displayName=`${t}.Slottable`,r.__radixId=hb,r}("AlertDialogContent"),Nb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,children:s,...o}=t,i=yb(n),c=a.useRef(null),l=Fl(r,c),d=a.useRef(null);return e.jsx(qm,{contentName:kb,titleName:Ab,docsSlug:"alert-dialog",children:e.jsx(jb,{scope:n,cancelRef:d,children:e.jsxs(ah,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:$f(o.onOpenAutoFocus,e=>{e.preventDefault(),d.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[e.jsx(Cb,{children:s}),e.jsx(Db,{contentRef:c})]})})})});Nb.displayName=kb;var Ab="AlertDialogTitle",_b=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=yb(n);return e.jsx(sh,{...s,...a,ref:r})});_b.displayName=Ab;var Tb="AlertDialogDescription",Rb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=yb(n);return e.jsx(oh,{...s,...a,ref:r})});Rb.displayName=Tb;var Pb=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,s=yb(n);return e.jsx(ih,{...s,...a,ref:r})});Pb.displayName="AlertDialogAction";var Ob="AlertDialogCancel",Ib=a.forwardRef((t,r)=>{const{__scopeAlertDialog:n,...a}=t,{cancelRef:s}=Eb(Ob,n),o=yb(n),i=Fl(r,s);return e.jsx(ih,{...o,...a,ref:i})});Ib.displayName=Ob;var Db=({contentRef:e})=>{const t=`\`${kb}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${kb}\` by passing a \`${Tb}\` component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${kb}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return a.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Ub=Sb,Fb=Nb,Mb=Pb,zb=Ib,Lb=_b,Vb=Rb;const $b=vb,Wb=xb,Bb=wb,Gb=a.forwardRef(({className:t,...r},n)=>e.jsx(Ub,{className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:n}));Gb.displayName=Ub.displayName;const Kb=a.forwardRef(({className:t,...r},n)=>{const{container:s}=a.useContext(Ga);return e.jsxs(Bb,{container:s,children:[e.jsx(Gb,{}),e.jsx(Fb,{ref:n,className:je("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",t),...r})]})});Kb.displayName=Fb.displayName;const Hb=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",t),...r});Hb.displayName="AlertDialogHeader";const Zb=({className:t,...r})=>e.jsx("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Zb.displayName="AlertDialogFooter";const Jb=a.forwardRef(({className:t,...r},n)=>e.jsx(Lb,{ref:n,className:je("text-lg font-semibold",t),...r}));Jb.displayName=Lb.displayName;const qb=a.forwardRef(({className:t,...r},n)=>e.jsx(Vb,{ref:n,className:je("text-sm text-muted-foreground",t),...r}));qb.displayName=Vb.displayName;const Yb=a.forwardRef(({className:t,...r},n)=>e.jsx(Mb,{ref:n,className:je(kd(),t),...r}));Yb.displayName=Mb.displayName;const Xb=a.forwardRef(({className:t,...r},n)=>e.jsx(zb,{ref:n,className:je(kd({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));function Qb(){return e.jsxs("div",{className:"space-y-3.5",children:[e.jsx(Vd,{className:"h-10 w-full"}),e.jsx(Vd,{className:"h-10 w-full"}),e.jsx(Vd,{className:"h-10 w-full"})]})}Xb.displayName=zb.displayName;const ey=({workspace:r})=>{const[n,a]=t.useState(!1),{deleteWorkspace:s}=er(),{user:o}=$a();if(!r)return e.jsx(Qb,{});const i=Ft(r,o?.id??null);return"admin"===i?.toLowerCase()?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Once you delete a workspace, there is no going back. This will permanently delete the workspace ",e.jsx("strong",{children:r.name})," and all of its data, including members, settings, and features."]})]}),e.jsxs($b,{children:[e.jsx(Wb,{asChild:!0,children:e.jsxs(jd,{variant:"destructive",disabled:n,progress:n,children:[e.jsx(yd,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e.jsxs(Kb,{children:[e.jsxs(Hb,{children:[e.jsx(Jb,{children:"Are you absolutely sure?"}),e.jsxs(qb,{children:["This action cannot be undone. This will permanently delete the workspace"," ",e.jsx("strong",{children:r.name})," and all of its data."]})]}),e.jsxs(Zb,{children:[e.jsx(Xb,{disabled:n,children:"Cancel"}),e.jsx(Yb,{onClick:async()=>{a(!0);try{await s(r._id)}catch(e){De(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:r._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{a(!1)}},disabled:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(ud,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var ty="Switch",[ry]=Wf(ty),[ny,ay]=ry(ty),sy=a.forwardRef((t,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:i,required:c,disabled:l,value:d="on",onCheckedChange:u,form:f,...p}=t,[m,h]=a.useState(null),g=Fl(r,e=>h(e)),b=a.useRef(!1),y=!m||(f||!!m.closest("form")),[v,x]=Jf({prop:o,defaultProp:i??!1,onChange:u,caller:ty});return e.jsxs(ny,{scope:n,checked:v,disabled:l,children:[e.jsx(Qf.button,{type:"button",role:"switch","aria-checked":v,"aria-required":c,"data-state":ly(v),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:$f(t.onClick,e=>{x(e=>!e),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&e.jsx(cy,{control:m,bubbles:!b.current,name:s,value:d,checked:v,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});sy.displayName=ty;var oy="SwitchThumb",iy=a.forwardRef((t,r)=>{const{__scopeSwitch:n,...a}=t,s=ay(oy,n);return e.jsx(Qf.span,{"data-state":ly(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r})});iy.displayName=oy;var cy=a.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:s=!0,...o},i)=>{const c=a.useRef(null),l=Fl(c,i),d=Yh(n),u=qh(r);return a.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==n&&r){const t=new Event("click",{bubbles:s});r.call(e,n),e.dispatchEvent(t)}},[d,n,s]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ly(e){return e?"checked":"unchecked"}cy.displayName="SwitchBubbleInput";var dy=sy,uy=iy;const fy=a.forwardRef(({className:t,...r},n)=>e.jsx(dy,{className:je("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:n,children:e.jsx(uy,{className:je("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));fy.displayName=dy.displayName;const py=({workspaceId:r})=>{const[n,a]=t.useState({}),[s,o]=t.useState(null),{allFeatures:i,updateFeature:c,getWorkspace:l}=er(),[d,u]=t.useState(null),{user:f}=$a();if(t.useEffect(()=>{l(r).then(u)},[r]),!d)return e.jsx(Qb,{});const p=Ut(d,f?.id??null);return e.jsxs("div",{children:[s&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:s})]}),e.jsxs("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!p&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!i.length&&e.jsx("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),i.length>0&&e.jsx("div",{className:"flex flex-col gap-y-3.5",children:i.map(t=>{const r=d?.features?.[t.slug],s=null!==n[t.slug]&&void 0!==n[t.slug],l=n[t.slug],f=!0===l?"Enabling":!1===l?"Disabling":"";return e.jsxs("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e.jsxs("div",{className:"flex gap-x-2 flex-col",children:[e.jsx("h3",{className:"font-medium text-ellipsis",children:t.name}),e.jsx("p",{className:"text-muted-foreground",children:t.description})]}),s?e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsx(ud,{className:"h-4 w-4 animate-spin text-gray-500"}),e.jsxs("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):e.jsx(fy,{disabled:!p,checked:r??t.defaultValue,onCheckedChange:e=>async function(e,t){if(d){a(r=>({...r,[e]:t})),o(null);try{const r=await c(d._id,e,t);u(r);const n=i.find(t=>t.slug===e);o(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{o(null)},5e3)}catch(t){De(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:d._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(t.slug,e)})]},t._id)})})]})]})},my={usd:"$",eur:"€",gbp:"£",jpy:"¥",cad:"CA$",aud:"A$",chf:"CHF",cny:"¥",hkd:"HK$",sgd:"S$",inr:"₹",mxn:"MX$",brl:"R$",nzd:"NZ$",sek:"kr",nok:"kr",dkk:"kr",pln:"zł",thb:"฿"},hy={usd:"🇺🇸",eur:"🇪🇺",gbp:"🇬🇧",jpy:"🇯🇵",cad:"🇨🇦",aud:"🇦🇺",chf:"🇨🇭",cny:"🇨🇳",hkd:"🇭🇰",sgd:"🇸🇬",inr:"🇮🇳",mxn:"🇲🇽",brl:"🇧🇷",nzd:"🇳🇿",sek:"🇸🇪",nok:"🇳🇴",dkk:"🇩🇰",pln:"🇵🇱",thb:"🇹🇭"};function gy(e){return e&&e.trim()?hy[e.trim().toLowerCase()]??"":""}function by(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return my[t]??t.toUpperCase()}const yy=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],vy=yy.map(e=>({value:e,label:`${e.toUpperCase()} (${by(e)})`}));function xy(e,t){return by(t)+(e/100).toFixed(2)}function wy(e){return`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50%" y="50%" dominant-baseline="middle" alignment-baseline="middle" text-anchor="middle" font-size="50" font-family="sans-serif">${e}</text></svg>`}const Sy=["🏢","🏬","🏣","🏤","🏦","🏛️","🏠","🏡","🏭","🏗️","🏪","🏨","🏫","🏥","💼","📊","📈","📉","📋","📁","📂","🗂️","🗃️","🗄️","📅","🗓️","📝","🖋️","✏️","🖊️","🖌️","🖍️","📇","📌","📍","📎","🖇️","💻","🖥️","🖨️","🖱️","⌨️","📱","📲","📡","🌐","🔗","🔒","🔓","⚙️","🔧","🛠️","🧑‍💻","👨‍💻","👩‍💻","🕹️","💾","📟","🖥️","🖲️","🚀","💡","🎨","🖼️","🧪","🔬","🧬","🎯","⚡","🎲","🎮","🧩","📷","🎥","✉️","📨","📩","📧","📞","☎️","📠","🗣️","💬","🗨️","📢","📣","🔔","🛎️","💰","💸","💳","🏦","📈","📉","⚖️","🧾","🪙","🏛️","⚗️","🧪","🔭","🔬","🩺","🧬","🩻","🏥","🌱","🌍","🌏","🌎","🌡️","👨‍💼","👩‍💼","👨‍🏫","👩‍🏫","👨‍🔬","👩‍🔬","👨‍🎨","👩‍🎨","👨‍🔧","👩‍🔧","👨‍🚀","👩‍🚀","👨‍⚖️","👩‍⚖️","🏅","🎖️","🥇","🥈","🥉","🏆","🎗️","🔑","🗝️","🧭","🛡️","🚩","🏳️‍🌈","🎟️","🎫"],ky=({workspace:r})=>{const[n,a]=t.useState(!1),[s,o]=t.useState("emoji"),[i,c]=t.useState(),[l,d]=t.useState(null),{updateWorkspace:u}=er(),{user:f}=$a(),p=Co({resolver:Il(Vu({name:mu().min(2,{message:"Workspace name must be at least 2 characters."}),image:mu().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return e.jsx(Qb,{});const m=Ut(r,f?.id??null);return e.jsxs("div",{children:[l&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:l})]}),!m&&e.jsx("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),e.jsx(Td,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){a(!0),d(null);try{await u(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[e.jsx(Pd,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Dd,{children:[e.jsx(Ud,{children:"Name"}),e.jsx(Fd,{children:e.jsx(Ld,{placeholder:"My Awesome Workspace",...t,disabled:!m})}),e.jsx(zd,{})]})}),r.billingCurrency?.trim()&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_d,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[gy(r.billingCurrency)&&e.jsx("span",{className:"text-base",children:gy(r.billingCurrency)}),e.jsx("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(_d,{className:"text-sm font-medium",children:"Icon"}),e.jsx(Md,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(Sg,{value:s,disabled:!m,onValueChange:e=>o(e),className:"flex flex-col space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(kg,{value:"emoji",id:"emoji"}),e.jsxs(_d,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(gd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(kg,{value:"url",id:"url"}),e.jsxs(_d,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(dd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsxs("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[i&&e.jsx("span",{className:"text-2xl",children:i}),!i&&p.watch("image")?.trim()&&e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview"})]})]}),m&&e.jsx(ib,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Sy.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{c(e),p.setValue("image",wy(e))})(t),disabled:!m,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(i===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===s&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Pd,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Dd,{children:[e.jsx(Ud,{children:"Image URL"}),e.jsx(Fd,{children:e.jsx(Ld,{placeholder:"https://example.com/image.png",...t,disabled:!m})}),e.jsx(Md,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(zd,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),e.jsx("div",{className:"flex justify-end gap-3 pt-4",children:m&&e.jsx(jd,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var jy=.999,Ey=/[\\\/_+.#"@\[\(\{&]/,Cy=/[\\\/_+.#"@\[\(\{&]/g,Ny=/[\s-]/,Ay=/[\s-]/g;function _y(e,t,r,n,a,s,o){if(s===t.length)return a===e.length?1:.99;var i=`${a},${s}`;if(void 0!==o[i])return o[i];for(var c,l,d,u,f=n.charAt(s),p=r.indexOf(f,a),m=0;p>=0;)(c=_y(e,t,r,n,p+1,s+1,o))>m&&(p===a?c*=1:Ey.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Cy))&&a>0&&(c*=Math.pow(jy,d.length))):Ny.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(Ay))&&a>0&&(c*=Math.pow(jy,u.length))):(c*=.17,a>0&&(c*=Math.pow(jy,p-a))),e.charAt(p)!==t.charAt(s)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(s+1)||n.charAt(s+1)===n.charAt(s)&&r.charAt(p-1)!==n.charAt(s))&&(.1*(l=_y(e,t,r,n,p+1,s+2,o))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return o[i]=m,m}function Ty(e){return e.toLowerCase().replace(Ay," ")}function Ry(e,t,r){return _y(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Ty(e),Ty(t),0,0,{})}var Py='[cmdk-group=""]',Oy='[cmdk-group-items=""]',Iy='[cmdk-item=""]',Dy=`${Iy}:not([aria-disabled="true"])`,Uy="cmdk-item-select",Fy="data-value",My=(e,t,r)=>Ry(e,t,r),zy=a.createContext(void 0),Ly=()=>a.useContext(zy),Vy=a.createContext(void 0),$y=()=>a.useContext(Vy),Wy=a.createContext(void 0),By=a.forwardRef((e,t)=>{let r=av(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=av(()=>new Set),s=av(()=>new Map),o=av(()=>new Map),i=av(()=>new Set),c=rv(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,v=Hf(),x=Hf(),w=Hf(),S=a.useRef(null),k=iv();nv(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,j.emit()}},[u]),nv(()=>{k(6,T)},[]);let j=a.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,s,o,i;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)_(),N(),k(1,A);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(a=document.getElementById(v))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=R())?void 0:e.id,j.emit()}),n||k(5,T),void 0!==(null==(s=c.current)?void 0:s.value)){let e=null!=t?t:"";return void(null==(i=(o=c.current).onValueChange)||i.call(o,e))}}j.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),E=a.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=o.current.get(e))?void 0:a.value)&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{N(),j.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{_(),N(),r.current.value||A(),j.emit()}),()=>{o.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=R();k(4,()=>{_(),(null==t?void 0:t.getAttribute("id"))===e&&A(),j.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{o.current.delete(e),s.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:v,inputId:w,labelId:x,listInnerRef:S}),[]);function C(e,t){var n,a;let s=null!=(a=null==(n=c.current)?void 0:n.filter)?a:My;return e?s(e,r.current.search,t):0}function N(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),a=0;n.forEach(t=>{let r=e.get(t);a=Math.max(r,a)}),t.push([r,a])});let n=S.current;P().sort((t,r)=>{var n,a;let s=t.getAttribute("id"),o=r.getAttribute("id");return(null!=(n=e.get(o))?n:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(Oy);t?t.appendChild(e.parentElement===t?e:e.closest(`${Oy} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Oy} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Py}[${Fy}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function A(){let e=P().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Fy);j.setState("value",t||void 0)}function _(){var e,t,a,i;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=n.current.size);r.current.filtered.groups=new Set;let l=0;for(let s of n.current){let n=C(null!=(t=null==(e=o.current.get(s))?void 0:e.value)?t:"",null!=(i=null==(a=o.current.get(s))?void 0:a.keywords)?i:[]);r.current.filtered.items.set(s,n),n>0&&l++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=l}function T(){var e,t,r;let n=R();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Py))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function R(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Iy}[aria-selected="true"]`)}function P(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Dy))||[])}function O(e){let t=P()[e];t&&j.setState("value",t.getAttribute(Fy))}function I(e){var t;let r=R(),n=P(),a=n.findIndex(e=>e===r),s=n[a+e];null!=(t=c.current)&&t.loop&&(s=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),s&&j.setState("value",s.getAttribute(Fy))}function D(e){let t,r=R(),n=null==r?void 0:r.closest(Py);for(;n&&!t;)n=e>0?ev(n,Py):tv(n,Py),t=null==n?void 0:n.querySelector(Dy);t?j.setState("value",t.getAttribute(Fy)):I(e)}let U=()=>O(P().length-1),F=e=>{e.preventDefault(),e.metaKey?U():e.altKey?D(1):I(1)},M=e=>{e.preventDefault(),e.metaKey?O(0):e.altKey?D(-1):I(-1)};return a.createElement(Qf.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=y.onKeyDown)||t.call(y,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!e.defaultPrevented&&!r)switch(e.key){case"n":case"j":b&&e.ctrlKey&&F(e);break;case"ArrowDown":F(e);break;case"p":case"k":b&&e.ctrlKey&&M(e);break;case"ArrowUp":M(e);break;case"Home":e.preventDefault(),O(0);break;case"End":e.preventDefault(),U();break;case"Enter":{e.preventDefault();let t=R();if(t){let e=new Event(Uy);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:lv},l),cv(e,e=>a.createElement(Vy.Provider,{value:j},a.createElement(zy.Provider,{value:E},e))))}),Gy=a.forwardRef((e,t)=>{var r,n;let s=Hf(),o=a.useRef(null),i=a.useContext(Wy),c=Ly(),l=rv(e),d=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==i?void 0:i.forceMount;nv(()=>{if(!d)return c.item(s,null==i?void 0:i.id)},[d]);let u=ov(s,o,[e.value,e.children,o],e.keywords),f=$y(),p=sv(e=>e.value&&e.value===u.current),m=sv(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(s)>0));function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(a.useEffect(()=>{let t=o.current;if(t&&!e.disabled)return t.addEventListener(Uy,h),()=>t.removeEventListener(Uy,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:v,forceMount:x,keywords:w,...S}=e;return a.createElement(Qf.div,{ref:Ul(o,t),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||c.getDisablePointerSelection()?void 0:g,onClick:b?void 0:h},e.children)}),Ky=a.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...o}=e,i=Hf(),c=a.useRef(null),l=a.useRef(null),d=Hf(),u=Ly(),f=sv(e=>!(!s&&!1!==u.filter())||(!e.search||e.filtered.groups.has(i)));nv(()=>u.group(i),[]),ov(i,c,[e.value,e.heading,l]);let p=a.useMemo(()=>({id:i,forceMount:s}),[s]);return a.createElement(Qf.div,{ref:Ul(c,t),...o,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&a.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),cv(e,e=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},a.createElement(Wy.Provider,{value:p},e))))}),Hy=a.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=a.useRef(null),o=sv(e=>!e.search);return r||o?a.createElement(Qf.div,{ref:Ul(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),Zy=a.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,o=$y(),i=sv(e=>e.search),c=sv(e=>e.selectedItemId),l=Ly();return a.useEffect(()=>{null!=e.value&&o.setState("search",e.value)},[e.value]),a.createElement(Qf.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:"text",value:s?e.value:i,onChange:e=>{s||o.setState("search",e.target.value),null==r||r(e.target.value)}})}),Jy=a.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,o=a.useRef(null),i=a.useRef(null),c=sv(e=>e.selectedItemId),l=Ly();return a.useEffect(()=>{if(i.current&&o.current){let e,t=i.current,r=o.current,n=new ResizeObserver(()=>{e=requestAnimationFrame(()=>{let e=t.offsetHeight;r.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")})});return n.observe(t),()=>{cancelAnimationFrame(e),n.unobserve(t)}}},[]),a.createElement(Qf.div,{ref:Ul(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":n,id:l.listId},cv(e,e=>a.createElement("div",{ref:Ul(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),qy=a.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:o,container:i,...c}=e;return a.createElement(eh,{open:r,onOpenChange:n},a.createElement(rh,{container:i},a.createElement(nh,{"cmdk-overlay":"",className:s}),a.createElement(ah,{"aria-label":e.label,"cmdk-dialog":"",className:o},a.createElement(By,{ref:t,...c}))))}),Yy=a.forwardRef((e,t)=>sv(e=>0===e.filtered.count)?a.createElement(Qf.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Xy=a.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...o}=e;return a.createElement(Qf.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},cv(e,e=>a.createElement("div",{"aria-hidden":!0},e)))}),Qy=Object.assign(By,{List:Jy,Item:Gy,Input:Zy,Group:Ky,Separator:Hy,Dialog:qy,Empty:Yy,Loading:Xy});function ev(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function tv(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function rv(e){let t=a.useRef(e);return nv(()=>{t.current=e}),t}var nv="undefined"==typeof window?a.useEffect:a.useLayoutEffect;function av(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function sv(e){let t=$y(),r=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,r,r)}function ov(e,t,r,n=[]){let s=a.useRef(),o=Ly();return nv(()=>{var a;let i=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),c=n.map(e=>e.trim());o.value(e,i,c),null==(a=t.current)||a.setAttribute(Fy,i),s.current=i}),s}var iv=()=>{let[e,t]=a.useState(),r=av(()=>new Map);return nv(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function cv({asChild:e,children:t},r){return e&&a.isValidElement(t)?a.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},r(t.props.children)):r(t)}var lv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const dv=a.forwardRef(({className:t,...r},n)=>e.jsx(Qy,{ref:n,className:je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));dv.displayName=Qy.displayName;const uv=a.forwardRef(({className:t,...r},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[e.jsx(gh,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Qy.Input,{ref:n,className:je("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));uv.displayName=Qy.Input.displayName;const fv=a.forwardRef(({className:t,...r},n)=>e.jsx(Qy.List,{ref:n,className:je("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));fv.displayName=Qy.List.displayName;a.forwardRef((t,r)=>e.jsx(Qy.Empty,{ref:r,className:"py-6 text-center text-sm",...t})).displayName=Qy.Empty.displayName;const pv=a.forwardRef(({className:t,...r},n)=>e.jsx(Qy.Group,{ref:n,className:je("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));pv.displayName=Qy.Group.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Qy.Separator,{ref:n,className:je("-mx-1 h-px bg-border",t),...r})).displayName=Qy.Separator.displayName;const mv=a.forwardRef(({className:t,...r},n)=>e.jsx(Qy.Item,{ref:n,className:je("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r}));mv.displayName=Qy.Item.displayName;const hv=["top","right","bottom","left"],gv=Math.min,bv=Math.max,yv=Math.round,vv=Math.floor,xv=e=>({x:e,y:e}),wv={left:"right",right:"left",bottom:"top",top:"bottom"},Sv={start:"end",end:"start"};function kv(e,t,r){return bv(e,gv(t,r))}function jv(e,t){return"function"==typeof e?e(t):e}function Ev(e){return e.split("-")[0]}function Cv(e){return e.split("-")[1]}function Nv(e){return"x"===e?"y":"x"}function Av(e){return"y"===e?"height":"width"}const _v=new Set(["top","bottom"]);function Tv(e){return _v.has(Ev(e))?"y":"x"}function Rv(e){return Nv(Tv(e))}function Pv(e){return e.replace(/start|end/g,e=>Sv[e])}const Ov=["left","right"],Iv=["right","left"],Dv=["top","bottom"],Uv=["bottom","top"];function Fv(e,t,r,n){const a=Cv(e);let s=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Iv:Ov:t?Ov:Iv;case"left":case"right":return t?Dv:Uv;default:return[]}}(Ev(e),"start"===r,n);return a&&(s=s.map(e=>e+"-"+a),t&&(s=s.concat(s.map(Pv)))),s}function Mv(e){return e.replace(/left|right|bottom|top/g,e=>wv[e])}function zv(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Lv(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function Vv(e,t,r){let{reference:n,floating:a}=e;const s=Tv(t),o=Rv(t),i=Av(o),c=Ev(t),l="y"===s,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[i]/2-a[i]/2;let p;switch(c){case"top":p={x:d,y:n.y-a.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-a.width,y:u};break;default:p={x:n.x,y:n.y}}switch(Cv(t)){case"start":p[o]-=f*(r&&l?-1:1);break;case"end":p[o]+=f*(r&&l?-1:1)}return p}async function $v(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:s,rects:o,elements:i,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=jv(t,e),m=zv(p),h=i[f?"floating"===u?"reference":"floating":u],g=Lv(await s.getClippingRect({element:null==(r=await(null==s.isElement?void 0:s.isElement(h)))||r?h:h.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(i.floating)),boundary:l,rootBoundary:d,strategy:c})),b="floating"===u?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(i.floating)),v=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},x=Lv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:y,strategy:c}):b);return{top:(g.top-x.top+m.top)/v.y,bottom:(x.bottom-g.bottom+m.bottom)/v.y,left:(g.left-x.left+m.left)/v.x,right:(x.right-g.right+m.right)/v.x}}function Wv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bv(e){return hv.some(t=>e[t]>=0)}const Gv=new Set(["left","top"]);function Kv(){return"undefined"!=typeof window}function Hv(e){return qv(e)?(e.nodeName||"").toLowerCase():"#document"}function Zv(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Jv(e){var t;return null==(t=(qv(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function qv(e){return!!Kv()&&(e instanceof Node||e instanceof Zv(e).Node)}function Yv(e){return!!Kv()&&(e instanceof Element||e instanceof Zv(e).Element)}function Xv(e){return!!Kv()&&(e instanceof HTMLElement||e instanceof Zv(e).HTMLElement)}function Qv(e){return!(!Kv()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Zv(e).ShadowRoot)}const ex=new Set(["inline","contents"]);function tx(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=px(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!ex.has(a)}const rx=new Set(["table","td","th"]);function nx(e){return rx.has(Hv(e))}const ax=[":popover-open",":modal"];function sx(e){return ax.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const ox=["transform","translate","scale","rotate","perspective"],ix=["transform","translate","scale","rotate","perspective","filter"],cx=["paint","layout","strict","content"];function lx(e){const t=dx(),r=Yv(e)?px(e):e;return ox.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||ix.some(e=>(r.willChange||"").includes(e))||cx.some(e=>(r.contain||"").includes(e))}function dx(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const ux=new Set(["html","body","#document"]);function fx(e){return ux.has(Hv(e))}function px(e){return Zv(e).getComputedStyle(e)}function mx(e){return Yv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hx(e){if("html"===Hv(e))return e;const t=e.assignedSlot||e.parentNode||Qv(e)&&e.host||Jv(e);return Qv(t)?t.host:t}function gx(e){const t=hx(e);return fx(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xv(t)&&tx(t)?t:gx(t)}function bx(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=gx(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),o=Zv(a);if(s){const e=yx(o);return t.concat(o,o.visualViewport||[],tx(a)?a:[],e&&r?bx(e):[])}return t.concat(a,bx(a,[],r))}function yx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vx(e){const t=px(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Xv(e),s=a?e.offsetWidth:r,o=a?e.offsetHeight:n,i=yv(r)!==s||yv(n)!==o;return i&&(r=s,n=o),{width:r,height:n,$:i}}function xx(e){return Yv(e)?e:e.contextElement}function wx(e){const t=xx(e);if(!Xv(t))return xv(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=vx(t);let o=(s?yv(r.width):r.width)/n,i=(s?yv(r.height):r.height)/a;return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}const Sx=xv(0);function kx(e){const t=Zv(e);return dx()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Sx}function jx(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),s=xx(e);let o=xv(1);t&&(n?Yv(n)&&(o=wx(n)):o=wx(e));const i=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Zv(e))&&t}(s,r,n)?kx(s):xv(0);let c=(a.left+i.x)/o.x,l=(a.top+i.y)/o.y,d=a.width/o.x,u=a.height/o.y;if(s){const e=Zv(s),t=n&&Yv(n)?Zv(n):n;let r=e,a=yx(r);for(;a&&n&&t!==r;){const e=wx(a),t=a.getBoundingClientRect(),n=px(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=s,l+=o,r=Zv(a),a=yx(r)}}return Lv({width:d,height:u,x:c,y:l})}function Ex(e,t){const r=mx(e).scrollLeft;return t?t.left+r:jx(Jv(e)).left+r}function Cx(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Ex(e,r),y:r.top+t.scrollTop}}const Nx=new Set(["absolute","fixed"]);function Ax(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Zv(e),n=Jv(e),a=r.visualViewport;let s=n.clientWidth,o=n.clientHeight,i=0,c=0;if(a){s=a.width,o=a.height;const e=dx();(!e||e&&"fixed"===t)&&(i=a.offsetLeft,c=a.offsetTop)}const l=Ex(n);if(l<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,o=Math.abs(n.clientWidth-t.clientWidth-a);o<=25&&(s-=o)}else l<=25&&(s+=l);return{width:s,height:o,x:i,y:c}}(e,r);else if("document"===t)n=function(e){const t=Jv(e),r=mx(e),n=e.ownerDocument.body,a=bv(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=bv(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+Ex(e);const i=-r.scrollTop;return"rtl"===px(n).direction&&(o+=bv(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:o,y:i}}(Jv(e));else if(Yv(t))n=function(e,t){const r=jx(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=Xv(e)?wx(e):xv(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:a*s.x,y:n*s.y}}(t,r);else{const r=kx(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Lv(n)}function _x(e,t){const r=hx(e);return!(r===t||!Yv(r)||fx(r))&&("fixed"===px(r).position||_x(r,t))}function Tx(e,t,r){const n=Xv(t),a=Jv(t),s="fixed"===r,o=jx(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const c=xv(0);function l(){c.x=Ex(a)}if(n||!n&&!s)if(("body"!==Hv(t)||tx(a))&&(i=mx(t)),n){const e=jx(t,!0,s,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();s&&!n&&a&&l();const d=!a||n||s?xv(0):Cx(a,i);return{x:o.left+i.scrollLeft-c.x-d.x,y:o.top+i.scrollTop-c.y-d.y,width:o.width,height:o.height}}function Rx(e){return"static"===px(e).position}function Px(e,t){if(!Xv(e)||"fixed"===px(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Jv(e)===r&&(r=r.ownerDocument.body),r}function Ox(e,t){const r=Zv(e);if(sx(e))return r;if(!Xv(e)){let t=hx(e);for(;t&&!fx(t);){if(Yv(t)&&!Rx(t))return t;t=hx(t)}return r}let n=Px(e,t);for(;n&&nx(n)&&Rx(n);)n=Px(n,t);return n&&fx(n)&&Rx(n)&&!lx(n)?r:n||function(e){let t=hx(e);for(;Xv(t)&&!fx(t);){if(lx(t))return t;if(sx(t))return null;t=hx(t)}return null}(e)||r}const Ix={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s="fixed"===a,o=Jv(n),i=!!t&&sx(t.floating);if(n===o||i&&s)return r;let c={scrollLeft:0,scrollTop:0},l=xv(1);const d=xv(0),u=Xv(n);if((u||!u&&!s)&&(("body"!==Hv(n)||tx(o))&&(c=mx(n)),Xv(n))){const e=jx(n);l=wx(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!o||u||s?xv(0):Cx(o,c);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:r.y*l.y-c.scrollTop*l.y+d.y+f.y}},getDocumentElement:Jv,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s="clippingAncestors"===r?sx(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=bx(e,[],!1).filter(e=>Yv(e)&&"body"!==Hv(e)),a=null;const s="fixed"===px(e).position;let o=s?hx(e):e;for(;Yv(o)&&!fx(o);){const t=px(o),r=lx(o);r||"fixed"!==t.position||(a=null),(s?!r&&!a:!r&&"static"===t.position&&a&&Nx.has(a.position)||tx(o)&&!r&&_x(e,o))?n=n.filter(e=>e!==o):a=t,o=hx(o)}return t.set(e,n),n}(t,this._c):[].concat(r),o=[...s,n],i=o[0],c=o.reduce((e,r)=>{const n=Ax(t,r,a);return e.top=bv(n.top,e.top),e.right=gv(n.right,e.right),e.bottom=gv(n.bottom,e.bottom),e.left=bv(n.left,e.left),e},Ax(t,i,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:Ox,getElementRects:async function(e){const t=this.getOffsetParent||Ox,r=this.getDimensions,n=await r(e.floating);return{reference:Tx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=vx(e);return{width:t,height:r}},getScale:wx,isElement:Yv,isRTL:function(e){return"rtl"===px(e).direction}};function Dx(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ux(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=xx(e),d=a||s?[...l?bx(l):[],...bx(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),s&&e.addEventListener("resize",r)});const u=l&&i?function(e,t){let r,n=null;const a=Jv(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function o(i,c){void 0===i&&(i=!1),void 0===c&&(c=1),s();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(i||t(),!f||!p)return;const m={rootMargin:-vv(u)+"px "+-vv(a.clientWidth-(d+f))+"px "+-vv(a.clientHeight-(u+p))+"px "+-vv(d)+"px",threshold:bv(0,gv(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}1!==n||Dx(l,e.getBoundingClientRect())||o(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),s}(l,r):null;let f,p=-1,m=null;o&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h=c?jx(e):null;return c&&function t(){const n=jx(e);h&&!Dx(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),s&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(f)}}const Fx=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:o,middlewareData:i}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,s=await(null==n.isRTL?void 0:n.isRTL(a.floating)),o=Ev(r),i=Cv(r),c="y"===Tv(r),l=Gv.has(o)?-1:1,d=s&&c?-1:1,u=jv(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&"number"==typeof m&&(p="end"===i?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return o===(null==(r=i.offset)?void 0:r.placement)&&null!=(n=i.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:o}}}}},Mx=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:c={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=jv(e,t),d={x:r,y:n},u=await s.detectOverflow(t,l),f=Tv(Ev(a)),p=Nv(f);let m=d[p],h=d[f];if(o){const e="y"===p?"bottom":"right";m=kv(m+u["y"===p?"top":"left"],m,m-u[e])}if(i){const e="y"===f?"bottom":"right";h=kv(h+u["y"===f?"top":"left"],h,h-u[e])}const g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[p]:o,[f]:i}}}}}},zx=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:o,initialPlacement:i,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=jv(e,t);if(null!=(r=s.arrow)&&r.alignmentOffset)return{};const b=Ev(a),y=Tv(i),v=Ev(i)===i,x=await(null==c.isRTL?void 0:c.isRTL(l.floating)),w=f||(v||!h?[Mv(i)]:function(e){const t=Mv(e);return[Pv(e),t,Pv(t)]}(i)),S="none"!==m;!f&&S&&w.push(...Fv(i,h,m,x));const k=[i,...w],j=await c.detectOverflow(t,g),E=[];let C=(null==(n=s.flip)?void 0:n.overflows)||[];if(d&&E.push(j[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Cv(e),a=Rv(e),s=Av(a);let o="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Mv(o)),[o,Mv(o)]}(a,o,x);E.push(j[e[0]],j[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var N,A;const e=((null==(N=s.flip)?void 0:N.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==Tv(t))||C.every(e=>Tv(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(A=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:A.placement;if(!r)switch(p){case"bestFit":{var _;const e=null==(_=C.filter(e=>{if(S){const t=Tv(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:_[0];e&&(r=e);break}case"initialPlacement":r=i}if(a!==r)return{reset:{placement:r}}}return{}}}},Lx=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:o,elements:i}=t,{apply:c=()=>{},...l}=jv(e,t),d=await o.detectOverflow(t,l),u=Ev(a),f=Cv(a),p="y"===Tv(a),{width:m,height:h}=s.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g="end"===f?"top":"bottom");const y=h-d.top-d.bottom,v=m-d.left-d.right,x=gv(h-d[g],y),w=gv(m-d[b],v),S=!t.middlewareData.shift;let k=x,j=w;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(j=v),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=bv(d.left,0),t=bv(d.right,0),r=bv(d.top,0),n=bv(d.bottom,0);p?j=m-2*(0!==e||0!==t?e+t:bv(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:bv(d.top,d.bottom))}await c({...t,availableWidth:j,availableHeight:k});const E=await o.getDimensions(i.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},Vx=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=jv(e,t);switch(a){case"referenceHidden":{const e=Wv(await n.detectOverflow(t,{...s,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Bv(e)}}}case"escaped":{const e=Wv(await n.detectOverflow(t,{...s,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Bv(e)}}}default:return{}}}}},$x=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:o,elements:i,middlewareData:c}=t,{element:l,padding:d=0}=jv(e,t)||{};if(null==l)return{};const u=zv(d),f={x:r,y:n},p=Rv(a),m=Av(p),h=await o.getDimensions(l),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",x=s.reference[m]+s.reference[p]-f[p]-s.floating[m],w=f[p]-s.reference[p],S=await(null==o.getOffsetParent?void 0:o.getOffsetParent(l));let k=S?S[v]:0;k&&await(null==o.isElement?void 0:o.isElement(S))||(k=i.floating[v]||s.floating[m]);const j=x/2-w/2,E=k/2-h[m]/2-1,C=gv(u[b],E),N=gv(u[y],E),A=C,_=k-h[m]-N,T=k/2-h[m]/2+j,R=kv(A,T,_),P=!c.arrow&&null!=Cv(a)&&T!==R&&s.reference[m]/2-(T<A?C:N)-h[m]/2<0,O=P?T<A?T-A:T-_:0;return{[p]:f[p]+O,data:{[p]:R,centerOffset:T-R-O,...P&&{alignmentOffset:O}},reset:P}}}),Wx=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:o}=t,{offset:i=0,mainAxis:c=!0,crossAxis:l=!0}=jv(e,t),d={x:r,y:n},u=Tv(a),f=Nv(u);let p=d[f],m=d[u];const h=jv(i,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=s.reference[f]-s.floating[e]+g.mainAxis,r=s.reference[f]+s.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var b,y;const e="y"===f?"width":"height",t=Gv.has(Ev(a)),r=s.reference[u]-s.floating[e]+(t&&(null==(b=o.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=s.reference[u]+s.reference[e]+(t?0:(null==(y=o.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Bx=(e,t,r)=>{const n=new Map,a={platform:Ix,...r},s={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:o}=r,i=s.filter(Boolean),c=await(null==o.isRTL?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Vv(l,n,c),f=n,p={},m=0;for(let r=0;r<i.length;r++){var h;const{name:s,fn:g}=i[r],{x:b,y:y,data:v,reset:x}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:{...o,detectOverflow:null!=(h=o.detectOverflow)?h:$v},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p={...p,[s]:{...p[s],...v}},x&&m<=50&&(m++,"object"==typeof x&&(x.placement&&(f=x.placement),x.rects&&(l=!0===x.rects?await o.getElementRects({reference:e,floating:t,strategy:a}):x.rects),({x:d,y:u}=Vv(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:s})};var Gx="undefined"!=typeof document?t.useLayoutEffect:function(){};function Kx(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Kx(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!==n--;){const r=a[n];if(("_owner"!==r||!e.$$typeof)&&!Kx(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Hx(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zx(e,t){const r=Hx(e);return Math.round(t*r)/r}function Jx(e){const t=a.useRef(e);return Gx(()=>{t.current=e}),t}const qx=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(a=r,{}.hasOwnProperty.call(a,"current"))?null!=r.current?$x({element:r.current,padding:n}).fn(t):{}:r?$x({element:r,padding:n}).fn(t):{};var a}}),Yx=(e,t)=>({...Fx(e),options:[e,t]}),Xx=(e,t)=>({...Mx(e),options:[e,t]}),Qx=(e,t)=>({...Wx(e),options:[e,t]}),ew=(e,t)=>({...zx(e),options:[e,t]}),tw=(e,t)=>({...Lx(e),options:[e,t]}),rw=(e,t)=>({...Vx(e),options:[e,t]}),nw=(e,t)=>({...qx(e),options:[e,t]});var aw=a.forwardRef((t,r)=>{const{children:n,width:a=10,height:s=5,...o}=t;return e.jsx(Qf.svg,{...o,ref:r,width:a,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});aw.displayName="Arrow";var sw=aw,ow="Popper",[iw,cw]=Wf(ow),[lw,dw]=iw(ow),uw=t=>{const{__scopePopper:r,children:n}=t,[s,o]=a.useState(null);return e.jsx(lw,{scope:r,anchor:s,onAnchorChange:o,children:n})};uw.displayName=ow;var fw="PopperAnchor",pw=a.forwardRef((t,r)=>{const{__scopePopper:n,virtualRef:s,...o}=t,i=dw(fw,n),c=a.useRef(null),l=Fl(r,c),d=a.useRef(null);return a.useEffect(()=>{const e=d.current;d.current=s?.current||c.current,e!==d.current&&i.onAnchorChange(d.current)}),s?null:e.jsx(Qf.div,{...o,ref:l})});pw.displayName=fw;var mw="PopperContent",[hw,gw]=iw(mw),bw=a.forwardRef((t,r)=>{const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:c="center",alignOffset:l=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,v=dw(mw,n),[x,w]=a.useState(null),S=Fl(r,e=>w(e)),[k,j]=a.useState(null),E=qh(k),C=E?.width??0,N=E?.height??0,A=o+("center"!==c?"-"+c:""),_="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(f)?f:[f],R=T.length>0,P={padding:_,boundary:T.filter(ww),altBoundary:R},{refs:O,floatingStyles:I,placement:D,isPositioned:U,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:i,floating:c}={},transform:l=!0,whileElementsMounted:d,open:u}=e,[f,p]=a.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=a.useState(n);Kx(m,n)||h(n);const[g,b]=a.useState(null),[y,v]=a.useState(null),x=a.useCallback(e=>{e!==j.current&&(j.current=e,b(e))},[]),w=a.useCallback(e=>{e!==E.current&&(E.current=e,v(e))},[]),S=i||g,k=c||y,j=a.useRef(null),E=a.useRef(null),C=a.useRef(f),N=null!=d,A=Jx(d),_=Jx(o),T=Jx(u),R=a.useCallback(()=>{if(!j.current||!E.current)return;const e={placement:t,strategy:r,middleware:m};_.current&&(e.platform=_.current),Bx(j.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==T.current};P.current&&!Kx(C.current,t)&&(C.current=t,s.flushSync(()=>{p(t)}))})},[m,t,r,_,T]);Gx(()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const P=a.useRef(!1);Gx(()=>(P.current=!0,()=>{P.current=!1}),[]),Gx(()=>{if(S&&(j.current=S),k&&(E.current=k),S&&k){if(A.current)return A.current(S,k,R);R()}},[S,k,R,A,N]);const O=a.useMemo(()=>({reference:j,floating:E,setReference:x,setFloating:w}),[x,w]),I=a.useMemo(()=>({reference:S,floating:k}),[S,k]),D=a.useMemo(()=>{const e={position:r,left:0,top:0};if(!I.floating)return e;const t=Zx(I.floating,f.x),n=Zx(I.floating,f.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Hx(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,I.floating,f.x,f.y]);return a.useMemo(()=>({...f,update:R,refs:O,elements:I,floatingStyles:D}),[f,R,O,I,D])}({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>Ux(...e,{animationFrame:"always"===g}),elements:{reference:v.anchor},middleware:[Yx({mainAxis:i+N,alignmentAxis:l}),u&&Xx({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Qx():void 0,...P}),u&&ew({...P}),tw({...P,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:s}=t.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${r}px`),o.setProperty("--radix-popper-available-height",`${n}px`),o.setProperty("--radix-popper-anchor-width",`${a}px`),o.setProperty("--radix-popper-anchor-height",`${s}px`)}}),k&&nw({element:k,padding:d}),Sw({arrowWidth:C,arrowHeight:N}),h&&rw({strategy:"referenceHidden",...P})]}),[M,z]=kw(D),L=ff(b);mf(()=>{U&&L?.()},[U,L]);const V=F.arrow?.x,$=F.arrow?.y,W=0!==F.arrow?.centerOffset,[B,G]=a.useState();return mf(()=>{x&&G(window.getComputedStyle(x).zIndex)},[x]),e.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:U?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(hw,{scope:n,placedSide:M,onArrowChange:j,arrowX:V,arrowY:$,shouldHideArrow:W,children:e.jsx(Qf.div,{"data-side":M,"data-align":z,...y,ref:S,style:{...y.style,animation:U?void 0:"none"}})})})});bw.displayName=mw;var yw="PopperArrow",vw={top:"bottom",right:"left",bottom:"top",left:"right"},xw=a.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,s=gw(yw,n),o=vw[s.placedSide];return e.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:e.jsx(sw,{...a,ref:r,style:{...a.style,display:"block"}})})});function ww(e){return null!==e}xw.displayName=yw;var Sw=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,s=0!==a.arrow?.centerOffset,o=s?0:e.arrowWidth,i=s?0:e.arrowHeight,[c,l]=kw(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+o/2,f=(a.arrow?.y??0)+i/2;let p="",m="";return"bottom"===c?(p=s?d:`${u}px`,m=-i+"px"):"top"===c?(p=s?d:`${u}px`,m=`${n.floating.height+i}px`):"right"===c?(p=-i+"px",m=s?d:`${f}px`):"left"===c&&(p=`${n.floating.width+i}px`,m=s?d:`${f}px`),{data:{x:p,y:m}}}});function kw(e){const[t,r="center"]=e.split("-");return[t,r]}var jw=uw,Ew=pw,Cw=bw,Nw=xw;function Aw(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _w=Symbol("radix.slottable");function Tw(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===_w}var Rw="Popover",[Pw]=Wf(Rw,[cw]),Ow=cw(),[Iw,Dw]=Pw(Rw),Uw=t=>{const{__scopePopover:r,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!1}=t,l=Ow(r),d=a.useRef(null),[u,f]=a.useState(!1),[p,m]=Jf({prop:s,defaultProp:o??!1,onChange:i,caller:Rw});return e.jsx(jw,{...l,children:e.jsx(Iw,{scope:r,contentId:Hf(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:a.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:a.useCallback(()=>f(!0),[]),onCustomAnchorRemove:a.useCallback(()=>f(!1),[]),modal:c,children:n})})};Uw.displayName=Rw;var Fw="PopoverAnchor";a.forwardRef((t,r)=>{const{__scopePopover:n,...s}=t,o=Dw(Fw,n),i=Ow(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=o;return a.useEffect(()=>(c(),()=>l()),[c,l]),e.jsx(Ew,{...i,...s,ref:r})}).displayName=Fw;var Mw="PopoverTrigger",zw=a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=Dw(Mw,n),o=Ow(n),i=Fl(r,s.triggerRef),c=e.jsx(Qf.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Yw(s.open),...a,ref:i,onClick:$f(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:e.jsx(Ew,{asChild:!0,...o,children:c})});zw.displayName=Mw;var Lw="PopoverPortal",[Vw,$w]=Pw(Lw,{forceMount:void 0}),Ww=t=>{const{__scopePopover:r,forceMount:n,children:a,container:s}=t,o=Dw(Lw,r);return e.jsx(Vw,{scope:r,forceMount:n,children:e.jsx(vp,{present:n||o.open,children:e.jsx(yp,{asChild:!0,container:s,children:a})})})};Ww.displayName=Lw;var Bw="PopoverContent",Gw=a.forwardRef((t,r)=>{const n=$w(Bw,t.__scopePopover),{forceMount:a=n.forceMount,...s}=t,o=Dw(Bw,t.__scopePopover);return e.jsx(vp,{present:a||o.open,children:o.modal?e.jsx(Hw,{...s,ref:r}):e.jsx(Zw,{...s,ref:r})})});Gw.displayName=Bw;var Kw=function(t){const r=Aw(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(Tw);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("PopoverContent.RemoveScroll"),Hw=a.forwardRef((t,r)=>{const n=Dw(Bw,t.__scopePopover),s=a.useRef(null),o=Fl(r,s),i=a.useRef(!1);return a.useEffect(()=>{const e=s.current;if(e)return bm(e)},[]),e.jsx(dm,{as:Kw,allowPinchZoom:!0,children:e.jsx(Jw,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$f(t.onCloseAutoFocus,e=>{e.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:$f(t.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;i.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:$f(t.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Zw=a.forwardRef((t,r)=>{const n=Dw(Bw,t.__scopePopover),s=a.useRef(!1),o=a.useRef(!1);return e.jsx(Jw,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),e.defaultPrevented||(s.current||n.triggerRef.current?.focus(),e.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:e=>{t.onInteractOutside?.(e),e.defaultPrevented||(s.current=!0,"pointerdown"===e.detail.originalEvent.type&&(o.current=!0));const r=e.target,a=n.triggerRef.current?.contains(r);a&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&o.current&&e.preventDefault()}})}),Jw=a.forwardRef((t,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=t,p=Dw(Bw,n),m=Ow(n);return Sp(),e.jsx(up,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:e.jsx(sp,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:e.jsx(Cw,{"data-state":Yw(p.open),role:"dialog",id:p.contentId,...m,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),qw="PopoverClose";a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=Dw(qw,n);return e.jsx(Qf.button,{type:"button",...a,ref:r,onClick:$f(t.onClick,()=>s.onOpenChange(!1))})}).displayName=qw;function Yw(e){return e?"open":"closed"}a.forwardRef((t,r)=>{const{__scopePopover:n,...a}=t,s=Ow(n);return e.jsx(Nw,{...s,...a,ref:r})}).displayName="PopoverArrow";var Xw=Ww,Qw=Gw;const eS=Uw,tS=zw,rS=a.forwardRef(({className:t,align:r="center",sideOffset:n=4,...s},o)=>{const{container:i}=a.useContext(Ga);return e.jsx(Xw,{container:i,children:e.jsx(Qw,{ref:o,align:r,sideOffset:n,className:je("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})})});function nS({options:r,value:n,onChange:a,placeholder:s="Search...",emptyLabel:o="Choose option"}){const[i,c]=t.useState(n??""),[l,d]=t.useState(!1);t.useEffect(()=>{void 0!==n&&c(n)},[n]);const u=r.find(e=>e.value===i);return e.jsxs(eS,{open:l,onOpenChange:d,children:[e.jsx(tS,{asChild:!0,children:e.jsxs(jd,{variant:"outline",role:"combobox","aria-expanded":l,className:"justify-between overflow-hidden text-ellipsis",children:[u?e.jsxs("div",{children:[String(u.label).trim(),u.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:u.icon})]}):e.jsx("span",{className:"text-muted-foreground",children:o}),e.jsx(sd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(rS,{className:"p-0 overflow-hidden text-ellipsis",children:e.jsxs(dv,{children:[e.jsx(uv,{placeholder:s}),e.jsx(fv,{children:e.jsx(pv,{children:r.map(t=>e.jsxs(mv,{className:je("whitespace-nowrap text-left",{"text-green-500":i===t.value}),value:t.value,defaultValue:t.value,onSelect:()=>{return e=t.value,c(e),a?.(e),void d(!1);var e},children:[i===t.value&&e.jsx(ad,{className:je("mr-2 h-4 w-4 text-green-400",i===t.value?"opacity-100":"opacity-0")}),String(t.label).trim(),t.icon&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:t.icon})]},t.value))})})]})})]})}rS.displayName=Qw.displayName;const aS={USD:"$",EUR:"€",JPY:"¥",GBP:"£",AUD:"A$",CAD:"C$",CHF:"CHF",CNY:"¥",SEK:"kr",NZD:"NZ$",INR:"₹",RUB:"₽",KRW:"₩",BRL:"R$",ZAR:"R",HKD:"HK$",SGD:"S$",MXN:"Mex$",NOK:"kr",TRY:"₺",IDR:"Rp",PLN:"zł",THB:"฿",ILS:"₪",PHP:"₱",MYR:"RM",CZK:"Kč",HUF:"Ft",DKK:"kr",PKR:"₨",EGP:"£",NGN:"₦",BDT:"৳",UAH:"₴",KZT:"₸",VND:"₫",ARS:"$",BGN:"лв",COP:"COL$",HRK:"kn",ISK:"kr",KES:"KSh",LKR:"Rs",MAD:"د.م.",MNT:"₮",NPR:"रू",RSD:"дин.",SAR:"ر.س",TWD:"NT$",UYU:"$U",YER:"﷼",FJD:"FJ$",JMD:"J$",HTG:"G",BHD:"ب.د",KWD:"د.ك",OMR:"ر.ع.",BND:"B$",KPW:"₩",GHS:"₵",SYP:"ل.س",SLL:"Le",SSP:"£",AFN:"؋",MGA:"Ar",MDL:"lei",FOK:"kr",GMD:"D",LTL:"Lt",LVL:"Ls",HNL:"L",GEL:"₾",BMD:"$",AWG:"Afl",BTN:"Nu",GTQ:"Q",TZS:"TSh",BBD:"Bds$",NAD:"N$",BZD:"$",JEP:"£",WST:"T",PGK:"K",KGS:"лв",AZN:"₼",QAR:"ر.ق",XOF:"CFA",XPF:"CFP"},sS={AF:"AFN",AX:"EUR",AL:"ALL",DZ:"DZD",AS:"USD",AD:"EUR",AO:"AOA",AI:"XCD",AQ:"USD",AG:"XCD",AR:"ARS",AM:"AMD",AW:"AWG",AU:"AUD",AT:"EUR",AZ:"AZN",BS:"BSD",BH:"BHD",BD:"BDT",BB:"BBD",BY:"BYN",BE:"EUR",BZ:"BZD",BJ:"XOF",BM:"BMD",BT:"BTN",BO:"BOB",BA:"BAM",BW:"BWP",BV:"NOK",BR:"BRL",IO:"USD",BN:"BND",BG:"BGN",BF:"XOF",BI:"BIF",KH:"KHR",CM:"XAF",CA:"CAD",CV:"CVE",KY:"KYD",CF:"XAF",TD:"XAF",CL:"CLP",CN:"CNY",CX:"AUD",CC:"AUD",CO:"COP",KM:"KMF",CG:"XAF",CD:"CDF",CK:"NZD",CR:"CRC",CI:"XOF",HR:"HRK",CU:"CUP",CY:"EUR",CZ:"CZK",DK:"DKK",DJ:"DJF",DM:"XCD",DO:"DOP",EC:"USD",EG:"EGP",SV:"USD",GQ:"XAF",ER:"ERN",EE:"EUR",ET:"ETB",FK:"FKP",FO:"DKK",FJ:"FJD",FI:"EUR",FR:"EUR",GF:"EUR",PF:"XPF",TF:"EUR",GA:"XAF",GM:"GMD",GE:"GEL",DE:"EUR",GH:"GHS",GI:"GIP",GR:"EUR",GL:"DKK",GD:"XCD",GP:"EUR",GU:"USD",GT:"GTQ",GG:"GBP",GN:"GNF",GW:"XOF",GY:"GYD",HT:"HTG",HM:"AUD",VA:"EUR",HN:"HNL",HK:"HKD",HU:"HUF",IS:"ISK",IN:"INR",ID:"IDR",IR:"IRR",IQ:"IQD",IE:"EUR",IM:"GBP",IL:"ILS",IT:"EUR",JM:"JMD",JP:"JPY",JE:"GBP",JO:"JOD",KZ:"KZT",KE:"KES",KI:"AUD",KP:"KPW",KR:"KRW",KW:"KWD",KG:"KGS",LA:"LAK",LV:"EUR",LB:"LBP",LS:"LSL",LR:"LRD",LY:"LYD",LI:"CHF",LT:"EUR",LU:"EUR",MO:"MOP",MK:"MKD",MG:"MGA",MW:"MWK",MY:"MYR",MV:"MVR",ML:"XOF",MT:"EUR",MH:"USD",MQ:"EUR",MR:"MRU",MU:"MUR",YT:"EUR",MX:"MXN",FM:"USD",MD:"MDL",MC:"EUR",MN:"MNT",ME:"EUR",MS:"XCD",MA:"MAD",MZ:"MZN",MM:"MMK",NA:"NAD",NR:"AUD",NP:"NPR",NL:"EUR",AN:"ANG",NC:"XPF",NZ:"NZD",NI:"NIO",NE:"XOF",NG:"NGN",NU:"NZD",NF:"AUD",MP:"USD",NO:"NOK",OM:"OMR",PK:"PKR",PW:"USD",PS:"ILS",PA:"PAB",PG:"PGK",PY:"PYG",PE:"PEN",PH:"PHP",PN:"NZD",PL:"PLN",PT:"EUR",PR:"USD",QA:"QAR",RE:"EUR",RO:"RON",RU:"RUB",RW:"RWF",SH:"SHP",KN:"XCD",LC:"XCD",PM:"EUR",VC:"XCD",WS:"WST",SM:"EUR",ST:"STN",SA:"SAR",SN:"XOF",RS:"RSD",SC:"SCR",SL:"SLL",SG:"SGD",SK:"EUR",SI:"EUR",SB:"SBD",SO:"SOS",ZA:"ZAR",GS:"GBP",ES:"EUR",LK:"LKR",SD:"SDG",SR:"SRD",SJ:"NOK",SZ:"SZL",SE:"SEK",CH:"CHF",SY:"SYP",TW:"TWD",TJ:"TJS",TZ:"TZS",TH:"THB"},oS=[{name:"Afghanistan",code:"AF"},{name:"land Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"},{name:"American Samoa",code:"AS"},{name:"AndorrA",code:"AD"},{name:"Angola",code:"AO"},{name:"Anguilla",code:"AI"},{name:"Antarctica",code:"AQ"},{name:"Antigua and Barbuda",code:"AG"},{name:"Argentina",code:"AR"},{name:"Armenia",code:"AM"},{name:"Aruba",code:"AW"},{name:"Australia",code:"AU"},{name:"Austria",code:"AT"},{name:"Azerbaijan",code:"AZ"},{name:"Bahamas",code:"BS"},{name:"Bahrain",code:"BH"},{name:"Bangladesh",code:"BD"},{name:"Barbados",code:"BB"},{name:"Belarus",code:"BY"},{name:"Belgium",code:"BE"},{name:"Belize",code:"BZ"},{name:"Benin",code:"BJ"},{name:"Bermuda",code:"BM"},{name:"Bhutan",code:"BT"},{name:"Bolivia",code:"BO"},{name:"Bosnia and Herzegovina",code:"BA"},{name:"Botswana",code:"BW"},{name:"Bouvet Island",code:"BV"},{name:"Brazil",code:"BR"},{name:"British Indian Ocean Territory",code:"IO"},{name:"Brunei Darussalam",code:"BN"},{name:"Bulgaria",code:"BG"},{name:"Burkina Faso",code:"BF"},{name:"Burundi",code:"BI"},{name:"Cambodia",code:"KH"},{name:"Cameroon",code:"CM"},{name:"Canada",code:"CA"},{name:"Cape Verde",code:"CV"},{name:"Cayman Islands",code:"KY"},{name:"Central African Republic",code:"CF"},{name:"Chad",code:"TD"},{name:"Chile",code:"CL"},{name:"China",code:"CN"},{name:"Christmas Island",code:"CX"},{name:"Cocos (Keeling) Islands",code:"CC"},{name:"Colombia",code:"CO"},{name:"Comoros",code:"KM"},{name:"Congo",code:"CG"},{name:"Congo, The Democratic Republic of the",code:"CD"},{name:"Cook Islands",code:"CK"},{name:"Costa Rica",code:"CR"},{name:"Cote D Ivoire",code:"CI"},{name:"Croatia",code:"HR"},{name:"Cuba",code:"CU"},{name:"Cyprus",code:"CY"},{name:"Czech Republic",code:"CZ"},{name:"Denmark",code:"DK"},{name:"Djibouti",code:"DJ"},{name:"Dominica",code:"DM"},{name:"Dominican Republic",code:"DO"},{name:"Ecuador",code:"EC"},{name:"Egypt",code:"EG"},{name:"El Salvador",code:"SV"},{name:"Equatorial Guinea",code:"GQ"},{name:"Eritrea",code:"ER"},{name:"Estonia",code:"EE"},{name:"Ethiopia",code:"ET"},{name:"Falkland Islands (Malvinas)",code:"FK"},{name:"Faroe Islands",code:"FO"},{name:"Fiji",code:"FJ"},{name:"Finland",code:"FI"},{name:"France",code:"FR"},{name:"French Guiana",code:"GF"},{name:"French Polynesia",code:"PF"},{name:"French Southern Territories",code:"TF"},{name:"Gabon",code:"GA"},{name:"Gambia",code:"GM"},{name:"Georgia",code:"GE"},{name:"Germany",code:"DE"},{name:"Ghana",code:"GH"},{name:"Gibraltar",code:"GI"},{name:"Greece",code:"GR"},{name:"Greenland",code:"GL"},{name:"Grenada",code:"GD"},{name:"Guadeloupe",code:"GP"},{name:"Guam",code:"GU"},{name:"Guatemala",code:"GT"},{name:"Guernsey",code:"GG"},{name:"Guinea",code:"GN"},{name:"Guinea-Bissau",code:"GW"},{name:"Guyana",code:"GY"},{name:"Haiti",code:"HT"},{name:"Heard Island and Mcdonald Islands",code:"HM"},{name:"Holy See (Vatican City State)",code:"VA"},{name:"Honduras",code:"HN"},{name:"Hong Kong",code:"HK"},{name:"Hungary",code:"HU"},{name:"Iceland",code:"IS"},{name:"India",code:"IN"},{name:"Indonesia",code:"ID"},{name:"Iran, Islamic Republic Of",code:"IR"},{name:"Iraq",code:"IQ"},{name:"Ireland",code:"IE"},{name:"Isle of Man",code:"IM"},{name:"Israel",code:"IL"},{name:"Italy",code:"IT"},{name:"Jamaica",code:"JM"},{name:"Japan",code:"JP"},{name:"Jersey",code:"JE"},{name:"Jordan",code:"JO"},{name:"Kazakhstan",code:"KZ"},{name:"Kenya",code:"KE"},{name:"Kiribati",code:"KI"},{name:'Korea, Democratic People"S Republic of',code:"KP"},{name:"Korea, Republic of",code:"KR"},{name:"Kuwait",code:"KW"},{name:"Kyrgyzstan",code:"KG"},{name:'Lao People"S Democratic Republic',code:"LA"},{name:"Latvia",code:"LV"},{name:"Lebanon",code:"LB"},{name:"Lesotho",code:"LS"},{name:"Liberia",code:"LR"},{name:"Libyan Arab Jamahiriya",code:"LY"},{name:"Liechtenstein",code:"LI"},{name:"Lithuania",code:"LT"},{name:"Luxembourg",code:"LU"},{name:"Macao",code:"MO"},{name:"Macedonia, The Former Yugoslav Republic of",code:"MK"},{name:"Madagascar",code:"MG"},{name:"Malawi",code:"MW"},{name:"Malaysia",code:"MY"},{name:"Maldives",code:"MV"},{name:"Mali",code:"ML"},{name:"Malta",code:"MT"},{name:"Marshall Islands",code:"MH"},{name:"Martinique",code:"MQ"},{name:"Mauritania",code:"MR"},{name:"Mauritius",code:"MU"},{name:"Mayotte",code:"YT"},{name:"Mexico",code:"MX"},{name:"Micronesia, Federated States of",code:"FM"},{name:"Moldova, Republic of",code:"MD"},{name:"Monaco",code:"MC"},{name:"Mongolia",code:"MN"},{name:"Montenegro",code:"ME"},{name:"Montserrat",code:"MS"},{name:"Morocco",code:"MA"},{name:"Mozambique",code:"MZ"},{name:"Myanmar",code:"MM"},{name:"Namibia",code:"NA"},{name:"Nauru",code:"NR"},{name:"Nepal",code:"NP"},{name:"Netherlands",code:"NL"},{name:"Netherlands Antilles",code:"AN"},{name:"New Caledonia",code:"NC"},{name:"New Zealand",code:"NZ"},{name:"Nicaragua",code:"NI"},{name:"Niger",code:"NE"},{name:"Nigeria",code:"NG"},{name:"Niue",code:"NU"},{name:"Norfolk Island",code:"NF"},{name:"Northern Mariana Islands",code:"MP"},{name:"Norway",code:"NO"},{name:"Oman",code:"OM"},{name:"Pakistan",code:"PK"},{name:"Palau",code:"PW"},{name:"Palestinian Territory, Occupied",code:"PS"},{name:"Panama",code:"PA"},{name:"Papua New Guinea",code:"PG"},{name:"Paraguay",code:"PY"},{name:"Peru",code:"PE"},{name:"Philippines",code:"PH"},{name:"Pitcairn",code:"PN"},{name:"Poland",code:"PL"},{name:"Portugal",code:"PT"},{name:"Puerto Rico",code:"PR"},{name:"Qatar",code:"QA"},{name:"Reunion",code:"RE"},{name:"Romania",code:"RO"},{name:"Russian Federation",code:"RU"},{name:"RWANDA",code:"RW"},{name:"Saint Helena",code:"SH"},{name:"Saint Kitts and Nevis",code:"KN"},{name:"Saint Lucia",code:"LC"},{name:"Saint Pierre and Miquelon",code:"PM"},{name:"Saint Vincent and the Grenadines",code:"VC"},{name:"Samoa",code:"WS"},{name:"San Marino",code:"SM"},{name:"Sao Tome and Principe",code:"ST"},{name:"Saudi Arabia",code:"SA"},{name:"Senegal",code:"SN"},{name:"Serbia",code:"RS"},{name:"Seychelles",code:"SC"},{name:"Sierra Leone",code:"SL"},{name:"Singapore",code:"SG"},{name:"Slovakia",code:"SK"},{name:"Slovenia",code:"SI"},{name:"Solomon Islands",code:"SB"},{name:"Somalia",code:"SO"},{name:"South Africa",code:"ZA"},{name:"South Georgia and the South Sandwich Islands",code:"GS"},{name:"Spain",code:"ES"},{name:"Sri Lanka",code:"LK"},{name:"Sudan",code:"SD"},{name:"Suriname",code:"SR"},{name:"Svalbard and Jan Mayen",code:"SJ"},{name:"Swaziland",code:"SZ"},{name:"Sweden",code:"SE"},{name:"Switzerland",code:"CH"},{name:"Syrian Arab Republic",code:"SY"},{name:"Taiwan, Province of China",code:"TW"},{name:"Tajikistan",code:"TJ"},{name:"Tanzania, United Republic of",code:"TZ"},{name:"Thailand",code:"TH"},{name:"Timor-Leste",code:"TL"},{name:"Togo",code:"TG"},{name:"Tokelau",code:"TK"},{name:"Tonga",code:"TO"},{name:"Trinidad and Tobago",code:"TT"},{name:"Tunisia",code:"TN"},{name:"Turkey",code:"TR"},{name:"Turkmenistan",code:"TM"},{name:"Turks and Caicos Islands",code:"TC"},{name:"Tuvalu",code:"TV"},{name:"Uganda",code:"UG"},{name:"Ukraine",code:"UA"},{name:"United Arab Emirates",code:"AE"},{name:"United Kingdom",code:"GB"},{name:"United States",code:"US"},{name:"United States Minor Outlying Islands",code:"UM"},{name:"Uruguay",code:"UY"},{name:"Uzbekistan",code:"UZ"},{name:"Vanuatu",code:"VU"},{name:"Venezuela",code:"VE"},{name:"Viet Nam",code:"VN"},{name:"Virgin Islands, British",code:"VG"},{name:"Virgin Islands, U.S.",code:"VI"},{name:"Wallis and Futuna",code:"WF"},{name:"Western Sahara",code:"EH"},{name:"Yemen",code:"YE"},{name:"Zambia",code:"ZM"},{name:"Zimbabwe",code:"ZW"}].map(e=>{const t=sS[e.code]||"USD",r=aS[t]||"";return{value:e.code,flag:(n=e.code,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))),text:e.name,currencyCode:t,currencyIcon:r};var n});function iS({value:t,onChange:r}){const n=oS.map(e=>({value:e.value,label:e.text,icon:e.flag}));return e.jsx(nS,{options:n,value:t,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const cS=oS.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),lS=Array.from(new Set(cS.map(e=>e.value))).map(e=>cS.find(t=>t.value===e)).filter(e=>void 0!==e);function dS({value:t,onChange:r}){const n=lS.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return e.jsx(nS,{options:n,value:t,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let uS=[{code:"en",label:"English",flag:"🇬🇧"},{code:"en-GB",label:"English (United Kingdom)",flag:"🇬🇧"},{code:"en-US",label:"English (United States)",flag:"🇺🇸"},{code:"en-AU",label:"English (Australia)",flag:"🇦🇺"},{code:"en-CA",label:"English (Canada)",flag:"🇨🇦"},{code:"en-NZ",label:"English (New Zealand)",flag:"🇳🇿"},{code:"es",label:"Spanish",flag:"🇪🇸"},{code:"es-ES",label:"Spanish (Spain)",flag:"🇪🇸"},{code:"es-MX",label:"Spanish (Mexico)",flag:"🇲🇽"},{code:"fr",label:"French",flag:"🇫🇷"},{code:"fr-FR",label:"French (France)",flag:"🇫🇷"},{code:"de",label:"German",flag:"🇩🇪"},{code:"de-DE",label:"German (Germany)",flag:"🇩🇪"},{code:"it",label:"Italian",flag:"🇮🇹"},{code:"it-IT",label:"Italian (Italy)",flag:"🇮🇹"},{code:"pt",label:"Portuguese",flag:"🇵🇹"},{code:"pt-PT",label:"Portuguese (Portugal)",flag:"🇵🇹"},{code:"pt-BR",label:"Portuguese (Brazil)",flag:"🇧🇷"},{code:"ru",label:"Russian",flag:"🇷🇺"},{code:"ru-RU",label:"Russian (Russia)",flag:"🇷🇺"},{code:"zh",label:"Chinese",flag:"🇨🇳"},{code:"zh-CN",label:"Chinese (Simplified)",flag:"🇨🇳"},{code:"zh-TW",label:"Chinese (Traditional)",flag:"🇹🇼"},{code:"ja",label:"Japanese",flag:"🇯🇵"},{code:"ja-JP",label:"Japanese (Japan)",flag:"🇯🇵"},{code:"ko",label:"Korean",flag:"🇰🇷"},{code:"ko-KR",label:"Korean (South Korea)",flag:"🇰🇷"},{code:"ar",label:"Arabic",flag:"🇸🇦"},{code:"ar-SA",label:"Arabic (Saudi Arabia)",flag:"🇸🇦"},{code:"hi",label:"Hindi",flag:"🇮🇳"},{code:"hi-IN",label:"Hindi (India)",flag:"🇮🇳"},{code:"bn",label:"Bengali",flag:"🇮🇳"},{code:"bn-IN",label:"Bengali (India)",flag:"🇮🇳"},{code:"gu",label:"Gujarati",flag:"🇮🇳"},{code:"gu-IN",label:"Gujarati (India)",flag:"🇮🇳"},{code:"ta",label:"Tamil",flag:"🇮🇳"},{code:"ta-IN",label:"Tamil (India)",flag:"🇮🇳"},{code:"te",label:"Telugu",flag:"🇮🇳"},{code:"te-IN",label:"Telugu (India)",flag:"🇮🇳"},{code:"ml",label:"Malayalam",flag:"🇮🇳"},{code:"ml-IN",label:"Malayalam (India)",flag:"🇮🇳"},{code:"kn",label:"Kannada",flag:"🇮🇳"},{code:"kn-IN",label:"Kannada (India)",flag:"🇮🇳"},{code:"mr",label:"Marathi",flag:"🇮🇳"},{code:"mr-IN",label:"Marathi (India)",flag:"🇮🇳"},{code:"pa",label:"Punjabi",flag:"🇮🇳"},{code:"pa-IN",label:"Punjabi (India)",flag:"🇮🇳"},{code:"ur",label:"Urdu",flag:"🇮🇳"},{code:"ur-IN",label:"Urdu (India)",flag:"🇮🇳"},{code:"or",label:"Odia",flag:"🇮🇳"},{code:"or-IN",label:"Odia (India)",flag:"🇮🇳"},{code:"as",label:"Assamese",flag:"🇮🇳"},{code:"as-IN",label:"Assamese (India)",flag:"🇮🇳"},{code:"zh-HK",label:"Chinese (Hong Kong)",flag:"🇭🇰"},{code:"nl",label:"Dutch",flag:"🇳🇱"},{code:"nl-NL",label:"Dutch (Netherlands)",flag:"🇳🇱"},{code:"pl",label:"Polish",flag:"🇵🇱"},{code:"pl-PL",label:"Polish (Poland)",flag:"🇵🇱"},{code:"sv",label:"Swedish",flag:"🇸🇪"},{code:"sv-SE",label:"Swedish (Sweden)",flag:"🇸🇪"},{code:"da",label:"Danish",flag:"🇩🇰"},{code:"da-DK",label:"Danish (Denmark)",flag:"🇩🇰"},{code:"no",label:"Norwegian",flag:"🇳🇴"},{code:"no-NO",label:"Norwegian (Norway)",flag:"🇳🇴"},{code:"fi",label:"Finnish",flag:"🇫🇮"},{code:"fi-FI",label:"Finnish (Finland)",flag:"🇫🇮"},{code:"tr",label:"Turkish",flag:"🇹🇷"},{code:"tr-TR",label:"Turkish (Turkey)",flag:"🇹🇷"},{code:"cs",label:"Czech",flag:"🇨🇿"},{code:"cs-CZ",label:"Czech (Czech Republic)",flag:"🇨🇿"},{code:"sk",label:"Slovak",flag:"🇸🇰"},{code:"sk-SK",label:"Slovak (Slovakia)",flag:"🇸🇰"},{code:"hu",label:"Hungarian",flag:"🇭🇺"},{code:"hu-HU",label:"Hungarian (Hungary)",flag:"🇭🇺"},{code:"ro",label:"Romanian",flag:"🇷🇴"},{code:"ro-RO",label:"Romanian (Romania)",flag:"🇷🇴"},{code:"el",label:"Greek",flag:"🇬🇷"},{code:"el-GR",label:"Greek (Greece)",flag:"🇬🇷"},{code:"th",label:"Thai",flag:"🇹🇭"},{code:"th-TH",label:"Thai (Thailand)",flag:"🇹🇭"},{code:"id",label:"Indonesian",flag:"🇮🇩"},{code:"id-ID",label:"Indonesian (Indonesia)",flag:"🇮🇩"},{code:"ms",label:"Malay",flag:"🇲🇾"},{code:"ms-MY",label:"Malay (Malaysia)",flag:"🇲🇾"},{code:"vi",label:"Vietnamese",flag:"🇻🇳"},{code:"vi-VN",label:"Vietnamese (Vietnam)",flag:"🇻🇳"},{code:"he",label:"Hebrew",flag:"🇮🇱"},{code:"he-IL",label:"Hebrew (Israel)",flag:"🇮🇱"}];uS=uS.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),uS.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const fS=uS.filter(e=>function(e){try{const t=new Intl.DateTimeFormat(e);return t.resolvedOptions().locale===e||t.resolvedOptions().locale.startsWith(e)}catch{return!1}}(e.code)).filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)).map(e=>({value:e.code,label:e.label,flag:e.flag}));function pS({value:t,onChange:r}){const n=fS.map(e=>({value:e.value,label:e.label,icon:e.flag}));return e.jsx(nS,{options:n,value:t,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const mS=[{value:"Dateline Standard Time",abbr:"DST",offset:-12,isdst:!1,text:"(UTC-12:00) International Date Line West",utc:["Etc/GMT+12"]},{value:"UTC-11",abbr:"U",offset:-11,isdst:!1,text:"(UTC-11:00) Coordinated Universal Time-11",utc:["Etc/GMT+11","Pacific/Midway","Pacific/Niue","Pacific/Pago_Pago"]},{value:"Hawaiian Standard Time",abbr:"HST",offset:-10,isdst:!1,text:"(UTC-10:00) Hawaii",utc:["Etc/GMT+10","Pacific/Honolulu","Pacific/Johnston","Pacific/Rarotonga","Pacific/Tahiti"]},{value:"Alaskan Standard Time",abbr:"AKDT",offset:-8,isdst:!0,text:"(UTC-09:00) Alaska",utc:["America/Anchorage","America/Juneau","America/Nome","America/Sitka","America/Yakutat"]},{value:"Pacific Standard Time (Mexico)",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-08:00) Baja California",utc:["America/Santa_Isabel"]},{value:"Pacific Daylight Time",abbr:"PDT",offset:-7,isdst:!0,text:"(UTC-07:00) Pacific Daylight Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver"]},{value:"Pacific Standard Time",abbr:"PST",offset:-8,isdst:!1,text:"(UTC-08:00) Pacific Standard Time (US & Canada)",utc:["America/Los_Angeles","America/Tijuana","America/Vancouver","PST8PDT"]},{value:"US Mountain Standard Time",abbr:"UMST",offset:-7,isdst:!1,text:"(UTC-07:00) Arizona",utc:["America/Creston","America/Dawson","America/Dawson_Creek","America/Hermosillo","America/Phoenix","America/Whitehorse","Etc/GMT+7"]},{value:"Mountain Standard Time (Mexico)",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Chihuahua, La Paz, Mazatlan",utc:["America/Chihuahua","America/Mazatlan"]},{value:"Mountain Standard Time",abbr:"MDT",offset:-6,isdst:!0,text:"(UTC-07:00) Mountain Time (US & Canada)",utc:["America/Boise","America/Cambridge_Bay","America/Denver","America/Edmonton","America/Inuvik","America/Ojinaga","America/Yellowknife","MST7MDT"]},{value:"Central America Standard Time",abbr:"CAST",offset:-6,isdst:!1,text:"(UTC-06:00) Central America",utc:["America/Belize","America/Costa_Rica","America/El_Salvador","America/Guatemala","America/Managua","America/Tegucigalpa","Etc/GMT+6","Pacific/Galapagos"]},{value:"Central Standard Time",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Central Time (US & Canada)",utc:["America/Chicago","America/Indiana/Knox","America/Indiana/Tell_City","America/Matamoros","America/Menominee","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Rainy_River","America/Rankin_Inlet","America/Resolute","America/Winnipeg","CST6CDT"]},{value:"Central Standard Time (Mexico)",abbr:"CDT",offset:-5,isdst:!0,text:"(UTC-06:00) Guadalajara, Mexico City, Monterrey",utc:["America/Bahia_Banderas","America/Cancun","America/Merida","America/Mexico_City","America/Monterrey"]},{value:"Canada Central Standard Time",abbr:"CCST",offset:-6,isdst:!1,text:"(UTC-06:00) Saskatchewan",utc:["America/Regina","America/Swift_Current"]},{value:"SA Pacific Standard Time",abbr:"SPST",offset:-5,isdst:!1,text:"(UTC-05:00) Bogota, Lima, Quito",utc:["America/Bogota","America/Cayman","America/Coral_Harbour","America/Eirunepe","America/Guayaquil","America/Jamaica","America/Lima","America/Panama","America/Rio_Branco","Etc/GMT+5"]},{value:"Eastern Standard Time",abbr:"EST",offset:-5,isdst:!1,text:"(UTC-05:00) Eastern Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"Eastern Daylight Time",abbr:"EDT",offset:-4,isdst:!0,text:"(UTC-04:00) Eastern Daylight Time (US & Canada)",utc:["America/Detroit","America/Havana","America/Indiana/Petersburg","America/Indiana/Vincennes","America/Indiana/Winamac","America/Iqaluit","America/Kentucky/Monticello","America/Louisville","America/Montreal","America/Nassau","America/New_York","America/Nipigon","America/Pangnirtung","America/Port-au-Prince","America/Thunder_Bay","America/Toronto"]},{value:"US Eastern Standard Time",abbr:"UEDT",offset:-5,isdst:!1,text:"(UTC-05:00) Indiana (East)",utc:["America/Indiana/Marengo","America/Indiana/Vevay","America/Indianapolis"]},{value:"Venezuela Standard Time",abbr:"VST",offset:-4.5,isdst:!1,text:"(UTC-04:30) Caracas",utc:["America/Caracas"]},{value:"Paraguay Standard Time",abbr:"PYT",offset:-4,isdst:!1,text:"(UTC-04:00) Asuncion",utc:["America/Asuncion"]},{value:"Atlantic Standard Time",abbr:"ADT",offset:-3,isdst:!0,text:"(UTC-04:00) Atlantic Time (Canada)",utc:["America/Glace_Bay","America/Goose_Bay","America/Halifax","America/Moncton","America/Thule","Atlantic/Bermuda"]},{value:"Central Brazilian Standard Time",abbr:"CBST",offset:-4,isdst:!1,text:"(UTC-04:00) Cuiaba",utc:["America/Campo_Grande","America/Cuiaba"]},{value:"SA Western Standard Time",abbr:"SWST",offset:-4,isdst:!1,text:"(UTC-04:00) Georgetown, La Paz, Manaus, San Juan",utc:["America/Anguilla","America/Antigua","America/Aruba","America/Barbados","America/Blanc-Sablon","America/Boa_Vista","America/Curacao","America/Dominica","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guyana","America/Kralendijk","America/La_Paz","America/Lower_Princes","America/Manaus","America/Marigot","America/Martinique","America/Montserrat","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Santo_Domingo","America/St_Barthelemy","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Tortola","Etc/GMT+4"]},{value:"Pacific SA Standard Time",abbr:"PSST",offset:-4,isdst:!1,text:"(UTC-04:00) Santiago",utc:["America/Santiago","Antarctica/Palmer"]},{value:"Newfoundland Standard Time",abbr:"NDT",offset:-2.5,isdst:!0,text:"(UTC-03:30) Newfoundland",utc:["America/St_Johns"]},{value:"E. South America Standard Time",abbr:"ESAST",offset:-3,isdst:!1,text:"(UTC-03:00) Brasilia",utc:["America/Sao_Paulo"]},{value:"Argentina Standard Time",abbr:"AST",offset:-3,isdst:!1,text:"(UTC-03:00) Buenos Aires",utc:["America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Buenos_Aires","America/Catamarca","America/Cordoba","America/Jujuy","America/Mendoza"]},{value:"SA Eastern Standard Time",abbr:"SEST",offset:-3,isdst:!1,text:"(UTC-03:00) Cayenne, Fortaleza",utc:["America/Araguaina","America/Belem","America/Cayenne","America/Fortaleza","America/Maceio","America/Paramaribo","America/Recife","America/Santarem","Antarctica/Rothera","Atlantic/Stanley","Etc/GMT+3"]},{value:"Greenland Standard Time",abbr:"GDT",offset:-3,isdst:!0,text:"(UTC-03:00) Greenland",utc:["America/Godthab"]},{value:"Montevideo Standard Time",abbr:"MST",offset:-3,isdst:!1,text:"(UTC-03:00) Montevideo",utc:["America/Montevideo"]},{value:"Bahia Standard Time",abbr:"BST",offset:-3,isdst:!1,text:"(UTC-03:00) Salvador",utc:["America/Bahia"]},{value:"UTC-02",abbr:"U",offset:-2,isdst:!1,text:"(UTC-02:00) Coordinated Universal Time-02",utc:["America/Noronha","Atlantic/South_Georgia","Etc/GMT+2"]},{value:"Mid-Atlantic Standard Time",abbr:"MDT",offset:-1,isdst:!0,text:"(UTC-02:00) Mid-Atlantic - Old",utc:[]},{value:"Azores Standard Time",abbr:"ADT",offset:0,isdst:!0,text:"(UTC-01:00) Azores",utc:["America/Scoresbysund","Atlantic/Azores"]},{value:"Cape Verde Standard Time",abbr:"CVST",offset:-1,isdst:!1,text:"(UTC-01:00) Cape Verde Is.",utc:["Atlantic/Cape_Verde","Etc/GMT+1"]},{value:"Morocco Standard Time",abbr:"MDT",offset:1,isdst:!0,text:"(UTC) Casablanca",utc:["Africa/Casablanca","Africa/El_Aaiun"]},{value:"UTC",abbr:"UTC",offset:0,isdst:!1,text:"(UTC) Coordinated Universal Time",utc:["America/Danmarkshavn","Etc/GMT"]},{value:"GMT Standard Time",abbr:"GMT",offset:0,isdst:!1,text:"(UTC) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"British Summer Time",abbr:"BST",offset:1,isdst:!0,text:"(UTC+01:00) Edinburgh, London",utc:["Europe/Isle_of_Man","Europe/Guernsey","Europe/Jersey","Europe/London"]},{value:"GMT Standard Time",abbr:"GDT",offset:1,isdst:!0,text:"(UTC) Dublin, Lisbon",utc:["Atlantic/Canary","Atlantic/Faeroe","Atlantic/Madeira","Europe/Dublin","Europe/Lisbon"]},{value:"Greenwich Standard Time",abbr:"GST",offset:0,isdst:!1,text:"(UTC) Monrovia, Reykjavik",utc:["Africa/Abidjan","Africa/Accra","Africa/Bamako","Africa/Banjul","Africa/Bissau","Africa/Conakry","Africa/Dakar","Africa/Freetown","Africa/Lome","Africa/Monrovia","Africa/Nouakchott","Africa/Ouagadougou","Africa/Sao_Tome","Atlantic/Reykjavik","Atlantic/St_Helena"]},{value:"W. Europe Standard Time",abbr:"WEDT",offset:2,isdst:!0,text:"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",utc:["Arctic/Longyearbyen","Europe/Amsterdam","Europe/Andorra","Europe/Berlin","Europe/Busingen","Europe/Gibraltar","Europe/Luxembourg","Europe/Malta","Europe/Monaco","Europe/Oslo","Europe/Rome","Europe/San_Marino","Europe/Stockholm","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Zurich"]},{value:"Central Europe Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",utc:["Europe/Belgrade","Europe/Bratislava","Europe/Budapest","Europe/Ljubljana","Europe/Podgorica","Europe/Prague","Europe/Tirane"]},{value:"Romance Standard Time",abbr:"RDT",offset:2,isdst:!0,text:"(UTC+01:00) Brussels, Copenhagen, Madrid, Paris",utc:["Africa/Ceuta","Europe/Brussels","Europe/Copenhagen","Europe/Madrid","Europe/Paris"]},{value:"Central European Standard Time",abbr:"CEDT",offset:2,isdst:!0,text:"(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb",utc:["Europe/Sarajevo","Europe/Skopje","Europe/Warsaw","Europe/Zagreb"]},{value:"W. Central Africa Standard Time",abbr:"WCAST",offset:1,isdst:!1,text:"(UTC+01:00) West Central Africa",utc:["Africa/Algiers","Africa/Bangui","Africa/Brazzaville","Africa/Douala","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Luanda","Africa/Malabo","Africa/Ndjamena","Africa/Niamey","Africa/Porto-Novo","Africa/Tunis","Etc/GMT-1"]},{value:"Namibia Standard Time",abbr:"NST",offset:1,isdst:!1,text:"(UTC+01:00) Windhoek",utc:["Africa/Windhoek"]},{value:"GTB Standard Time",abbr:"GDT",offset:3,isdst:!0,text:"(UTC+02:00) Athens, Bucharest",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau"]},{value:"Middle East Standard Time",abbr:"MEDT",offset:3,isdst:!0,text:"(UTC+02:00) Beirut",utc:["Asia/Beirut"]},{value:"Egypt Standard Time",abbr:"EST",offset:2,isdst:!1,text:"(UTC+02:00) Cairo",utc:["Africa/Cairo"]},{value:"Syria Standard Time",abbr:"SDT",offset:3,isdst:!0,text:"(UTC+02:00) Damascus",utc:["Asia/Damascus"]},{value:"E. Europe Standard Time",abbr:"EEDT",offset:3,isdst:!0,text:"(UTC+02:00) E. Europe",utc:["Asia/Nicosia","Europe/Athens","Europe/Bucharest","Europe/Chisinau","Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Nicosia","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"South Africa Standard Time",abbr:"SAST",offset:2,isdst:!1,text:"(UTC+02:00) Harare, Pretoria",utc:["Africa/Blantyre","Africa/Bujumbura","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kigali","Africa/Lubumbashi","Africa/Lusaka","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Etc/GMT-2"]},{value:"FLE Standard Time",abbr:"FDT",offset:3,isdst:!0,text:"(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius",utc:["Europe/Helsinki","Europe/Kyiv","Europe/Mariehamn","Europe/Riga","Europe/Sofia","Europe/Tallinn","Europe/Uzhhorod","Europe/Vilnius","Europe/Zaporizhzhia"]},{value:"Turkey Standard Time",abbr:"TDT",offset:3,isdst:!1,text:"(UTC+03:00) Istanbul",utc:["Europe/Istanbul"]},{value:"Israel Standard Time",abbr:"JDT",offset:3,isdst:!0,text:"(UTC+02:00) Jerusalem",utc:["Asia/Jerusalem"]},{value:"Libya Standard Time",abbr:"LST",offset:2,isdst:!1,text:"(UTC+02:00) Tripoli",utc:["Africa/Tripoli"]},{value:"Jordan Standard Time",abbr:"JST",offset:3,isdst:!1,text:"(UTC+03:00) Amman",utc:["Asia/Amman"]},{value:"Arabic Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Baghdad",utc:["Asia/Baghdad"]},{value:"Kaliningrad Standard Time",abbr:"KST",offset:3,isdst:!1,text:"(UTC+02:00) Kaliningrad",utc:["Europe/Kaliningrad"]},{value:"Arab Standard Time",abbr:"AST",offset:3,isdst:!1,text:"(UTC+03:00) Kuwait, Riyadh",utc:["Asia/Aden","Asia/Bahrain","Asia/Kuwait","Asia/Qatar","Asia/Riyadh"]},{value:"E. Africa Standard Time",abbr:"EAST",offset:3,isdst:!1,text:"(UTC+03:00) Nairobi",utc:["Africa/Addis_Ababa","Africa/Asmera","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Mogadishu","Africa/Nairobi","Antarctica/Syowa","Etc/GMT-3","Indian/Antananarivo","Indian/Comoro","Indian/Mayotte"]},{value:"Moscow Standard Time",abbr:"MSK",offset:3,isdst:!1,text:"(UTC+03:00) Moscow, St. Petersburg, Volgograd, Minsk",utc:["Europe/Kirov","Europe/Moscow","Europe/Simferopol","Europe/Volgograd","Europe/Minsk"]},{value:"Samara Time",abbr:"SAMT",offset:4,isdst:!1,text:"(UTC+04:00) Samara, Ulyanovsk, Saratov",utc:["Europe/Astrakhan","Europe/Samara","Europe/Ulyanovsk"]},{value:"Iran Standard Time",abbr:"IDT",offset:4.5,isdst:!0,text:"(UTC+03:30) Tehran",utc:["Asia/Tehran"]},{value:"Arabian Standard Time",abbr:"AST",offset:4,isdst:!1,text:"(UTC+04:00) Abu Dhabi, Muscat",utc:["Asia/Dubai","Asia/Muscat","Etc/GMT-4"]},{value:"Azerbaijan Standard Time",abbr:"ADT",offset:5,isdst:!0,text:"(UTC+04:00) Baku",utc:["Asia/Baku"]},{value:"Mauritius Standard Time",abbr:"MST",offset:4,isdst:!1,text:"(UTC+04:00) Port Louis",utc:["Indian/Mahe","Indian/Mauritius","Indian/Reunion"]},{value:"Georgian Standard Time",abbr:"GET",offset:4,isdst:!1,text:"(UTC+04:00) Tbilisi",utc:["Asia/Tbilisi"]},{value:"Caucasus Standard Time",abbr:"CST",offset:4,isdst:!1,text:"(UTC+04:00) Yerevan",utc:["Asia/Yerevan"]},{value:"Afghanistan Standard Time",abbr:"AST",offset:4.5,isdst:!1,text:"(UTC+04:30) Kabul",utc:["Asia/Kabul"]},{value:"West Asia Standard Time",abbr:"WAST",offset:5,isdst:!1,text:"(UTC+05:00) Ashgabat, Tashkent",utc:["Antarctica/Mawson","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Dushanbe","Asia/Oral","Asia/Samarkand","Asia/Tashkent","Etc/GMT-5","Indian/Kerguelen","Indian/Maldives"]},{value:"Yekaterinburg Time",abbr:"YEKT",offset:5,isdst:!1,text:"(UTC+05:00) Yekaterinburg",utc:["Asia/Yekaterinburg"]},{value:"Pakistan Standard Time",abbr:"PKT",offset:5,isdst:!1,text:"(UTC+05:00) Islamabad, Karachi",utc:["Asia/Karachi"]},{value:"India Standard Time",abbr:"IST",offset:5.5,isdst:!1,text:"(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi",utc:["Asia/Kolkata","Asia/Calcutta"]},{value:"Sri Lanka Standard Time",abbr:"SLST",offset:5.5,isdst:!1,text:"(UTC+05:30) Sri Jayawardenepura",utc:["Asia/Colombo"]},{value:"Nepal Standard Time",abbr:"NST",offset:5.75,isdst:!1,text:"(UTC+05:45) Kathmandu",utc:["Asia/Kathmandu"]},{value:"Central Asia Standard Time",abbr:"CAST",offset:6,isdst:!1,text:"(UTC+06:00) Nur-Sultan (Astana)",utc:["Antarctica/Vostok","Asia/Almaty","Asia/Bishkek","Asia/Qyzylorda","Asia/Urumqi","Etc/GMT-6","Indian/Chagos"]},{value:"Bangladesh Standard Time",abbr:"BST",offset:6,isdst:!1,text:"(UTC+06:00) Dhaka",utc:["Asia/Dhaka","Asia/Thimphu"]},{value:"Myanmar Standard Time",abbr:"MST",offset:6.5,isdst:!1,text:"(UTC+06:30) Yangon (Rangoon)",utc:["Asia/Rangoon","Indian/Cocos"]},{value:"SE Asia Standard Time",abbr:"SAST",offset:7,isdst:!1,text:"(UTC+07:00) Bangkok, Hanoi, Jakarta",utc:["Antarctica/Davis","Asia/Bangkok","Asia/Hovd","Asia/Jakarta","Asia/Phnom_Penh","Asia/Pontianak","Asia/Saigon","Asia/Vientiane","Etc/GMT-7","Indian/Christmas"]},{value:"N. Central Asia Standard Time",abbr:"NCAST",offset:7,isdst:!1,text:"(UTC+07:00) Novosibirsk",utc:["Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk"]},{value:"China Standard Time",abbr:"CST",offset:8,isdst:!1,text:"(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi",utc:["Asia/Hong_Kong","Asia/Macau","Asia/Shanghai"]},{value:"North Asia Standard Time",abbr:"NAST",offset:8,isdst:!1,text:"(UTC+08:00) Krasnoyarsk",utc:["Asia/Krasnoyarsk"]},{value:"Singapore Standard Time",abbr:"MPST",offset:8,isdst:!1,text:"(UTC+08:00) Kuala Lumpur, Singapore",utc:["Asia/Brunei","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Makassar","Asia/Manila","Asia/Singapore","Etc/GMT-8"]},{value:"W. Australia Standard Time",abbr:"WAST",offset:8,isdst:!1,text:"(UTC+08:00) Perth",utc:["Antarctica/Casey","Australia/Perth"]},{value:"Taipei Standard Time",abbr:"TST",offset:8,isdst:!1,text:"(UTC+08:00) Taipei",utc:["Asia/Taipei"]},{value:"Ulaanbaatar Standard Time",abbr:"UST",offset:8,isdst:!1,text:"(UTC+08:00) Ulaanbaatar",utc:["Asia/Choibalsan","Asia/Ulaanbaatar"]},{value:"North Asia East Standard Time",abbr:"NAEST",offset:8,isdst:!1,text:"(UTC+08:00) Irkutsk",utc:["Asia/Irkutsk"]},{value:"Japan Standard Time",abbr:"JST",offset:9,isdst:!1,text:"(UTC+09:00) Osaka, Sapporo, Tokyo",utc:["Asia/Dili","Asia/Jayapura","Asia/Tokyo","Etc/GMT-9","Pacific/Palau"]},{value:"Korea Standard Time",abbr:"KST",offset:9,isdst:!1,text:"(UTC+09:00) Seoul",utc:["Asia/Pyongyang","Asia/Seoul"]},{value:"Cen. Australia Standard Time",abbr:"CAST",offset:9.5,isdst:!1,text:"(UTC+09:30) Adelaide",utc:["Australia/Adelaide","Australia/Broken_Hill"]},{value:"AUS Central Standard Time",abbr:"ACST",offset:9.5,isdst:!1,text:"(UTC+09:30) Darwin",utc:["Australia/Darwin"]},{value:"E. Australia Standard Time",abbr:"EAST",offset:10,isdst:!1,text:"(UTC+10:00) Brisbane",utc:["Australia/Brisbane","Australia/Lindeman"]},{value:"AUS Eastern Standard Time",abbr:"AEST",offset:10,isdst:!1,text:"(UTC+10:00) Canberra, Melbourne, Sydney",utc:["Australia/Melbourne","Australia/Sydney"]},{value:"West Pacific Standard Time",abbr:"WPST",offset:10,isdst:!1,text:"(UTC+10:00) Guam, Port Moresby",utc:["Antarctica/DumontDUrville","Etc/GMT-10","Pacific/Guam","Pacific/Port_Moresby","Pacific/Saipan","Pacific/Truk"]},{value:"Tasmania Standard Time",abbr:"TST",offset:10,isdst:!1,text:"(UTC+10:00) Hobart",utc:["Australia/Currie","Australia/Hobart"]},{value:"Yakutsk Standard Time",abbr:"YST",offset:9,isdst:!1,text:"(UTC+09:00) Yakutsk",utc:["Asia/Chita","Asia/Khandyga","Asia/Yakutsk"]},{value:"Central Pacific Standard Time",abbr:"CPST",offset:11,isdst:!1,text:"(UTC+11:00) Solomon Is., New Caledonia",utc:["Antarctica/Macquarie","Etc/GMT-11","Pacific/Efate","Pacific/Guadalcanal","Pacific/Kosrae","Pacific/Noumea","Pacific/Ponape"]},{value:"Vladivostok Standard Time",abbr:"VST",offset:11,isdst:!1,text:"(UTC+11:00) Vladivostok",utc:["Asia/Sakhalin","Asia/Ust-Nera","Asia/Vladivostok"]},{value:"New Zealand Standard Time",abbr:"NZST",offset:12,isdst:!1,text:"(UTC+12:00) Auckland, Wellington",utc:["Antarctica/McMurdo","Pacific/Auckland"]},{value:"UTC+12",abbr:"U",offset:12,isdst:!1,text:"(UTC+12:00) Coordinated Universal Time+12",utc:["Etc/GMT-12","Pacific/Funafuti","Pacific/Kwajalein","Pacific/Majuro","Pacific/Nauru","Pacific/Tarawa","Pacific/Wake","Pacific/Wallis"]},{value:"Fiji Standard Time",abbr:"FST",offset:12,isdst:!1,text:"(UTC+12:00) Fiji",utc:["Pacific/Fiji"]},{value:"Magadan Standard Time",abbr:"MST",offset:12,isdst:!1,text:"(UTC+12:00) Magadan",utc:["Asia/Anadyr","Asia/Kamchatka","Asia/Magadan","Asia/Srednekolymsk"]},{value:"Kamchatka Standard Time",abbr:"KDT",offset:13,isdst:!0,text:"(UTC+12:00) Petropavlovsk-Kamchatsky - Old",utc:["Asia/Kamchatka"]},{value:"Tonga Standard Time",abbr:"TST",offset:13,isdst:!1,text:"(UTC+13:00) Nuku'alofa",utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]},{value:"Samoa Standard Time",abbr:"SST",offset:13,isdst:!1,text:"(UTC+13:00) Samoa",utc:["Pacific/Apia"]}].filter(e=>e.utc.length).reduce((e,t)=>{let r=t.utc;for(let n=0;n<r.length;n++){const a=r[n],s=t.text;let o=s.substring(s.indexOf("(")+1,s.indexOf(")"));-1!==o.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${o}) ${a}`,utc:["Etc/GMT-13","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Tongatapu"]})}return e},[]).filter((e,t,r)=>t===r.findIndex(t=>t.value===e.value));function hS({value:t,onChange:r}){const n=mS.map(e=>({value:e.value,label:e.text}));return e.jsx(nS,{options:n,value:t,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const gS=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=er(),[s,o]=t.useState(!1),[i,c]=t.useState(),[l,d]=t.useState(0),[u,f]=t.useState(null),p=Co({resolver:Il(Vu({name:mu().min(2,{message:"Name must be at least 2 characters."}),country:mu().optional(),timezone:mu().optional(),language:mu().optional(),currency:mu().optional()})),defaultValues:{name:i?.name||"",country:i?.country||"",timezone:i?.timezone||"",language:i?.language||"",currency:i?.currency||""}});return t.useEffect(()=>{a().then(e=>{c(e),p.setValue("name",e.name),p.setValue("country",e.country),p.setValue("timezone",e.timezone),p.setValue("language",e.language),p.setValue("currency",e.currency)})},[l]),i?e.jsxs("div",{children:[u&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm",children:u})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(Td,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){o(!0),f(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),f("Profile saved successfully"),setTimeout(()=>{f(null)},5e3)}catch(e){De(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{o(!1)}}),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Email"}),e.jsx(Ld,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:i?.email})]}),e.jsx(Pd,{disabled:s,control:p.control,name:"name",render:({field:t})=>e.jsxs(Dd,{children:[e.jsx(Ud,{children:"Name"}),e.jsx(Fd,{children:e.jsx(Ld,{...t})}),e.jsx(zd,{})]})}),e.jsxs("div",{className:"flex gap-y-2 my-4 flex-col",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Language"}),e.jsx(pS,{value:p.getValues("language"),onChange:e=>{p.setValue("language",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Country"}),e.jsx(iS,{value:p.getValues("country"),onChange:e=>{p.setValue("country",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Currency"}),e.jsx(dS,{value:p.getValues("currency"),onChange:e=>{p.setValue("currency",e)}})]}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Timezone"}),e.jsx(hS,{value:p.getValues("timezone"),onChange:e=>{p.setValue("timezone",e)}})]})]}),e.jsxs("div",{className:"flex justify-end gap-x-2",children:[e.jsx(jd,{type:"submit",progress:s,disabled:s,children:"Save"}),e.jsx(jd,{type:"button",variant:"outline",onClick:()=>{d(e=>e+1)},disabled:s,children:"Reset"})]})]})})}),i?.image&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),e.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:e.jsx("img",{src:i.image,alt:i.name,className:"w-full h-full object-cover"})})]})]}):e.jsx(Qb,{})};function bS(e,t){const r=e.pricingVariants;if(!r?.length)return null;const n=t.toLowerCase();return r.find(e=>e.currency?.toLowerCase()===n)??null}function yS(e,t,r){const n=bS(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function vS(e,t,r){const n=bS(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",s="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(s?n.stripePrices[s]:void 0)??null}function xS(e,t,r,n){const a=bS(e,t),s=a?.quotaOverages?.[r];if(s)return s[n]}function wS(e){const t=new Set;for(const r of e)r.pricingVariants?.forEach(e=>{e.currency&&t.add(e.currency.toLowerCase())});return Array.from(t).sort()}function SS(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const s=a[n];if(!s)return null;const o=xS(e,t,r,n);return{included:s.included,...void 0!==s.unitSize&&{unitSize:s.unitSize},...void 0!==o&&{overage:o}}}function kS(e,t){if(!e)return null;for(const r of t){const t=r.pricingVariants;if(t?.length)for(const r of t){const t=r.stripePrices;if(t){if(t.monthlyPriceId===e||t.monthly===e)return{interval:"monthly",currency:r.currency};if(t.yearlyPriceId===e||t.yearly===e)return{interval:"yearly",currency:r.currency};if(t.quarterlyPriceId===e)return{interval:"quarterly",currency:r.currency}}}}return null}function jS(e,t){if(null==e)return null;const r=e[t??"monthly"];return r?{included:r.included,...void 0!==r.overage&&{overage:r.overage},...void 0!==r.unitSize&&{unitSize:r.unitSize}}:null}function ES(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,s=r.currencySymbol??by(a??"");if(null==e)return"—";const{included:o,overage:i}=e,c=`${o} included`;if(null==i)return c;const l=n?i/100:i;return`${c}, then ${s}${"number"==typeof l&&Number.isFinite(l)?l.toFixed(2):String(i)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const CS=(e,t)=>{const r=(t??"").trim();return r?new Intl.NumberFormat("en-US",{style:"currency",currency:r.toUpperCase(),minimumFractionDigits:2}).format(e/100):(e/100).toFixed(2)},NS=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",AS=e=>{switch(e){case"paid":return"bg-green-100 text-green-800";case"open":return"bg-yellow-100 text-yellow-800";case"draft":case"void":default:return"bg-gray-100 text-gray-800";case"uncollectible":return"bg-red-100 text-red-800"}},_S=({workspaceId:t,hasActiveSubscription:r=!1,onViewPricingPlans:n,limit:a=20})=>{const{invoices:s,loading:o,error:i,refetch:c}=dr(t,a),l=s.length>0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Billing History"}),e.jsx("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),e.jsx(jd,{variant:"ghost",size:"sm",progress:o,onClick:c,disabled:o,children:o?"Refreshing...":"Refresh"})]}),i&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading invoices"}),e.jsx("p",{className:"text-sm mt-1",children:i})]}),e.jsx(jd,{variant:"outline",size:"sm",onClick:c,disabled:o,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:o?"Retrying...":"Retry"})]}),o&&!l?e.jsx("div",{className:"border rounded-lg p-6",children:e.jsx(Qb,{})}):l?e.jsx("div",{className:"space-y-2",children:s.map(t=>{const r=(e=>{switch(e.status){case"draft":case"open":return{text:"Pay",color:"bg-blue-600 hover:bg-blue-700"};case"paid":return{text:"View",color:"bg-green-600 hover:bg-green-700"};case"uncollectible":case"void":return{text:"View Details",color:"bg-gray-600 hover:bg-gray-700"};default:return{text:"View",color:"bg-gray-600 hover:bg-gray-700"}}})(t);return e.jsx("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:t.description||t.number||`Invoice ${t.id.slice(-8)}`}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${AS(t.status)}`,children:t.status.charAt(0).toUpperCase()+t.status.slice(1)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium text-gray-900",children:CS(t.amount_due,t.currency)}),t.created&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Created: ",NS(t.created)]})]}),t.due_date&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{children:["Due: ",NS(t.due_date)]})]}),t.amount_paid>0&&t.amount_due>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-300",children:"•"}),e.jsxs("span",{className:"text-xs text-gray-500",children:["Paid: ",CS(t.amount_paid,t.currency)]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(jd,{size:"sm",onClick:()=>window.open(t.hosted_invoice_url,"_blank","noopener,noreferrer"),className:r.color,children:[r.text,e.jsx(cd,{className:"h-3 w-3 ml-1.5"})]}),t.invoice_pdf&&e.jsxs(jd,{size:"sm",variant:"outline",onClick:()=>window.open(t.invoice_pdf,"_blank","noopener,noreferrer"),children:[e.jsx(id,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},t.id)})}):e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsx(ld,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:r?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!r&&n&&e.jsx(jd,{size:"sm",className:"mt-4",onClick:n,children:"View Pricing Plans"})]})]})},TS=t.lazy(()=>Promise.resolve().then(function(){return lj}).then(e=>({default:e.default}))),RS=e=>{switch(e){case"monthly":return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly";default:return"Unknown"}},PS=e=>{if(!e)return"";try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric"}).format(t)}catch{return""}},OS=({workspace:r})=>{const n=r._id?.toString(),{subscription:a,loading:s,error:o,updateSubscription:i,refetch:c}=lr(n),{createCheckoutSession:l}=ir(n),{cancelSubscription:d,loading:u}=(e=>{const{api:r}=Qt(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{cancelSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.cancelSubscriptionAtPeriodEnd(e);return rr(),t}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw o(r),De(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}})(n),{resumeSubscription:f,loading:p}=(e=>{const{api:r}=Qt(),[n,a]=t.useState(!1),[s,o]=t.useState(null);return{resumeSubscription:t.useCallback(async()=>{if(!e)throw new Error("Workspace ID is required");a(!0),o(null);try{const t=await r.resumeSubscription(e);return rr(),t}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw o(r),De(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{a(!1)}},[r,e]),loading:n,error:s}})(n),{versions:m,loading:h,error:g,refetch:b}=or(n),y=s||h,v=o||g,{currentVersion:x,latestVersion:w,isDeprecated:S,whatsNew:k,plansToShow:j}=t.useMemo(()=>{const e=m?.currentVersion,t=m?.availableVersions||[],r=null!==a?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const s=!!(r&&n&&e)&&n.version>e.version,o=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:s,isDeprecated:s&&r,whatsNew:n?.whatsNew,plansToShow:o}},[m,a?.subscription]),[E,C]=t.useState(!1),[N,A]=t.useState(null),[_,T]=t.useState(null),[R,P]=t.useState(!1),[O,I]=t.useState(!1),[D,U]=t.useState(!1),[F,M]=t.useState("subscription"),z=async()=>{await Promise.all([c(),b()])},L=t.useMemo(()=>kS(a?.subscription?.stripePriceId,j??[]),[a?.subscription?.stripePriceId,j]);if(y&&!a&&!m)return e.jsx(Qb,{});const V=a?.planVersion?._id||null;return n?e.jsxs("div",{className:"space-y-6",children:[v&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Error loading subscription data"}),e.jsx("p",{className:"text-sm mt-1",children:v}),e.jsx("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),e.jsx(jd,{variant:"outline",size:"sm",onClick:z,disabled:y,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:y?"Retrying...":"Retry"})]}),N&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Update failed"}),e.jsx("p",{className:"text-sm mt-1",children:N})]}),e.jsx(jd,{variant:"outline",size:"sm",onClick:()=>A(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),_&&e.jsxs("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Success!"}),e.jsx("p",{className:"text-sm mt-1",children:_})]}),e.jsx(jd,{variant:"outline",size:"sm",onClick:()=>T(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),e.jsx("div",{className:"border-b border-gray-200",children:e.jsxs("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[e.jsx("button",{type:"button",onClick:()=>M("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===F?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),e.jsx("button",{type:"button",onClick:()=>M("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===F?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===F&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(ud,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading subscription and pricing plans..."})]}),S&&a?.subscription&&e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(xd,{className:"h-5 w-5 text-amber-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),e.jsx("p",{className:"text-sm text-amber-700 mb-2",children:"A new version of the pricing plans is now available. Please upgrade to one of the new plans below to continue receiving updates and support."}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e.jsxs("span",{children:["Current: Version ",x?.version||"N/A"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Latest: Version ",w?.version||"N/A"]})]}),k&&(k.newPlans.length>0||k.updatedPlans.length>0)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e.jsxs("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",w?.version,":"]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-amber-700",children:[k.newPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"New Plans: "}),e.jsx("span",{children:k.newPlans.map(e=>e.plan.name).join(", ")})]}),k.updatedPlans.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Updated Plans: "}),e.jsx("span",{children:k.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[a?.subscription?.cancelAtPeriodEnd||u?null:a?.subscription?e.jsx(jd,{variant:"outline",size:"sm",onClick:()=>P(!0),children:"Change Plan"}):!a?.subscription&&j&&j.length>0?e.jsx(jd,{size:"sm",onClick:()=>P(!0),children:"View Pricing Plans"}):null,e.jsx(jd,{variant:"ghost",size:"sm",progress:y,onClick:z,disabled:y||E,children:y?"Refreshing...":"Refresh"})]})]}),a?.subscription?(()=>{const t=kS(a.subscription.stripePriceId,j??[]),n=t?.interval??null,s=t?.currency??a.plan?.currency??r?.billingCurrency??"",o=n&&a.planVersion?yS(a.planVersion,s,n):null,i=null!=o?0===o?"Free":xy(o,s):null,c="monthly"===n?"/month":"quarterly"===n?"/quarter":"yearly"===n?"/year":"";return e.jsxs("div",{className:"border rounded-lg overflow-hidden "+(S?"border-amber-300":"border-gray-200"),children:[e.jsxs("div",{className:"p-5 "+(S?"bg-amber-50/50":"bg-gray-50/50"),children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:a.plan?.name||"No plan assigned"}),e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===a.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===a.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===a.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===a.subscription.subscriptionStatus&&"Active","trialing"===a.subscription.subscriptionStatus&&"Trial","canceled"===a.subscription.subscriptionStatus&&"Canceled","past_due"===a.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===a.subscription.subscriptionStatus&&PS(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(ends"," ",PS(a.subscription.stripeCurrentPeriodEnd),")"]}),S&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800",children:[e.jsx(xd,{className:"h-3 w-3"}),"Deprecated"]})]}),a.plan?.description&&e.jsx("p",{className:"text-sm text-gray-600",children:a.plan.description})]}),e.jsxs("div",{className:"text-right ml-4",children:[e.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-gray-900",children:i||"N/A"}),i&&"Free"!==i&&c&&e.jsx("span",{className:"text-sm text-gray-500",children:c})]}),n&&e.jsxs("span",{className:"text-xs text-gray-500 mt-1 inline-block",children:["Billed ",RS(n).toLowerCase()]}),("active"===a.subscription.subscriptionStatus||"trialing"===a.subscription.subscriptionStatus)&&!a.subscription.cancelAtPeriodEnd&&PS(a.subscription.stripeCurrentPeriodEnd)&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[e.jsx(nd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Next billing:"," ",e.jsx("span",{className:"font-medium text-gray-700",children:PS(a.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),S&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",x?.version||"N/A"," - A newer version is available"]}),"active"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:a.subscription.cancelAtPeriodEnd?e.jsx(jd,{variant:"outline",size:"sm",onClick:()=>U(!0),disabled:E||u||p,progress:p,children:"Resume Subscription"}):e.jsx(jd,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>I(!0),disabled:E||u||p,progress:u||E,children:u||E?"Canceling...":"Cancel Subscription"})})]}),"past_due"===a.subscription.subscriptionStatus&&e.jsx("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(xd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),e.jsx("p",{className:"text-sm text-red-700 mt-0.5",children:"Please update your payment method to avoid service interruption. Check your invoices for details."}),e.jsx(jd,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>M("invoices"),children:"View Invoices"})]})]})}),a.subscription.cancelAtPeriodEnd&&e.jsx("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(nd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),e.jsx("p",{className:"text-sm text-amber-700 mt-0.5",children:PS(a.subscription.stripeCurrentPeriodEnd)?e.jsxs(e.Fragment,{children:["Your subscription will end on"," ",e.jsx("span",{className:"font-medium",children:PS(a.subscription.stripeCurrentPeriodEnd)}),". You'll retain access until then and won't be charged again."]}):"Your subscription will be canceled at the end of the current billing period. You won't be charged again."})]})]})}),a.planVersion&&(()=>{const t=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],s=[];return e.subscriptionItems.forEach(o=>{const i=o.slug;if("feature"===o.type){const t=e.features?.[i]??!1;n.push({item:o,enabled:t})}else if("limit"===o.type){const t=e.limits?.[i]??0;a.push({item:o,value:t})}else if("quota"===o.type){const n=t&&e.pricingVariants?.length?SS(e,t,i,r):jS(e.quotas?.[i],r);null!=n&&s.push({item:o,value:n})}}),{features:n,limits:a,quotas:s}})(a.planVersion,s,n??"monthly");return t.features.length>0||t.limits.length>0||t.quotas.length>0?e.jsx("div",{className:"p-5 border-t border-gray-100",children:e.jsxs("div",{className:"space-y-6",children:[t.features.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),e.jsx("ul",{className:"space-y-2",children:t.features.sort(e=>e.enabled?-1:1).map(({item:t,enabled:r})=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"mt-0.5 flex-shrink-0 "+(r?"text-green-500":"text-gray-300"),children:r?"✓":"—"}),e.jsx("span",{className:r?"text-gray-700":"text-gray-400",children:t.name})]},t._id))})]}),t.limits.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),e.jsx("ul",{className:"space-y-2",children:t.limits.map(({item:t,value:r})=>e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:r})]})},t._id))})]}),t.quotas.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),e.jsx("ul",{className:"space-y-2",children:t.quotas.map(({item:t,value:r})=>{const n=ES(r,t.name.toLowerCase(),{currency:s});return e.jsx("li",{className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-600",children:t.name}),e.jsx("span",{className:"font-medium text-gray-900",children:n})]})},t._id)})})]})]})}):null})()]})})():e.jsxs("div",{className:"border rounded-lg p-6 text-center",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(od,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),e.jsx("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),j&&j.length>0&&e.jsx(jd,{size:"sm",onClick:()=>P(!0),children:"View Pricing Plans"})]})]}),!m&&!y&&e.jsxs("div",{className:"border rounded-lg p-4 text-center",children:[e.jsxs("div",{className:"text-gray-500 mb-2",children:[e.jsx("p",{className:"font-medium",children:"Unable to load plan information"}),v&&e.jsxs("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",v]}),!v&&e.jsx("p",{className:"text-sm mt-2",children:"No plan groups are available for this workspace. Please contact support if you believe this is an error."})]}),e.jsx(jd,{variant:"outline",size:"sm",progress:y,onClick:z,disabled:y,className:"mt-4",children:y?"Refreshing...":"Refresh"})]})]}),"invoices"===F&&e.jsxs(e.Fragment,{children:[y&&e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:[e.jsx(ud,{className:"h-4 w-4 animate-spin flex-shrink-0"}),e.jsx("span",{children:"Loading invoices..."})]}),e.jsx(_S,{workspaceId:n,hasActiveSubscription:null!==a?.subscription,onViewPricingPlans:()=>M("subscription"),limit:20})]}),j&&j.length>0&&e.jsx(t.Suspense,{fallback:R?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ud,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading plans..."})]})}):null,children:e.jsx(TS,{open:R,onOpenChange:P,planVersions:j,currentPlanVersionId:V||null,currentStripePriceId:a?.subscription?.stripePriceId,billingCurrency:r.billingCurrency,onSelectPlan:async(e,t="monthly",s)=>{if(!n)return;const o=j?.find(t=>t._id===e),c=o?vS(o,s??L?.currency??a?.plan?.currency??r?.billingCurrency??"",t):null,d=a?.subscription?.stripePriceId;if(!c||!d||c!==d){C(!0),A(null),T(null);try{let r,n,s;try{const e=new URL(window.location.href);r=e.toString(),n=e.toString()}catch{const e=window.location.protocol||"https:",t=window.location.host||window.location.hostname||"",a=`${e}//${t}${window.location.pathname||"/"}`;r=a,n=a}if(s=a?.subscription?await i(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await l({planVersionId:e,billingInterval:t,successUrl:r,cancelUrl:n}),s&&"checkoutUrl"in s&&s.checkoutUrl)return void(window.location.href=s.checkoutUrl);T("Subscription updated successfully!"),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";A(t)}finally{C(!1),setTimeout(()=>{A(null),T(null)},5e3)}}},loading:E||y})}),e.jsx($b,{open:D,onOpenChange:U,children:e.jsxs(Kb,{children:[e.jsxs(Hb,{children:[e.jsx(Jb,{children:"Resume Subscription"}),e.jsx(qb,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to resume your subscription?"}),e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(xd,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e.jsxs("span",{children:["You will be charged again on"," ",a?.subscription?.stripeCurrentPeriodEnd&&PS(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:PS(a.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-0.5",children:"•"}),e.jsx("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e.jsxs(Zb,{children:[e.jsx(Xb,{disabled:p,children:"Keep Canceled"}),e.jsx(Yb,{onClick:async()=>{if(n){U(!1),C(!0),A(null),T(null);try{await f(),T("Subscription has been resumed."),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";A(t)}finally{C(!1),setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:p,children:p?"Resuming...":"Yes, Resume Subscription"})]})]})}),e.jsx($b,{open:O,onOpenChange:I,children:e.jsxs(Kb,{children:[e.jsxs(Hb,{children:[e.jsx(Jb,{children:"Cancel Subscription"}),e.jsx(qb,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Are you sure you want to cancel your subscription?"}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsxs("span",{children:["You'll retain full access to this plan until"," ",a?.subscription?.stripeCurrentPeriodEnd&&PS(a.subscription.stripeCurrentPeriodEnd)?e.jsx("span",{className:"font-medium",children:PS(a.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-0.5",children:"✓"}),e.jsx("span",{children:"You won't be charged again after cancellation"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-blue-600 mt-0.5",children:"ℹ"}),e.jsx("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e.jsxs(Zb,{children:[e.jsx(Xb,{disabled:u,children:"Keep Subscription"}),e.jsx(Yb,{onClick:async()=>{if(n){I(!1),C(!0),A(null),T(null);try{await d(),T("Subscription will be canceled at the end of the billing period."),await z()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";A(t)}finally{C(!1),setTimeout(()=>{A(null),T(null)},5e3)}}},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):e.jsx("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:e.jsx("p",{children:"Invalid workspace ID"})})};function IS(e){const t=a.forwardRef((e,t)=>{const{children:r,...n}=e;if(a.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),s=function(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{const t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==a.Fragment&&(s.ref=t?Ul(t,e):e),a.cloneElement(r,s)}return a.Children.count(r)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var DS=Symbol("radix.slottable");function US(e){return a.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===DS}var FS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});a.forwardRef((t,r)=>e.jsx(Qf.span,{...t,ref:r,style:{...FS,...t.style}})).displayName="VisuallyHidden";var MS=[" ","Enter","ArrowUp","ArrowDown"],zS=[" ","Enter"],LS="Select",[VS,$S,WS]=_h(LS),[BS]=Wf(LS,[WS,cw]),GS=cw(),[KS,HS]=BS(LS),[ZS,JS]=BS(LS),qS=t=>{const{__scopeSelect:r,children:n,open:s,defaultOpen:o,onOpenChange:i,value:c,defaultValue:l,onValueChange:d,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=t,b=GS(r),[y,v]=a.useState(null),[x,w]=a.useState(null),[S,k]=a.useState(!1),j=Rh(u),[E,C]=Jf({prop:s,defaultProp:o??!1,onChange:i,caller:LS}),[N,A]=Jf({prop:c,defaultProp:l,onChange:d,caller:LS}),_=a.useRef(null),T=!y||(g||!!y.closest("form")),[R,P]=a.useState(new Set),O=Array.from(R).map(e=>e.props.value).join(";");return e.jsx(jw,{...b,children:e.jsxs(KS,{required:h,scope:r,trigger:y,onTriggerChange:v,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:k,contentId:Hf(),value:N,onValueChange:A,open:E,onOpenChange:C,dir:j,triggerPointerDownPosRef:_,disabled:m,children:[e.jsx(VS.Provider,{scope:r,children:e.jsx(ZS,{scope:t.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{P(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?e.jsxs(Ik,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:N,onChange:e=>A(e.target.value),disabled:m,form:g,children:[void 0===N?e.jsx("option",{value:""}):null,Array.from(R)]},O):null]})})};qS.displayName=LS;var YS="SelectTrigger",XS=a.forwardRef((t,r)=>{const{__scopeSelect:n,disabled:s=!1,...o}=t,i=GS(n),c=HS(YS,n),l=c.disabled||s,d=Fl(r,c.onTriggerChange),u=$S(n),f=a.useRef("touch"),[p,m,h]=Uk(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=Fk(t,e,r);void 0!==n&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return e.jsx(Ew,{asChild:!0,...i,children:e.jsx(Qf.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Dk(c.value)?"":void 0,...o,ref:d,onClick:$f(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:$f(o.onPointerDown,e=>{f.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())}),onKeyDown:$f(o.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||MS.includes(e.key)&&(g(),e.preventDefault())})})})});XS.displayName=YS;var QS="SelectValue",ek=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:a,style:s,children:o,placeholder:i="",...c}=t,l=HS(QS,n),{onValueNodeHasChildrenChange:d}=l,u=void 0!==o,f=Fl(r,l.onValueNodeChange);return mf(()=>{d(u)},[d,u]),e.jsx(Qf.span,{...c,ref:f,style:{pointerEvents:"none"},children:Dk(l.value)?e.jsx(e.Fragment,{children:i}):o})});ek.displayName=QS;var tk=a.forwardRef((t,r)=>{const{__scopeSelect:n,children:a,...s}=t;return e.jsx(Qf.span,{"aria-hidden":!0,...s,ref:r,children:a||"▼"})});tk.displayName="SelectIcon";var rk=t=>e.jsx(yp,{asChild:!0,...t});rk.displayName="SelectPortal";var nk="SelectContent",ak=a.forwardRef((t,r)=>{const n=HS(nk,t.__scopeSelect),[o,i]=a.useState();if(mf(()=>{i(new DocumentFragment)},[]),!n.open){const r=o;return r?s.createPortal(e.jsx(ok,{scope:t.__scopeSelect,children:e.jsx(VS.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),r):null}return e.jsx(lk,{...t,ref:r})});ak.displayName=nk;var sk=10,[ok,ik]=BS(nk),ck=function(t){const r=IS(t),n=a.forwardRef((t,n)=>{const{children:s,...o}=t,i=a.Children.toArray(s),c=i.find(US);if(c){const t=c.props.children,s=i.map(e=>e===c?a.Children.count(t)>1?a.Children.only(null):a.isValidElement(t)?t.props.children:null:e);return e.jsx(r,{...o,ref:n,children:a.isValidElement(t)?a.cloneElement(t,void 0,s):null})}return e.jsx(r,{...o,ref:n,children:s})});return n.displayName=`${t}.Slot`,n}("SelectContent.RemoveScroll"),lk=a.forwardRef((t,r)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...v}=t,x=HS(nk,n),[w,S]=a.useState(null),[k,j]=a.useState(null),E=Fl(r,e=>S(e)),[C,N]=a.useState(null),[A,_]=a.useState(null),T=$S(n),[R,P]=a.useState(!1),O=a.useRef(!1);a.useEffect(()=>{if(w)return bm(w)},[w]),Sp();const I=a.useCallback(e=>{const[t,...r]=T().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(r?.scrollIntoView({block:"nearest"}),r===t&&k&&(k.scrollTop=0),r===n&&k&&(k.scrollTop=k.scrollHeight),r?.focus(),document.activeElement!==a)return}},[T,k]),D=a.useCallback(()=>I([C,w]),[I,C,w]);a.useEffect(()=>{R&&D()},[R,D]);const{onOpenChange:U,triggerPointerDownPosRef:F}=x;a.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():w.contains(r.target)||U(!1),document.removeEventListener("pointermove",t),F.current=null};return null!==F.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[w,U,F]),a.useEffect(()=>{const e=()=>U(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[U]);const[M,z]=Uk(e=>{const t=T().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=Fk(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),L=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&(N(e),n&&(O.current=!0))},[x.value]),V=a.useCallback(()=>w?.focus(),[w]),$=a.useCallback((e,t,r)=>{const n=!O.current&&!r;(void 0!==x.value&&x.value===t||n)&&_(e)},[x.value]),W="popper"===s?uk:dk,B=W===uk?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return e.jsx(ok,{scope:n,content:w,viewport:k,onViewportChange:j,itemRefCallback:L,selectedItem:C,onItemLeave:V,itemTextRefCallback:$,focusSelectedItem:D,selectedItemText:A,position:s,isPositioned:R,searchRef:M,children:e.jsx(dm,{as:ck,allowPinchZoom:!0,children:e.jsx(up,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:$f(o,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:e.jsx(sp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:e.jsx(W,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:$f(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=T().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>I(t)),e.preventDefault()}})})})})})})});lk.displayName="SelectContentImpl";var dk=a.forwardRef((t,r)=>{const{__scopeSelect:n,onPlaced:s,...o}=t,i=HS(nk,n),c=ik(nk,n),[l,d]=a.useState(null),[u,f]=a.useState(null),p=Fl(r,e=>f(e)),m=$S(n),h=a.useRef(!1),g=a.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:v,focusSelectedItem:x}=c,w=a.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&b&&y&&v){const e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),n=v.getBoundingClientRect();if("rtl"!==i.dir){const a=n.left-t.left,s=r.left-a,o=e.left-s,i=e.width+o,c=Math.max(i,t.width),d=window.innerWidth-sk,u=jg(s,[sk,Math.max(sk,d-c)]);l.style.minWidth=i+"px",l.style.left=u+"px"}else{const a=t.right-n.right,s=window.innerWidth-r.right-a,o=window.innerWidth-e.right-s,i=e.width+o,c=Math.max(i,t.width),d=window.innerWidth-sk,u=jg(s,[sk,Math.max(sk,d-c)]);l.style.minWidth=i+"px",l.style.right=u+"px"}const a=m(),o=window.innerHeight-2*sk,c=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),x=f+p+c+parseInt(d.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),j=parseInt(S.paddingBottom,10),E=e.top+e.height/2-sk,C=o-E,N=y.offsetHeight/2,A=f+p+(y.offsetTop+N),_=x-A;if(A<=E){const e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=A+Math.max(C,N+(e?j:0)+t+g);l.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;l.style.top="0px";const t=Math.max(E,f+b.offsetTop+(e?k:0)+N)+_;l.style.height=t+"px",b.scrollTop=A-E+b.offsetTop}l.style.margin=`${sk}px 0`,l.style.minHeight=w+"px",l.style.maxHeight=o+"px",s?.(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,b,y,v,i.dir,s]);mf(()=>w(),[w]);const[S,k]=a.useState();mf(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const j=a.useCallback(e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)},[w,x]);return e.jsx(fk,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:e.jsx(Qf.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});dk.displayName="SelectItemAlignedPosition";var uk=a.forwardRef((t,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:s=sk,...o}=t,i=GS(n);return e.jsx(Cw,{...i,...o,ref:r,align:a,collisionPadding:s,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uk.displayName="SelectPopperPosition";var[fk,pk]=BS(nk,{}),mk="SelectViewport",hk=a.forwardRef((t,r)=>{const{__scopeSelect:n,nonce:s,...o}=t,i=ik(mk,n),c=pk(mk,n),l=Fl(r,i.onViewportChange),d=a.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),e.jsx(VS.Slot,{scope:n,children:e.jsx(Qf.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:$f(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=c;if(n?.current&&r){const e=Math.abs(d.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*sk,a=parseFloat(r.style.minHeight),s=parseFloat(r.style.height),o=Math.max(a,s);if(o<n){const a=o+e,s=Math.min(n,a),i=a-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=i>0?i:0,r.style.justifyContent="flex-end")}}}d.current=t.scrollTop})})})]})});hk.displayName=mk;var gk="SelectGroup",[bk,yk]=BS(gk);a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=Hf();return e.jsx(bk,{scope:n,id:s,children:e.jsx(Qf.div,{role:"group","aria-labelledby":s,...a,ref:r})})}).displayName=gk;var vk="SelectLabel",xk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=yk(vk,n);return e.jsx(Qf.div,{id:s.id,...a,ref:r})});xk.displayName=vk;var wk="SelectItem",[Sk,kk]=BS(wk),jk=a.forwardRef((t,r)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...c}=t,l=HS(wk,n),d=ik(wk,n),u=l.value===s,[f,p]=a.useState(i??""),[m,h]=a.useState(!1),g=Fl(r,e=>d.itemRefCallback?.(e,s,o)),b=Hf(),y=a.useRef("touch"),v=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(""===s)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(Sk,{scope:n,value:s,disabled:o,textId:b,isSelected:u,onItemTextChange:a.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:e.jsx(VS.ItemSlot,{scope:n,value:s,disabled:o,textValue:f,children:e.jsx(Qf.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...c,ref:g,onFocus:$f(c.onFocus,()=>h(!0)),onBlur:$f(c.onBlur,()=>h(!1)),onClick:$f(c.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:$f(c.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:$f(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:$f(c.onPointerMove,e=>{y.current=e.pointerType,o?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$f(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:$f(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(zS.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});jk.displayName=wk;var Ek="SelectItemText",Ck=a.forwardRef((t,r)=>{const{__scopeSelect:n,className:o,style:i,...c}=t,l=HS(Ek,n),d=ik(Ek,n),u=kk(Ek,n),f=JS(Ek,n),[p,m]=a.useState(null),h=Fl(r,e=>m(e),u.onItemTextChange,e=>d.itemTextRefCallback?.(e,u.value,u.disabled)),g=p?.textContent,b=a.useMemo(()=>e.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:v}=f;return mf(()=>(y(b),()=>v(b)),[y,v,b]),e.jsxs(e.Fragment,{children:[e.jsx(Qf.span,{id:u.textId,...c,ref:h}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?s.createPortal(c.children,l.valueNode):null]})});Ck.displayName=Ek;var Nk="SelectItemIndicator",Ak=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return kk(Nk,n).isSelected?e.jsx(Qf.span,{"aria-hidden":!0,...a,ref:r}):null});Ak.displayName=Nk;var _k="SelectScrollUpButton";a.forwardRef((t,r)=>{const n=ik(_k,t.__scopeSelect),s=pk(_k,t.__scopeSelect),[o,i]=a.useState(!1),c=Fl(r,s.onScrollButtonChange);return mf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;i(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(Rk,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=_k;var Tk="SelectScrollDownButton";a.forwardRef((t,r)=>{const n=ik(Tk,t.__scopeSelect),s=pk(Tk,t.__scopeSelect),[o,i]=a.useState(!1),c=Fl(r,s.onScrollButtonChange);return mf(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;i(r)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?e.jsx(Rk,{...t,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=Tk;var Rk=a.forwardRef((t,r)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=t,i=ik("SelectScrollButton",n),c=a.useRef(null),l=$S(n),d=a.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return a.useEffect(()=>()=>d(),[d]),mf(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),e.jsx(Qf.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:$f(o.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(s,50))}),onPointerMove:$f(o.onPointerMove,()=>{i.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(s,50))}),onPointerLeave:$f(o.onPointerLeave,()=>{d()})})}),Pk=a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t;return e.jsx(Qf.div,{"aria-hidden":!0,...a,ref:r})});Pk.displayName="SelectSeparator";var Ok="SelectArrow";a.forwardRef((t,r)=>{const{__scopeSelect:n,...a}=t,s=GS(n),o=HS(Ok,n),i=ik(Ok,n);return o.open&&"popper"===i.position?e.jsx(Nw,{...s,...a,ref:r}):null}).displayName=Ok;var Ik=a.forwardRef(({__scopeSelect:t,value:r,...n},s)=>{const o=a.useRef(null),i=Fl(s,o),c=Yh(r);return a.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(c!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[c,r]),e.jsx(Qf.select,{...n,style:{...FS,...n.style},ref:i,defaultValue:r})});function Dk(e){return""===e||void 0===e}function Uk(e){const t=ff(e),r=a.useRef(""),n=a.useRef(0),s=a.useCallback(e=>{const a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),o=a.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function Fk(e,t,r){const n=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(s=s.filter(e=>e!==r));const o=s.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return o!==r?o:void 0}Ik.displayName="SelectBubbleInput";var Mk=XS,zk=tk,Lk=rk,Vk=ak,$k=hk,Wk=xk,Bk=jk,Gk=Ck,Kk=Ak,Hk=Pk;const Zk=qS,Jk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Mk,{ref:a,className:je("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[r,e.jsx(zk,{asChild:!0,children:e.jsx(dh,{className:"h-4 w-4 opacity-50"})})]}));Jk.displayName=Mk.displayName;const qk=a.forwardRef(({className:t,children:r,position:n="popper",...s},o)=>{const{container:i}=a.useContext(Ga);return e.jsx(Lk,{container:i,children:e.jsx(Vk,{ref:o,className:je("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...s,children:e.jsx($k,{className:je("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});qk.displayName=Vk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Wk,{ref:n,className:je("px-2 py-1.5 text-sm font-semibold",t),...r})).displayName=Wk.displayName;const Yk=a.forwardRef(({className:t,children:r,...n},a)=>e.jsxs(Bk,{ref:a,className:je("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Kk,{children:e.jsx(fh,{className:"h-4 w-4"})})}),e.jsx(Gk,{children:r})]}));Yk.displayName=Bk.displayName;a.forwardRef(({className:t,...r},n)=>e.jsx(Hk,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",t),...r})).displayName=Hk.displayName;const Xk=({workspace:r})=>{const{user:n}=$a(),[a,s]=t.useState(0),[o,i]=t.useState(!1),[c,l]=t.useState([]),[d,u]=t.useState(null),{getUsers:f,removeUser:p,updateUser:m}=er(),{settings:h}=Yt();t.useEffect(()=>{r&&(i(!0),f(r._id).then(e=>{l(e)}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{i(!1)}))},[r,a]);const g=()=>{s(e=>e+1)};if(o||!r)return e.jsx(Qb,{});const b=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},y=c.map(e=>({...e,...b(e.user)})),v=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,x="admin"===v,w=(h?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e.jsxs("div",{children:[!x&&e.jsx("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),x&&e.jsxs("div",{className:"mb-4",children:[w&&e.jsx(Qk,{onInvite:g,workspaceId:r._id}),!w&&e.jsx("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("div",{children:e.jsxs("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),e.jsx("div",{children:e.jsx(jd,{variant:"ghost",size:"sm",onClick:g,progress:o,children:o?"Refreshing...":"Refresh"})})]}),e.jsx("ul",{className:"space-y-2",children:y.map((t,a)=>{const s=t.id===n?.id,o=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===t.id;return e.jsxs("li",{className:"flex items-center justify-between border rounded p-3",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:t.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),e.jsxs("div",{className:"flex items-center gap-x-1",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(Zk,{disabled:s||!x||o||d===t.id,value:t.role,onValueChange:e=>{return n=r._id,a=t.id,s=e,void(Ut(r,a)?De(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}}):(u(a),m(n,a,{role:s}).then(()=>{g()}).catch(e=>{De(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:n,userId:a,role:s}})}).finally(()=>{u(null)})));var n,a,s},children:[e.jsx(Jk,{children:e.jsx(ek,{placeholder:"Select a role"})}),e.jsx(qk,{children:r?.roles.map(t=>e.jsx(Yk,{value:t,children:t},t))})]}),d===t.id&&e.jsx("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(ud,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),s&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),o&&e.jsx("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!s&&!o&&x&&e.jsx(jd,{variant:"destructive",size:"sm",startIcon:e.jsx(vd,{}),onClick:()=>{var e;e=t.id,Ut(r,e)?De(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):p(r._id,e).then(()=>{g()}).catch(t=>{De(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},a)})}),0===c.length&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function Qk({onInvite:r,workspaceId:n}){const[a,s]=t.useState(""),[o,i]=t.useState("admin"),[c,l]=t.useState(!1),[d,u]=t.useState(null),[f,p]=t.useState(null),{addUser:m,getWorkspace:h}=er(),[g,b]=t.useState(null),{settings:y}=Yt(),v=y?.workspace.roles??g?.roles??[];t.useEffect(()=>{n&&h(n).then(b)},[n]);const x=()=>{u(null),p(null),s(""),i("admin")};return e.jsxs("div",{className:"flex gap-2 flex-col gap-y-2",children:[d&&e.jsx("div",{className:"text-red-500 capitalize",children:d}),f&&e.jsx("div",{className:"text-green-500 capitalize",children:f}),e.jsxs("div",{children:[e.jsx(_d,{children:"Invite member by email"}),e.jsx(Ld,{type:"email",value:a,onChange:e=>s(e.target.value),placeholder:"example@example.com"})]}),e.jsxs("div",{children:[e.jsx(_d,{children:"Role"}),e.jsxs(Zk,{value:o,onValueChange:i,children:[e.jsx(Jk,{children:e.jsx(ek,{placeholder:"Select a role"})}),e.jsx(qk,{children:v.map(t=>e.jsx(Yk,{value:t,children:t},t))})]})]}),e.jsx("div",{children:e.jsx(jd,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void u("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await m(n,e,o).then(()=>{p("User invited successfully"),r?.()}).catch(t=>{De(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:o}}),u(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{x()},6e3)})):u("Invalid email address format")},disabled:c||!a||!o,children:c?"Inviting...":`Invite as ${o}`})})]})}const ej=({workspace:t,section:r,setSection:n})=>{const{user:a}=$a(),s=("object"==typeof t.createdBy&&null!==t.createdBy?t.createdBy._id:t.createdBy)===a?.id;return e.jsxs("div",{className:"w-56 h-full flex flex-col space-y-6",children:[t&&e.jsx("div",{className:"border-b p-2 py-4",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[t.image&&t.image.trim()&&e.jsx("div",{className:"bg-blue-100 rounded flex items-center justify-center text-blue-600 font-medium px-0.5 py-0.5",style:{width:"40px",height:"40px",minWidth:"40px",minHeight:"40px"},children:e.jsx("img",{src:t.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:t.name})}),e.jsxs("div",{className:je("flex-1 min-w-0",t.image?"":"pl-2"),children:[e.jsx("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.workspaceId})]})]})}),e.jsx(tj,{title:"Account",children:e.jsx(rj,{activeSection:r,icon:e.jsx(wd,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>n("profile")})}),e.jsxs(tj,{title:"Workspace",children:[e.jsx(rj,{activeSection:r,icon:e.jsx(hd,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>n("general")}),e.jsx(rj,{activeSection:r,icon:e.jsx(Sd,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>n("users")}),e.jsx(rj,{activeSection:r,icon:e.jsx(od,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>n("subscription")}),e.jsx(rj,{activeSection:r,icon:e.jsx(bd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>n("features")}),s&&e.jsx(rj,{activeSection:r,icon:e.jsx(xd,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>n("danger")})]})]})};function tj({title:t,children:r}){return e.jsxs("div",{className:"px-2 flex flex-col space-y-1",children:[e.jsx("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:t}),r]})}function rj({icon:t,label:r,section:n,onClick:a,activeSection:s}){return e.jsxs("button",{className:je("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===s?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const nj=({workspace:r,onClose:n,open:a,onOpenChange:s,defaultSection:o="profile",section:i,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,f]=t.useState(!1),[p,m]=t.useState(o),h=void 0!==a?a:u,g=s||f,b=void 0!==i?i:p,y=c||m;if(!r)return null;const v=e.jsx(jd,{variant:"outline",size:"icon",children:e.jsx(hd,{className:"h-4 w-4"})});return e.jsxs(bh,{open:h,onOpenChange:e=>{g(e),!e&&n&&n()},children:[l&&e.jsx(yh,{asChild:!0,children:d||v}),e.jsxs(wh,{className:"flex max-w-2xl min-w-full sm:min-w-[800px] p-0 m-0 bg-muted sm:min-h-[600px] min-h-full gap-x-0 space-x-0",children:[e.jsx(jh,{className:"sr-only",children:"Workspace settings dialog"}),e.jsx(ej,{workspace:r,section:b,setSection:y}),e.jsxs("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e.jsxs(kh,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===b&&"Account","general"===b&&"Workspace Settings","users"===b&&"Workspace Members","subscription"===b&&"Plan & Billing","features"===b&&"Workspace Features","danger"===b&&"Danger Zone"]}),e.jsxs("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===b&&e.jsx(gS,{workspace:r}),"general"===b&&e.jsx(ky,{workspace:r}),"users"===b&&e.jsx(Xk,{workspace:r}),"subscription"===b&&e.jsx(OS,{workspace:r}),"features"===b&&e.jsx(py,{workspaceId:r._id?.toString()}),"danger"===b&&e.jsx(ey,{workspace:r})]})]})]})]})};var aj=Object.freeze({__proto__:null,WorkspaceSettingsDialog:nj,default:nj});function sj(t){const{workspace:r,setCurrentWorkspace:n,setOpen:a,workspacesToUse:s,switchingToId:o}=t,i=t.isCurrentWorkspace??!1,c=o===r._id,l=r.subscription??null,d=null!=l&&"object"==typeof l?l.plan??null:null,u=d?.name??"";return e.jsxs("div",{className:je("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":i}),children:[e.jsxs(zf,{className:"h-8 w-8 flex items-center justify-center",children:[e.jsx("div",{children:e.jsx(Lf,{src:r.image&&r.image.trim()?r.image:void 0})}),e.jsx(Vf,{children:(f=r.name,f.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-full",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:r.name})}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Sd,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.users?.length||0," members"]})]}),u&&e.jsx("div",{className:"max-w-fit",children:e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground bg-green-500 text-white rounded-full px-2 py-0.5",children:e.jsx("span",{className:"text-xs",children:u})})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i?null:e.jsx(jd,{size:"sm",disabled:null!==o||c,progress:c,onClick:()=>{t.switchToWorkspace(r).then(()=>a(!1)).catch(e=>{De(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:r._id}})})},children:"Switch to"}),e.jsx(nj,{workspace:r,onClose:()=>{if(i){const e=s.findIndex(e=>e._id?.toString()===r._id?.toString());-1!==e&&n(s[e])}}})]})]});var f}function oj(r){const{switching:n}=er(),[a,s]=t.useState(!1),[o,i]=t.useState("emoji"),[c,l]=t.useState("🏢"),[d,u]=t.useState(!1),{createWorkspace:f}=er(),p=Co({resolver:Il(Vu({name:mu().min(2,{message:"Workspace name must be at least 2 characters."}),image:mu().optional()})),defaultValues:{name:"",image:""}});return e.jsxs(bh,{open:a,onOpenChange:s,children:[e.jsx(yh,{asChild:!0,children:e.jsxs(jd,{className:"w-full rounded-none",disabled:n,children:[e.jsx(fd,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e.jsxs(wh,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e.jsxs(Sh,{children:[e.jsx(kh,{children:"Create New Workspace"}),e.jsx(jh,{children:"Create a new workspace to get started."})]}),e.jsx(Td,{...p,children:e.jsxs("form",{onSubmit:p.handleSubmit(async function(e){let t="";if("emoji"===o)t=wy(c);else if("url"===o&&e.image)try{new URL(e.image),t=e.image}catch{return void p.setError("image",{message:"Please enter a valid URL"})}u(!0);try{await f(e.name,t),s(!1),p.reset(),l("🏢"),i("emoji"),r?.onCreated?.()}catch(t){De(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{u(!1)}}),children:[e.jsx(Pd,{control:p.control,name:"name",render:({field:t})=>e.jsxs(Dd,{children:[e.jsx(Ud,{children:"Workspace Name"}),e.jsx(Fd,{children:e.jsx(Ld,{placeholder:"My Awesome Workspace",...t})}),e.jsx(zd,{})]})}),e.jsxs("div",{className:"flex flex-col gap-y-2 my-2",children:[e.jsxs("div",{children:[e.jsx(_d,{className:"text-sm font-medium",children:"Workspace Icon"}),e.jsx(Md,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e.jsxs(Sg,{value:o,onValueChange:e=>i(e),className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(kg,{value:"emoji",id:"emoji"}),e.jsxs(_d,{htmlFor:"emoji",className:"flex items-center gap-2",children:[e.jsx(gd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e.jsxs("div",{className:"flex items-center gap-x-2 my-1",children:[e.jsx(kg,{value:"url",id:"url"}),e.jsxs(_d,{htmlFor:"url",className:"flex items-center gap-2",children:[e.jsx(dd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),e.jsx(ib,{className:"h-32 w-full rounded-md border",children:e.jsx("div",{className:"p-4 grid grid-cols-8 gap-2",children:Sy.map((t,r)=>e.jsx("button",{type:"button",onClick:()=>(e=>{l(e),p.setValue("image",wy(e))})(t),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===t?"bg-primary text-primary-foreground":""),children:t},r))})})]}),"url"===o&&e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx(Pd,{control:p.control,name:"image",render:({field:t})=>e.jsxs(Dd,{children:[e.jsx(Ud,{children:"Image URL"}),e.jsx(Fd,{children:e.jsx(Ld,{placeholder:"https://example.com/image.png",...t})}),e.jsx(Md,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),e.jsx(zd,{})]})}),p.watch("image")&&p.watch("image")?.trim()&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium",children:"Preview:"}),e.jsx("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:e.jsx("img",{src:p.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[e.jsx(jd,{type:"button",variant:"outline",onClick:()=>{s(!1),p.reset(),l("🏢"),i("emoji")},disabled:d,children:"Cancel"}),e.jsx(jd,{type:"submit",disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(ud,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const ij=(e,t)=>null==e||0===e?"Free":xy(e,t),cj=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var lj=Object.freeze({__proto__:null,default:({open:r,onOpenChange:n,planVersions:a,currentPlanVersionId:s,currentStripePriceId:o,billingCurrency:i,onSelectPlan:c,loading:l=!1})=>{const[d,u]=t.useState(!1),[f,p]=t.useState(null),m=t.useMemo(()=>kS(o,a),[o,a]),h=m?.interval??null,g=m?.currency??null,b=t.useMemo(()=>wS(a),[a]),y=t.useMemo(()=>{const e=i?.trim().toLowerCase();return e?b.includes(e)?[e]:[]:b},[i,b]),[v,x]=t.useState(h||"monthly"),[w,S]=t.useState(()=>g&&y.includes(g)?g:y.length>0?y[0]:""),k=i?.trim()||w;t.useEffect(()=>{r&&(x(h||"monthly"),g&&y.includes(g)?S(g):y.length>0&&!y.includes(w)&&S(y[0]))},[r,h,g,y]);const j=t.useMemo(()=>[...a].sort((e,t)=>e.version-t.version),[a]),E=(e=>{const t=new Map;return e.forEach(e=>{e.subscriptionItems?.forEach(e=>{t.has(e._id)||t.set(e._id,e)})}),Array.from(t.values())})(j),C=E.filter(e=>"feature"===e.type),N=E.filter(e=>"limit"===e.type),A=E.filter(e=>"quota"===e.type),_=l||d,T=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},R=(e,t,r="monthly")=>{if("feature"===t.type)return e.features?.[t.slug]??!1;if("limit"===t.type)return e.limits?.[t.slug]??null;if("quota"===t.type){const n=SS(e,k,t.slug,r);return n||jS(e.quotas?.[t.slug],r)}return null},P=(e,t,r)=>{if("feature"===t.type)return!0===e?"✓":"—";if("limit"===t.type)return null!=e?String(e):"—";if("quota"===t.type){return ES("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"—"};return e.jsx(bh,{open:r,onOpenChange:n,children:e.jsxs(wh,{className:"inset-0 w-screen h-screen max-w-none rounded-none translate-x-0 translate-y-0 p-0 flex flex-col",children:[e.jsxs("div",{className:"flex-shrink-0 p-6 border-b space-y-4",children:[e.jsxs("div",{children:[e.jsx(kh,{className:"text-2xl font-bold",children:"Choose Your Plan"}),e.jsx(jh,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:!i?.trim()&&y.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm text-slate-600",children:"Currency"}),e.jsx("select",{"aria-label":"Select billing currency",value:w,onChange:e=>S(e.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-900 shadow-sm focus:outline-none focus:ring-2 focus:ring-primary",children:y.map(t=>{const r=gy(t);return e.jsx("option",{value:t,children:r?`${r} ${t.toUpperCase()}`:t.toUpperCase()},t)})})]})}),e.jsx("div",{className:"flex items-center gap-1 p-1 bg-slate-100 rounded-lg",role:"group","aria-label":"Billing interval",children:["monthly","quarterly","yearly"].map(t=>{const r=h===t;return e.jsx("button",{onClick:()=>x(t),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(v===t?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e.jsxs("span",{className:"flex items-center gap-1.5",children:["monthly"===t&&"Monthly","quarterly"===t&&"Quarterly","yearly"===t&&"Yearly","yearly"===t&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),r&&s&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},t)})})]})]}),e.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:i?.trim()&&0===y.length?e.jsxs("div",{className:"text-center py-12 px-4",children:[e.jsx("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===j.length?e.jsx("div",{className:"text-center py-12 text-gray-500",children:e.jsx("p",{children:"No plans available"})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:e.jsx("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e.jsxs("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*j.length+"px",borderCollapse:"separate"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:280,minWidth:280}}),j.map(t=>e.jsx("col",{style:{width:200,minWidth:200}},t._id))]}),e.jsx("thead",{children:e.jsxs("tr",{className:"align-top",children:[e.jsx("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),j.map(t=>{const r=t._id===s,a=(e=>{const t=e._id===s,r=h===v;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${T(v)}`,variant:"default",disabled:!1};if(!s)return{label:"Subscribe",variant:"default",disabled:!1};const n=j.findIndex(e=>e._id===s),a=j.findIndex(t=>t._id===e._id);return-1===n||-1===a?{label:"Select",variant:"default",disabled:!1}:a<n?{label:"Downgrade",variant:"outline",disabled:!1}:a>n?{label:"Upgrade",variant:"default",disabled:!1}:{label:"Select",variant:"default",disabled:!1}})(t),o=_&&t._id===f,i=(e=>yS(e,k,v))(t),m=yS(t,k,"monthly")??0,g="monthly"!==v&&null!==i?((e,t,r)=>{if(!e||0===e)return null;let n;switch(r){case"yearly":n=t/12;break;case"quarterly":n=t/3;break;default:return null}const a=(e-n)/e*100;return a>0?Math.round(a):null})(m,i,v):null,b=(e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===k.toLowerCase()))(t),y=t.pricingVariants?.length&&t.pricingVariants.some(e=>e.currency?.toLowerCase()===k.toLowerCase())?k:t.plan?.currency??k??"";return e.jsx("th",{className:"sticky top-0 z-20 border-b border-slate-200 p-3 shadow-[0_2px_4px_-2px_rgba(0,0,0,0.06)] "+(t._id===s?"bg-blue-50/80":"bg-white"),children:e.jsxs("div",{className:"flex h-full flex-col gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"text-lg font-bold text-slate-900 truncate",children:t.plan.name}),r&&e.jsx("span",{className:"shrink-0 rounded-md bg-blue-600 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-white",children:"Current"})]}),e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-2xl font-bold text-slate-900",children:b&&null!==i||b?ij(i,y):"—"}),null!==i&&i>0&&b&&e.jsx("span",{className:"text-sm text-slate-500",children:cj(v)})]}),null!==g&&g>0&&b&&e.jsxs("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",g,"% vs monthly"]})]}),t.plan.description&&e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:t.plan.description}),e.jsx(jd,{className:"mt-auto w-full",variant:a.variant,disabled:a.disabled||_||!b,progress:o,onClick:()=>(async e=>{if(!(e===s&&h===v||l||d)){u(!0),p(e);try{await c(e,v,k),n(!1)}catch(e){}finally{u(!1),p(null)}}})(t._id),children:o?"Processing...":b?a.label:"Unavailable"})]})},t._id)})]})}),e.jsxs("tbody",{children:[C.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Features"}),e.jsx("td",{colSpan:j.length,className:"border-t border-slate-200 bg-slate-100"})]}),C.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),j.map(r=>{const n=R(r,t,v),a=r.pricingVariants?.length?k:r.plan?.currency??k??"",o=P(n,t,a),i="feature"===t.type&&!0===n;return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Limits"}),e.jsx("td",{colSpan:j.length,className:"border-t border-slate-200 bg-slate-100"})]}),N.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),j.map(r=>{const n=R(r,t,v),a=r.pricingVariants?.length?k:r.plan?.currency??k??"",o=P(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]}),A.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("tr",{children:[e.jsx("td",{className:"sticky left-0 z-10 border-t border-slate-200 bg-slate-100 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-slate-600 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Quotas"}),e.jsx("td",{colSpan:j.length,className:"border-t border-slate-200 bg-slate-100"})]}),A.map(t=>e.jsxs("tr",{className:"group hover:bg-slate-50/50",children:[e.jsxs("td",{className:"sticky left-0 z-10 border-t border-slate-100 bg-white p-4 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)] group-hover:bg-slate-50/80",children:[e.jsx("div",{className:"font-medium text-sm text-slate-900",children:t.name}),t.description&&e.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:t.description})]}),j.map(r=>{const n=R(r,t,v),a=r.pricingVariants?.length?k:r.plan?.currency??k??"",o=P(n,t,a);return e.jsx("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(r._id===s?"bg-blue-50/50":"bg-white"),children:e.jsx("span",{className:"text-sm font-medium "+("—"===o?"text-slate-400":"text-slate-700"),children:o})},r._id)})]},t._id))]})]})]})})})})]})})}});exports.BaseApi=Zt,exports.BetaForm=({onSuccess:r,onError:n,className:a="w-full",fieldClassName:s="flex flex-col gap-1.5 w-full",language:o,customTexts:i={},autoFocus:c=!0,showSuccessMessage:l=!0,hideLogo:d=!1,hideTitles:u=!1})=>{const[f,p]=t.useState("en"),[m,h]=t.useState(!1),[g,b]=t.useState(!1),{submitBetaForm:y,isLoading:v,isSubmitting:x,error:w,config:S,success:k,message:j}=(()=>{const e=qt(),[r,n]=t.useState(null),[a,s]=t.useState(!0),[o,i]=t.useState(!1),[c,l]=t.useState(null),[d,u]=t.useState(!1),[f,p]=t.useState(null);return t.useEffect(()=>{(async()=>{s(!0);const t=new Wd(e),r=await t.fetchConfig();n(r),s(!1)})()},[e]),{isLoading:a,isSubmitting:o,config:r,error:c,success:d,message:f,submitBetaForm:t.useCallback(async t=>{if(!e){const e="SaaS OS context is not initialized";return l(e),{success:!1,message:e}}try{i(!0),l(null),u(!1),p(null);const r=new Wd(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return u(a),p(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return l(t),u(!1),p(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();t.useEffect(()=>{p((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(of).indexOf(e)?e:"en"})())},[]),t.useEffect(()=>{k&&l&&(h(!0),b(!0)),w&&b(!0)},[k,l,w]);const E={...of[o||f],...i},C=Co({resolver:Il(sf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});t.useEffect(()=>{c&&C.setFocus("name")},[c,C]);const N=C.formState.isValid&&!x;return e.jsx("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:v?e.jsxs("div",{className:je("flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",a),children:[e.jsx(Vd,{className:"h-24 w-24 rounded-lg"}),e.jsx(Vd,{className:"h-6 w-32"}),e.jsxs("div",{className:"w-full space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Vd,{className:"h-4 w-16"}),e.jsx(Vd,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Vd,{className:"h-4 w-16"}),e.jsx(Vd,{className:"h-10 w-full"})]}),e.jsx(Vd,{className:"h-10 w-full"})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full px-2.5 sm:px-6 py-2.5 sm:py-6 gap-y-2.5 sm:gap-y-4",children:[!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[S?.logo&&e.jsx(lf,{logo:S?.logo}),S?.name&&e.jsx("div",{children:S?.name})]}),e.jsx(Ws,{...C,children:e.jsxs("form",{onSubmit:C.handleSubmit(async e=>{try{const t=await y(e);t.success?(r?.(),C.reset(),l&&h(!0),b(!0)):(n?.(t.message),b(!0))}catch(e){n?.(e instanceof Error?e.message:E.errorMessage),b(!0)}}),className:a,noValidate:!0,"aria-busy":x,children:[!g&&e.jsxs(e.Fragment,{children:[!u&&S?.screen?.register&&e.jsx(cf,{screen:S?.screen?.register}),e.jsx(Pd,{control:C.control,name:"name",render:({field:t})=>e.jsxs(Dd,{className:s,children:[e.jsx(Ud,{children:E.nameLabel}),e.jsx(Fd,{children:e.jsx(Ld,{...t})}),e.jsx(Md,{}),e.jsx(zd,{})]})}),e.jsx(Pd,{control:C.control,name:"email",render:({field:t})=>e.jsxs(Dd,{className:s,children:[e.jsx(Ud,{children:E.emailLabel}),e.jsx(Fd,{children:e.jsx(Ld,{...t})}),e.jsx(Md,{}),e.jsx(zd,{})]})}),e.jsx(jd,{type:"submit",disabled:!N,className:s,children:x?E.submittingText:E.submitText})]}),g&&w&&e.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[e.jsxs("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[e.jsx("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"❗"}),w]}),e.jsx("div",{className:"mt-4 flex justify-center",children:e.jsx(jd,{type:"button",onClick:()=>{b(!1),C.reset()},className:s,children:"Try Again"})})]}),g&&m&&j&&e.jsx("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:S?.screen?.thankYou&&e.jsx(cf,{screen:S?.screen?.thankYou})})]})}),!g&&e.jsx("div",{children:e.jsxs("div",{children:["By submitting this form, you consent to our"," ",e.jsx("a",{href:S?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",e.jsx("a",{href:S?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})},exports.CURRENCY_DISPLAY=my,exports.CURRENCY_FLAG=hy,exports.PLAN_CURRENCY_CODES=yy,exports.PLAN_CURRENCY_OPTIONS=vy,exports.PricingPage=function({slug:t,children:r,loadingFallback:n,errorFallback:a}){const{items:s,plans:o,notes:i,loading:c,error:l,refetch:d}=nr(t);return c?void 0!==n?e.jsx(e.Fragment,{children:n}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(Vd,{className:"h-8 w-48"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(t=>e.jsx(Vd,{className:"h-64 rounded-lg"},t))})]}):l?a?e.jsx(e.Fragment,{children:a(l)}):e.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:l}):e.jsx(e.Fragment,{children:r({loading:c,error:l,items:s,plans:o,notes:i,refetch:d})})},exports.SaaSOSProvider=Qa,exports.SettingsApi=Jt,exports.SubscriptionContextProvider=fr,exports.UserApi=Ha,exports.WhenAuthenticated=e=>{const{children:t}=e,{status:r}=$a();return r!==exports.AuthStatus.authenticated?null:t},exports.WhenNoSubscription=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=pr();return s?r??null:a?.subscription?n??null:t},exports.WhenRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=$a();return n.includes(a?.role??"")?t:r||null},exports.WhenSubscription=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:s}=pr();return s?r??null:a?.subscription?t:n??null},exports.WhenSubscriptionToPlans=e=>{const{children:t,plans:r,loadingComponent:n,fallbackComponent:a}=e,{response:s,loading:o}=pr();if(o)return n??null;if(!s?.subscription)return a??null;const i=s.plan??s.subscription?.plan;if(!i)return a??null;const c=r.map(e=>e.trim().toLowerCase()),l=(i.slug??"").toLowerCase();return c.includes(l)?t:a??null},exports.WhenUnauthenticated=e=>{const{children:t}=e,{status:r}=$a();return r===exports.AuthStatus.authenticated?null:t},exports.WhenUserFeatureDisabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=df();return n(r)?null:t},exports.WhenUserFeatureEnabled=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=df();return n(r)?t:null},exports.WhenWorkspaceFeatureDisabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=er(),a=n?.features?.[r];return a?null:t},exports.WhenWorkspaceFeatureEnabled=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=er(),a=n?.features?.[r];return a?t:null},exports.WhenWorkspaceRoles=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=$a(),{currentWorkspace:s}=er(),o=s?.users.find(e=>e._id===a?.id);return o&&n.includes(o?.role??"")?t:r||null},exports.WorkspaceApi=Xt,exports.WorkspaceSwitcher=function(r){const{isAuthenticated:n,user:a}=$a(),s=o(qt()),{workspaces:i,currentWorkspace:c,loading:l,refreshing:d,switchingToId:u,fetchWorkspaces:f,getFeatures:p,refreshWorkspaces:m,setCurrentWorkspace:h,switchToWorkspace:g}=er(),{settings:b}=Yt(),[y,v]=t.useState(!1),[x,w]=t.useState(0),[S,k]=t.useState(""),j=l||d;t.useEffect(()=>{n&&s&&(0===i.length?(f(),p()):p())},[n,s]),t.useEffect(()=>{n&&s&&x>0&&m()},[x,n,s]);const E=i,C=E.filter(e=>e._id!==c?._id).filter(e=>e.name.toLowerCase().includes(S.toLowerCase())),N=b?.workspace.maxWorkspaces??Number.MAX_VALUE,A=E?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===a?.id?.toString()).length,_=N>(A??0);return e.jsxs(bh,{open:y,onOpenChange:v,children:[e.jsx(yh,{children:r.trigger?.(j,c)}),e.jsxs(wh,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e.jsxs(Sh,{children:[e.jsxs(kh,{className:"flex items-center gap-2",children:[e.jsx(rd,{className:"h-5 w-5"}),"Switch Workspace"]}),e.jsx(jh,{children:"Select a workspace to switch to or create a new one."})]}),!a&&e.jsx("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:e.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),a&&e.jsxs("div",{className:"flex flex-col gap-4",children:[c&&e.jsx(sj,{workspace:c,isCurrentWorkspace:!0,switchToWorkspace:g,switchingToId:u,onClose:()=>v(!1),setCurrentWorkspace:h,setOpen:v,workspacesToUse:E}),e.jsx(mb,{}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",C.length,")"]}),e.jsx("div",{children:e.jsx(jd,{progress:d,disabled:d,variant:"ghost",onClick:function(){n&&s&&w(e=>e+1)},startIcon:e.jsx(pd,{}),children:d?"Refreshing...":"Refresh"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(md,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(Ld,{placeholder:"Search workspaces...",value:S,onChange:e=>k(e.target.value),className:"pl-10"})]}),l?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(ud,{className:"h-6 w-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===C.length?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(rd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:S?"No workspaces found":"No workspaces available"})]}):e.jsx(ib,{className:"h-64",children:e.jsx("div",{className:"flex flex-col gap-2 my-2.5",children:C.map(t=>{const r=t._id===c?._id;return e.jsx(sj,{workspace:t,isCurrentWorkspace:r,switchToWorkspace:g,switchingToId:u,onClose:()=>v(!1),setCurrentWorkspace:h,setOpen:v,workspacesToUse:E},t._id)})})})]}),_&&e.jsxs(e.Fragment,{children:[e.jsx(mb,{}),e.jsx(oj,{onCreated:()=>{f()}})]})]})]})]})},exports.eventEmitter=Gt,exports.formatCents=xy,exports.formatOverageRate=function(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=by(r),s=(e/100).toFixed(2);return 1===n?`${a}${s}/unit`:`${a}${s}/${n.toLocaleString()} units`},exports.formatOverageRateWithLabel=function(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,s=by(n),o=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${s}${o}/${a.toLocaleString()} ${e}`:`${s}${o}/${r}`}return 1===a?`${s}${o}/unit`:`${s}${o}/${a.toLocaleString()} units`},exports.formatQuotaIncludedOverage=function(e,t,r,n,a){const s=null!=a&&a>=2?`${a.toLocaleString()} ${r}s`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${xy(t,n)}/${s}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${xy(t,n)}/${s}`:"—"},exports.formatQuotaWithPrice=ES,exports.getAvailableCurrenciesFromPlans=wS,exports.getBasePriceCents=yS,exports.getBillingIntervalAndCurrencyFromPriceId=kS,exports.getCurrencyFlag=gy,exports.getCurrencySymbol=by,exports.getDisplayCurrency=function(e,t){const r=bS(e,t);return r?r.currency:e.plan?.currency??""},exports.getPricingVariant=bS,exports.getQuotaDisplayValue=jS,exports.getQuotaDisplayWithVariant=SS,exports.getQuotaOverageCents=xS,exports.getQuotaUnitLabelFromName=function(e){const t=(e||"").trim().toLowerCase();if(!t)return"unit";const r=t.split(/\s+/)[0]??t;return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")&&r.length>1?r.slice(0,-1):r||"unit"},exports.getStripePriceIdForInterval=vS,exports.useCreateCheckoutSession=ir,exports.useInvoice=(e,r)=>{const{api:n}=Qt(),[a,s]=t.useState(null),[o,i]=t.useState(!1),[c,l]=t.useState(null),d=t.useCallback(async()=>{if(e&&r){i(!0),l(null);try{const t=await n.getInvoice(e,r);s(t.invoice)}catch(t){const n=t instanceof Error?t.message:"Failed to fetch invoice";l(n),De(t,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:r}})}finally{i(!1)}}else s(null)},[n,e,r]);return t.useEffect(()=>{d()},[d]),{invoice:a,loading:o,error:c,refetch:d}},exports.useInvoices=dr,exports.usePlanGroup=sr,exports.usePlanGroupVersions=or,exports.usePublicPlanGroupVersion=e=>{const{api:r}=Qt(),[n,a]=t.useState(null),[s,o]=t.useState(!1),[i,c]=t.useState(null),l=t.useCallback(async()=>{if(e){o(!0),c(null);try{const t=await r.getPlanGroupVersion(e);a(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";c(r),De(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else a(null)},[r,e]);return t.useEffect(()=>{l()},[l]),{planGroupVersion:n,loading:s,error:i,refetch:l}},exports.usePublicPlans=nr,exports.useSaaSAuth=$a,exports.useSaaSOs=qt,exports.useSaaSSettings=Yt,exports.useSaaSWorkspaces=er,exports.useSubscription=ar,exports.useSubscriptionContext=pr,exports.useSubscriptionManagement=lr,exports.useUpdateSubscription=cr,exports.useUserAttributes=function(){const e=t.useContext(Za);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e},exports.useUserFeatures=df;
30
30
  //# sourceMappingURL=index.js.map