@buildbase/sdk 0.0.21 โ†’ 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,23 +1,23 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,useRef as i,useMemo as s,createContext as c,useReducer as l,useEffect as d,useCallback as u,useState as f,useContext as p,Suspense as m,lazy as h,forwardRef as g,createElement as b,useLayoutEffect as y}from"react";import*as v from"react-dom";import w from"react-dom";var x;function S(e){return Boolean(e?.serverUrl&&e?.version&&e?.orgId)}function k(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=k(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function N(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=k(e))&&(n&&(n+=" "),n+=t);return n}!function(e){e.V1="v1"}(x||(x={}));const E=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),C="-",A=[],_=e=>{const t=P(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return R(e);const r=e.split(C),n=""===r[0]&&r.length>1?1:0;return T(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||A}return r[e]||A}}},T=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=T(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(C):e.slice(t).join(C),s=o.length;for(let e=0;e<s;e++){const t=o[e];if(t.validator(i))return t.classGroupId}},R=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})(),P=e=>{const{theme:t,classGroups:r}=e;return O(r,t)},O=(e,t)=>{const r=E();for(const n in e){const a=e[n];I(a,r,n,t)}return r},I=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];D(a,t,r,n)}},D=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?z(e,t,r,n):F(e,t,r,n):U(e,t,r)},U=(e,t,r)=>{(""===e?t:M(t,e)).classGroupId=r},F=(e,t,r,n)=>{L(e)?I(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},z=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,i]=a[e];I(i,M(t,o),r,n)}},M=(e,t)=>{let r=e;const n=t.split(C),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=E(),r.nextPart.set(t,a)),r=a}return r},L=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,o)=>{r[a]=o,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)}}},$=[],V=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),W=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let s=0;s<i;s++){const i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let c=s,l=!1;s.endsWith("!")?(c=s.slice(0,-1),l=!0):s.startsWith("!")&&(c=s.slice(1),l=!0);return V(t,l,c,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):V($,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},B=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 o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},G=/\s+/,K=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=K(e[n]))&&(r&&(r+=" "),r+=t);return r},H=(e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(G);let c="";for(let e=s.length-1;e>=0;e-=1){const t=s[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]:o(d).join(":"),b=u?g+"!":g,y=b+h;if(i.indexOf(y)>-1)continue;i.push(y);const v=a(h,m);for(let e=0;e<v.length;++e){const t=v[e];i.push(b+t)}c=t+(c.length>0?" "+c:c)}return c})(e,r);return a(e,o),o};return o=s=>{const c=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:j(e.cacheSize),parseClassName:W(e),sortModifiers:B(e),..._(e)}))(c),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=K(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Z=[],q=e=>{const t=t=>t[e]||Z;return t.isThemeGetter=!0,t},J=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Y=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X=/^\d+\/\d+$/,Q=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ee=/\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$/,te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,re=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ae=e=>X.test(e),oe=e=>!!e&&!Number.isNaN(Number(e)),ie=e=>!!e&&Number.isInteger(Number(e)),se=e=>e.endsWith("%")&&oe(e.slice(0,-1)),ce=e=>Q.test(e),le=()=>!0,de=e=>ee.test(e)&&!te.test(e),ue=()=>!1,fe=e=>re.test(e),pe=e=>ne.test(e),me=e=>!ge(e)&&!Se(e),he=e=>Te(e,Ie,ue),ge=e=>J.test(e),be=e=>Te(e,De,de),ye=e=>Te(e,Ue,oe),ve=e=>Te(e,Pe,ue),we=e=>Te(e,Oe,pe),xe=e=>Te(e,ze,fe),Se=e=>Y.test(e),ke=e=>Re(e,De),Ne=e=>Re(e,Fe),Ee=e=>Re(e,Pe),Ce=e=>Re(e,Ie),Ae=e=>Re(e,Oe),_e=e=>Re(e,ze,!0),Te=(e,t,r)=>{const n=J.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Re=(e,t,r=!1)=>{const n=Y.exec(e);return!!n&&(n[1]?t(n[1]):r)},Pe=e=>"position"===e||"percentage"===e,Oe=e=>"image"===e||"url"===e,Ie=e=>"length"===e||"size"===e||"bg-size"===e,De=e=>"length"===e,Ue=e=>"number"===e,Fe=e=>"family-name"===e,ze=e=>"shadow"===e,Me=H(()=>{const e=q("color"),t=q("font"),r=q("text"),n=q("font-weight"),a=q("tracking"),o=q("leading"),i=q("breakpoint"),s=q("container"),c=q("spacing"),l=q("radius"),d=q("shadow"),u=q("inset-shadow"),f=q("text-shadow"),p=q("drop-shadow"),m=q("blur"),h=q("perspective"),g=q("aspect"),b=q("ease"),y=q("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Se,ge],w=()=>[Se,ge,c],x=()=>[ae,"full","auto",...w()],S=()=>[ie,"none","subgrid",Se,ge],k=()=>["auto",{span:["full",ie,Se,ge]},ie,Se,ge],N=()=>[ie,"auto",Se,ge],E=()=>["auto","min","max","fr",Se,ge],C=()=>["auto",...w()],A=()=>[ae,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],_=()=>[e,Se,ge],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ee,ve,{position:[Se,ge]}],R=()=>["auto","cover","contain",Ce,he,{size:[Se,ge]}],P=()=>[se,ke,be],O=()=>["","none","full",l,Se,ge],I=()=>["",oe,ke,be],D=()=>[oe,se,Ee,ve],U=()=>["","none",m,Se,ge],F=()=>["none",oe,Se,ge],z=()=>["none",oe,Se,ge],M=()=>[oe,Se,ge],L=()=>[ae,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ce],breakpoint:[ce],color:[le],container:[ce],"drop-shadow":[ce],ease:["in","out","in-out"],font:[me],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ce],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ce],shadow:[ce],spacing:["px",oe],text:[ce],"text-shadow":[ce],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ae,ge,Se,g]}],container:["container"],columns:[{columns:[oe,ge,Se,s]}],"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:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[ie,"auto",Se,ge]}],basis:[{basis:[ae,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[oe,ae,"auto","initial","none",ge]}],grow:[{grow:["",oe,Se,ge]}],shrink:[{shrink:["",oe,Se,ge]}],order:[{order:[ie,"first","last","none",Se,ge]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"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:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],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":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",r,ke,be]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Se,ye]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",se,ge]}],"font-family":[{font:[Ne,ge,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,ge]}],"line-clamp":[{"line-clamp":[oe,"none",Se,ye]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",Se,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[oe,"from-font","auto",Se,be]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[oe,"auto",Se,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,ge]}],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,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ie,Se,ge],radial:["",Se,ge],conic:[ie,Se,ge]},Ae,we]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],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:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[oe,Se,ge]}],"outline-w":[{outline:["",oe,ke,be]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,_e,xe]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,_e,xe]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[oe,be]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,_e,xe]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[oe,Se,ge]}],"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":[oe]}],"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":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"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":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"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":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"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":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"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":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"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":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"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":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[Se,ge]}],"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":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":[oe]}],"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":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,ge]}],filter:[{filter:["","none",Se,ge]}],blur:[{blur:U()}],brightness:[{brightness:[oe,Se,ge]}],contrast:[{contrast:[oe,Se,ge]}],"drop-shadow":[{"drop-shadow":["","none",p,_e,xe]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",oe,Se,ge]}],"hue-rotate":[{"hue-rotate":[oe,Se,ge]}],invert:[{invert:["",oe,Se,ge]}],saturate:[{saturate:[oe,Se,ge]}],sepia:[{sepia:["",oe,Se,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,ge]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[oe,Se,ge]}],"backdrop-contrast":[{"backdrop-contrast":[oe,Se,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",oe,Se,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[oe,Se,ge]}],"backdrop-invert":[{"backdrop-invert":["",oe,Se,ge]}],"backdrop-opacity":[{"backdrop-opacity":[oe,Se,ge]}],"backdrop-saturate":[{"backdrop-saturate":[oe,Se,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",oe,Se,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[oe,"initial",Se,ge]}],ease:[{ease:["linear","initial",b,Se,ge]}],delay:[{delay:[oe,Se,ge]}],animate:[{animate:["none",y,Se,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,ge]}],"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:z()}],"scale-x":[{"scale-x":z()}],"scale-y":[{"scale-y":z()}],"scale-z":[{"scale-z":z()}],"scale-3d":["scale-3d"],skew:[{skew:M()}],"skew-x":[{"skew-x":M()}],"skew-y":[{"skew-y":M()}],transform:[{transform:[Se,ge,"","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:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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,ge]}],"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":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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,ge]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[oe,ke,be,ye]}],stroke:[{stroke:["none",..._()]}],"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 Le(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function je(...e){return Me(N(e))}let $e=!0;function Ve(e,...t){console.error(e,...t)}function We(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(We);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":We(a);return r}function Be(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function Ge(e,t){try{const r=await fetch(e,t);if(Le()){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 o=r.clone();let i;try{const e=await o.text();if(e)try{i=JSON.parse(e)}catch{i=e.substring(0,200)+(e.length>200?"...":"")}}catch{i="(read failed)"}!function(e,...t){$e&&Le()&&console.log(e,...t)}("[SDK API]",n,e,{request:We(a),response:We(i),status:r.status})}return r}catch(e){if(Be(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 Ke(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function He(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 Ze(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await He(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 He(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class qe 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,qe)}}const Je=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&&($e=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Be(e))return;const r=e instanceof Error?e:new qe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof qe?r:new qe(r.message,r.name,t,r);if(this.config.enableConsoleLogging&&function(e,...t){$e&&Le()&&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){Ve("[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 Ye(e,t={}){Je.handleError(e,t)}function Xe(e,t={}){return!Be(e)&&(Je.handleError(e,t),!0)}class Qe extends o{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(Ye(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ve("[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("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("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 et=()=>({type:"AUTHENTICATION_STARTED"}),tt=()=>({type:"AUTHENTICATION_PROCESSING"}),rt=()=>({type:"AUTHENTICATION_FAILED"}),nt=e=>({type:"SET_SESSION",payload:e}),at=()=>({type:"REMOVE_SESSION"});function ot(e,t,r){const n=i(t),a=i(r),o=i(void 0),c=i(e);return n.current=t,a.current=r,s(()=>{const t=n.current(e);if(void 0!==o.current){if((a.current?a.current(o.current,t):Object.is(o.current,t))&&c.current===e)return o.current}return o.current=t,c.current=e,t},[e])}function it({name:e,initialState:r,reducer:n,initializer:o}){const i=c(null),d=c(null),u=c(null),f=a.memo(({children:e})=>{const[a,c]=l(n,r,o||(e=>e)),f=s(()=>({state:a,dispatch:c}),[a,c]);return t(u.Provider,{value:f,children:t(i.Provider,{value:a,children:t(d.Provider,{value:c,children:e})})})});f.displayName=`${e}Provider`;const p=t=>new Error(`use${e}${t} must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`),m=()=>{const e=a.useContext(i);if(null===e)throw p("State");return e};return{Provider:f,useContext:()=>{const e=a.useContext(u);if(!e)throw p("Context");return e},useState:m,useDispatch:()=>{const e=a.useContext(d);if(null===e)throw p("Dispatch");return e},useSelector:(e,t)=>{const r=e||(e=>e);return ot(m(),r,t)}}}var st;function ct(e){return{isAuthenticated:e===st.authenticated,isLoading:e===st.loading||e===st.redirecting||e===st.authenticating,isRedirecting:e===st.redirecting}}function lt(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return Ye(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function dt(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){Ye(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function ut(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){Ye(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}!function(e){e.loading="loading",e.redirecting="redirecting",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(st||(st={}));const ft="code",pt="saas-session-id",mt="saas-workspace-current";function ht(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 gt(){ut(pt)}function bt(){if("undefined"==typeof window)return null;try{return lt(pt)}catch(e){return Ye(e,{component:"auth/utils",action:"getSessionId",metadata:{key:pt}}),null}}function yt(){const e=bt(),t={};return e&&(t["x-session-id"]=e),t}function vt(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(ft)}catch(e){return Ye(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:ft}}),null}}function wt(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}function xt(e,t,r){return{...e,[t]:r}}function St(e,t){return{...e,...t}}const kt=()=>({session:null,status:st.loading}),{Provider:Nt,useState:Et,useDispatch:Ct}=it({name:"Auth",initialState:kt(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return xt(e,"status",st.redirecting);case"AUTHENTICATION_PROCESSING":return xt(e,"status",st.authenticating);case"AUTHENTICATION_FAILED":return St(e,{session:null,status:st.unauthenticated});case"SET_SESSION":{const n=t.payload;return r=n.sessionId,dt(pt,r),St(e,{session:n,status:st.authenticated})}case"REMOVE_SESSION":return gt(),St(e,{session:null,status:st.unauthenticated});default:return e}var r},initializer:kt}),At=Nt,_t=Et,Tt=Ct,Rt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),Pt=e=>({type:"SET_SETTINGS",payload:e}),Ot=()=>({serverUrl:"",version:x.V1,orgId:"",settings:null}),{Provider:It,useState:Dt,useDispatch:Ut}=it({name:"OS",initialState:Ot(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return St(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return Ot();case"SET_SETTINGS":return xt(e,"settings",t.payload);default:return e}}}),Ft=It,zt=Dt,Mt=Ut,Lt=e=>({type:"SET_WORKSPACES",payload:e}),jt=e=>({type:"SET_ALL_FEATURES",payload:e}),$t=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),Vt=()=>({type:"RESET_CURRENT_WORKSPACE"}),Wt=e=>({type:"SET_IS_INITIALIZED",payload:e}),Bt=e=>({type:"SET_LOADING",payload:e}),Gt=e=>({type:"SET_ERROR",payload:e}),Kt=e=>({type:"SET_REFRESHING",payload:e}),Ht=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),Zt=e=>{e?dt(mt,e._id):ut(mt)},qt=()=>lt(mt),Jt=()=>{ut(mt)},Yt=(e,t)=>!!e&&t.some(t=>t._id===e);function Xt(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 Qt(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:er,useState:tr,useDispatch:rr}=it({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 xt(e,"workspaces",t.payload);case"SET_ALL_FEATURES":return xt(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return Zt(t.payload),xt(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return Jt(),xt(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return xt(e,"isInitialized",t.payload);case"SET_LOADING":return xt(e,"loading",t.payload);case"SET_ERROR":return xt(e,"error",t.payload);case"SET_REFRESHING":return xt(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return xt(e,"switchingToId",t.payload);default:return e}}}),nr=er,ar=tr,or=rr,ir=a.memo(({children:e})=>t(Ft,{children:t(At,{children:t(nr,{children:e})})}));ir.displayName="SDKContextProvider";const sr=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){Ye(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 cr(e,t,r){d(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Be(e)||(r?.onError?r.onError(e):Ye(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},t)}const lr="SDK is not ready (missing serverUrl, version, or orgId)";class dr{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(lr);if(this.requireOrgId&&!this.orgId?.trim())throw new Error(lr)}get baseUrl(){return this.ensureReady(),`${this.serverUrl}/api/${this.version}/${this.basePath}`}getAuthHeaders(){return yt()}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 Ze(await Ge(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"),Ge(this.url(e),{...t,headers:r})}}class ur extends dr{constructor(e){super({...e,requireOrgId:!0})}async getSettings(e){return this.fetchJson(`${this.orgId}/settings`,{signal:e},"Failed to fetch settings")}}function fr(){return jr(e=>e.os)}function pr(){const e=$r(),t=fr(),{serverUrl:r,version:n,orgId:a,settings:o}=t,c=i(!1),l=s(()=>S(t)?new ur({serverUrl:r,version:n,orgId:a}):null,[r,n,a]),d=u(async t=>{if(c.current)return o||null;if(o)return o;if(!l)return null;c.current=!0;try{const r=await l.getSettings(t);return e.os(Pt(r)),r}catch(e){return Xe(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:r,version:n,orgId:a}}),null}finally{c.current=!1}},[l,o,e]);return cr(async e=>{!S(t)||o||c.current||await d(e)},[r,n,a,d],{onError:e=>Xe(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:r,version:n,orgId:a}})}),s(()=>({settings:o,getSettings:d}),[o,d])}class mr extends dr{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||r}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||r}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||n}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||r}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||r}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}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 o=await a.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch invoices");return o}return o}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}async recordUsage(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/usage`,{method:"POST",body:JSON.stringify(t)});if(!r.ok){let e="Failed to record usage";try{e=(await r.json()).message||e}catch{e=`Failed to record usage (${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 record usage");return n.data||n}return n}async getQuotaUsageStatus(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/usage/status?quotaSlug=${encodeURIComponent(t)}`);if(!r.ok){let e="Failed to fetch quota usage status";try{e=(await r.json()).message||e}catch{e=404===r.status?"Workspace not found or no subscription available":401===r.status?"Unauthorized - Please check your session":`Failed to fetch quota usage status (${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 quota usage status");return n.data||n}return n}async getAllQuotaUsage(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/usage/all`);if(!t.ok){let e="Failed to fetch all quota usage";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 all quota usage (${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 all quota usage");return r.data||r}return r}async getUsageLogs(e,t){const r=new URLSearchParams;t?.quotaSlug&&r.append("quotaSlug",t.quotaSlug),t?.from&&r.append("from",t.from),t?.to&&r.append("to",t.to),t?.source&&r.append("source",t.source),t?.page&&r.append("page",t.page.toString()),t?.limit&&r.append("limit",t.limit.toString());const n=r.toString(),a=`workspaces/${e}/subscription/usage/logs${n?`?${n}`:""}`,o=await this.fetchResponse(a);if(!o.ok){let e="Failed to fetch usage logs";try{e=(await o.json()).message||e}catch{e=404===o.status?"Workspace not found":401===o.status?"Unauthorized - Please check your session":`Failed to fetch usage logs (${o.status}: ${o.statusText})`}throw new Error(e)}const i=await o.json();if(void 0!==i.success){if(!i.success)throw new Error(i.message||"Failed to fetch usage logs");return i.data||i}return i}}function hr(){const e=fr(),t=function(e){return s(()=>new mr(e),[e.serverUrl,e.version,e.orgId])}(e);return s(()=>({os:e,api:t}),[e,t])}const gr=()=>{const e=$r(),{os:t,api:r}=hr(),n=jr(e=>e.workspaces),o=jr(e=>e.auth.session?.user),i=u((t,r)=>{if((!(t._id===n.currentWorkspace?._id)||r?.forceEmit)&&t){const r=n.currentWorkspace;e.workspaces($t(t)),sr.emitWorkspaceChanged(t,r).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]),s=u(async(r,n)=>{const a=++p.current;e.workspaces(Ht(r._id));try{const e=t.auth?.callbacks?.onWorkspaceChange;if(e){const t=Qt(r,o?.id);try{await e({workspace:r,user:o??null,role:t})}catch(e){throw Ye(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:r._id}}),e}if(a!==p.current)return}i(r,n)}finally{a===p.current&&e.workspaces(Ht(null))}},[e,t.auth?.callbacks?.onWorkspaceChange,i,o]);d(()=>{if(!n.isInitialized){const t=qt();if(e.workspaces(Wt(!0)),t){const e=n.workspaces.find(e=>e._id===t);e&&s(e,{forceEmit:!0}).catch(()=>{})}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,s]);const c=u(()=>{e.workspaces(Vt())},[e]),l=a.useRef(!1),f=a.useRef(!1),p=a.useRef(0),m=u(async()=>{if(!n.loading&&!l.current){l.current=!0,e.workspaces(Bt(!0)),e.workspaces(Gt(null));try{const t=await r.getWorkspaces();if(e.workspaces(Lt(t)),t.length>0){const e=qt();if(e&&Yt(e,t)){const r=t.find(t=>t._id===e);if(r)try{await s(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await s(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(Gt(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(Bt(!1)),l.current=!1}}},[r,n.loading,e,s]),h=u(async()=>{if(!n.refreshing&&!l.current){l.current=!0,e.workspaces(Kt(!0));try{const t=await r.getWorkspaces();e.workspaces(Lt(t))}catch(e){}finally{e.workspaces(Kt(!1)),l.current=!1}}},[r,n.refreshing,e]),g=u(async(t,a)=>{const o=await r.createWorkspace({name:t,image:a});e.workspaces(Lt([...n.workspaces,o])),sr.emitWorkspaceCreated(o).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),b=u(async(t,a)=>{const o=await r.updateWorkspace(t._id,a);e.workspaces(Lt(n.workspaces.map(e=>e._id===t._id?o:e))),sr.emitWorkspaceUpdated(o).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:o._id}})})},[r,n.workspaces,e]),y=u(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(jt(t)),t}catch(e){return Ye(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),v=u(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const t=n.currentWorkspace._id,r=n.workspaces.find(e=>e._id===t);if(r)r!==n.currentWorkspace&&e.workspaces($t(r));else if(n.workspaces.length>0){const e=n.workspaces[0];e._id!==t&&s(e).catch(()=>{})}},[n.workspaces,n.currentWorkspace,e,s]);const w=u(async e=>await r.getWorkspaceUsers(e),[r]),x=u(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&sr.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{Ye(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),o},[r,n.workspaces]),S=u(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&Xt(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;sr.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{Ye(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return i},[r,n.workspaces]),k=u(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&Xt(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&sr.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{Ye(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),N=u(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return sr.emitUserUpdated(n,t||void 0).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),E=u(async()=>await r.getProfile(),[r]),C=u(async e=>await r.getWorkspace(e),[r]),A=u(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!Xt(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(Lt(n.workspaces.filter(e=>e._id!==t))),n.currentWorkspace?._id===t&&e.workspaces(Vt()),a&&sr.emitWorkspaceDeleted(a).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:m,refreshWorkspaces:h,refreshing:n.refreshing,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,switchToWorkspace:s,resetCurrentWorkspace:c,createWorkspace:g,allFeatures:n.allFeatures,getFeatures:y,updateFeature:v,getWorkspace:C,updateWorkspace:b,getUsers:w,addUser:x,removeUser:S,updateUser:k,getProfile:E,updateUserProfile:N,deleteWorkspace:A,switching:null!==n.switchingToId,switchingToId:n.switchingToId}};let br=[];function yr(){br.forEach(e=>e())}let vr=[];function wr(){vr.forEach(e=>e())}const xr=e=>{const{os:t,api:r}=hr(),n=S(t),[a,o]=f(null),[i,s]=f(!1),[c,l]=f(null),p=u(async()=>{if(e&&n){s(!0),l(null);try{const t=await r.getPublicPlans(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";l(r),Ye(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{s(!1)}}else o(null)},[r,e,n]);d(()=>{p()},[p]);const m=e&&!n||i;return{items:a?.items??[],plans:a?.plans??[],notes:a?.notes,loading:m,error:c,refetch:p}},Sr=e=>{const{api:t}=hr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),c=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getPlanGroupVersion(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";s(r),Ye(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{c()},[c]),{planGroupVersion:r,loading:a,error:i,refetch:c}},kr=e=>{const{api:t}=hr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),c=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getCurrentSubscription(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";s(r),Ye(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{c()},[c]),{subscription:r,loading:a,error:i,refetch:c}},Nr=(e,t)=>{const{api:r}=hr(),[n,a]=f(null),[o,i]=f(!1),[s,c]=f(null),l=u(async()=>{if(e){i(!0),c(null);try{const n=t?await r.getPlanGroupByVersion(e,t):await r.getPlanGroup(e);a(n)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch plan group";c(n),Ye(r,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{l()},[l]),{planGroup:n,loading:o,error:s,refetch:l}},Er=e=>{const{api:t}=hr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),c=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getPlanGroupVersions(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";s(r),Ye(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{c()},[c]),{versions:r,loading:a,error:i,refetch:c}},Cr=e=>{const{api:t}=hr(),[r,n]=f(!1),[a,o]=f(null);return{createCheckoutSession:u(async r=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{return await t.createCheckoutSession(e,r)}catch(t){const n=t instanceof Error?t.message:"Failed to create checkout session";throw o(n),Ye(t,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:r}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Ar=e=>{const{api:t}=hr(),[r,n]=f(!1),[a,o]=f(null),i=u(async(r,a)=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const n={planVersionId:r,...a?.billingInterval&&{billingInterval:a.billingInterval},...a?.successUrl&&{successUrl:a.successUrl},...a?.cancelUrl&&{cancelUrl:a.cancelUrl}},o=await t.updateSubscription(e,n);return wr(),o}catch(t){const n=t instanceof Error?t.message:"Failed to update subscription";throw o(n),Ye(t,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:r,options:a}}),t}finally{n(!1)}},[t,e]);return{updateSubscription:i,loading:r,error:a}},_r=(e,t)=>{const r=kr(e),n=Nr(e,t),a=Ar(e),o=u(async()=>{await Promise.all([r.refetch(),n.refetch()])},[r.refetch,n.refetch]);return{subscription:r.subscription,planGroup:n.planGroup,loading:r.loading||n.loading||a.loading,error:r.error||n.error||a.error,updateSubscription:a.updateSubscription,refetch:o}},Tr=(e,t=10,r)=>{const{api:n}=hr(),[a,o]=f([]),[i,s]=f(!1),[c,l]=f(!1),[p,m]=f(null),h=u(async()=>{if(!e)return o([]),void s(!1);l(!0),m(null);try{const a=await n.listInvoices(e,t,r);o(a.invoices||[]),s(a.has_more||!1)}catch(n){const a=n instanceof Error?n.message:"Failed to fetch invoices";m(a),Ye(n,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:t,startingAfter:r}})}finally{l(!1)}},[n,e,t,r]);return d(()=>{h()},[h]),{invoices:a,hasMore:i,loading:c,error:p,refetch:h}},Rr=(e,t)=>{const{api:r}=hr(),[n,a]=f(null),[o,i]=f(!1),[s,c]=f(null),l=u(async()=>{if(e&&t){i(!0),c(null);try{const n=await r.getInvoice(e,t);a(n.invoice)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch invoice";c(n),Ye(r,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{l()},[l]),{invoice:n,loading:o,error:s,refetch:l}},Pr=e=>{const{api:t}=hr(),[r,n]=f(!1),[a,o]=f(null);return{cancelSubscription:u(async()=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const r=await t.cancelSubscriptionAtPeriodEnd(e);return wr(),r}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw o(r),Ye(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Or=e=>{const{api:t}=hr(),[r,n]=f(!1),[a,o]=f(null);return{resumeSubscription:u(async()=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const r=await t.resumeSubscription(e);return wr(),r}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw o(r),Ye(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Ir=e=>{const{api:t}=hr(),[r,n]=f(!1),[a,o]=f(null);return{recordUsage:u(async r=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const n=await t.recordUsage(e,r);return yr(),n}catch(t){const n=t instanceof Error?t.message:"Failed to record usage";throw o(n),Ye(t,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:r}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Dr=(e,t)=>{const{api:r}=hr(),[n,a]=f(null),[o,i]=f(!1),[s,c]=f(null),l=u(async()=>{if(e&&t){i(!0),c(null);try{const n=await r.getQuotaUsageStatus(e,t);a(n)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch quota usage status";c(n),Ye(r,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{l()},[l]),{status:n,loading:o,error:s,refetch:l}},Ur=e=>{const{api:t}=hr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),c=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getAllQuotaUsage(e);n(r.quotas)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch all quota usage";s(r),Ye(t,{component:"useAllQuotaUsage",action:"fetchAllUsage",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{c()},[c]),{quotas:r,loading:a,error:i,refetch:c}},Fr=(e,t,r)=>{const{api:n}=hr(),[a,o]=f([]),[i,s]=f(0),[c,l]=f(0),[p,m]=f(1),[h,g]=f(!1),[b,y]=f(!1),[v,w]=f(!1),[x,S]=f(null),k=r?.from,N=r?.to,E=r?.source,C=r?.page,A=r?.limit,_=u(async()=>{if(!e)return o([]),s(0),l(0),m(1),g(!1),void y(!1);w(!0),S(null);try{const r={...t&&{quotaSlug:t},...k&&{from:k},...N&&{to:N},...E&&{source:E},...C&&{page:C},...A&&{limit:A}},a=await n.getUsageLogs(e,r);o(a.docs||[]),s(a.totalDocs||0),l(a.totalPages||0),m(a.page||1),g(a.hasNextPage||!1),y(a.hasPrevPage||!1)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch usage logs";S(n),Ye(r,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:t}})}finally{w(!1)}},[n,e,t,k,N,E,C,A]);return d(()=>{_()},[_]),{logs:a,totalDocs:i,totalPages:c,page:p,hasNextPage:h,hasPrevPage:b,loading:v,error:x,refetch:_}},zr=c(null);zr.displayName="SubscriptionContext";const Mr=a.memo(function({children:e}){const{currentWorkspace:r}=gr(),{subscription:n,loading:a,error:o,refetch:i}=kr(r?._id);d(()=>{return e=i,vr.push(e),()=>{vr=vr.filter(t=>t!==e)};var e},[i]);const c=s(()=>({response:n,loading:a,error:o,refetch:i}),[n,a,o,i]);return t(zr.Provider,{value:c,children:e})});function Lr(){const e=p(zr);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 jr(e,t){const r=zt(),n=_t(),a=ar(),o=e||(e=>e);return ot(s(()=>({os:r,auth:n,workspaces:a}),[r,n,a]),o,t)}function $r(){const e=Tt(),t=Mt(),r=or();return s(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}Mr.displayName="SubscriptionContextProvider";const Vr=c(null);Vr.displayName="QuotaUsageContext";const Wr=a.memo(function({children:e}){const{currentWorkspace:r}=gr(),{quotas:n,loading:a,error:o,refetch:i}=Ur(r?._id);d(()=>{return e=i,br.push(e),()=>{br=br.filter(t=>t!==e)};var e},[i]);const c=s(()=>({quotas:n,loading:a,error:o,refetch:i}),[n,a,o,i]);return t(Vr.Provider,{value:c,children:e})});function Br(){const e=p(Vr);if(null===e)throw new Error("useQuotaUsageContext must be used within QuotaUsageContextProvider. Make sure QuotaUsageContextProvider is wrapping your application (or the tree that uses quota gates).");return e}Wr.displayName="QuotaUsageContextProvider";class Gr extends dr{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 Kr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Hr}=Object.prototype,{getPrototypeOf:Zr}=Object,{iterator:qr,toStringTag:Jr}=Symbol,Yr=(Xr=Object.create(null),e=>{const t=Hr.call(e);return Xr[t]||(Xr[t]=t.slice(8,-1).toLowerCase())});var Xr;const Qr=e=>(e=e.toLowerCase(),t=>Yr(t)===e),en=e=>t=>typeof t===e,{isArray:tn}=Array,rn=en("undefined");function nn(e){return null!==e&&!rn(e)&&null!==e.constructor&&!rn(e.constructor)&&sn(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const an=Qr("ArrayBuffer");const on=en("string"),sn=en("function"),cn=en("number"),ln=e=>null!==e&&"object"==typeof e,dn=e=>{if("object"!==Yr(e))return!1;const t=Zr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Jr in e||qr in e)},un=Qr("Date"),fn=Qr("File"),pn=Qr("Blob"),mn=Qr("FileList"),hn=Qr("URLSearchParams"),[gn,bn,yn,vn]=["ReadableStream","Request","Response","Headers"].map(Qr);function wn(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),tn(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(nn(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function xn(e,t){if(nn(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 Sn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,kn=e=>!rn(e)&&e!==Sn;const Nn=(En="undefined"!=typeof Uint8Array&&Zr(Uint8Array),e=>En&&e instanceof En);var En;const Cn=Qr("HTMLFormElement"),An=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_n=Qr("RegExp"),Tn=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};wn(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Rn=Qr("AsyncFunction"),Pn=(On="function"==typeof setImmediate,In=sn(Sn.postMessage),On?setImmediate:In?(Dn=`axios@${Math.random()}`,Un=[],Sn.addEventListener("message",({source:e,data:t})=>{e===Sn&&t===Dn&&Un.length&&Un.shift()()},!1),e=>{Un.push(e),Sn.postMessage(Dn,"*")}):e=>setTimeout(e));var On,In,Dn,Un;const Fn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Sn):"undefined"!=typeof process&&process.nextTick||Pn;var zn={isArray:tn,isArrayBuffer:an,isBuffer:nn,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||sn(e.append)&&("formdata"===(t=Yr(e))||"object"===t&&sn(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&an(e.buffer),t},isString:on,isNumber:cn,isBoolean:e=>!0===e||!1===e,isObject:ln,isPlainObject:dn,isEmptyObject:e=>{if(!ln(e)||nn(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:gn,isRequest:bn,isResponse:yn,isHeaders:vn,isUndefined:rn,isDate:un,isFile:fn,isBlob:pn,isRegExp:_n,isFunction:sn,isStream:e=>ln(e)&&sn(e.pipe),isURLSearchParams:hn,isTypedArray:Nn,isFileList:mn,forEach:wn,merge:function e(){const{caseless:t,skipUndefined:r}=kn(this)&&this||{},n={},a=(a,o)=>{const i=t&&xn(n,o)||o;dn(n[i])&&dn(a)?n[i]=e(n[i],a):dn(a)?n[i]=e({},a):tn(a)?n[i]=a.slice():r&&rn(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&wn(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(wn(t,(t,n)=>{r&&sn(t)?Object.defineProperty(e,n,{value:Kr(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,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Zr(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Yr,kindOfTest:Qr,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(tn(e))return e;let t=e.length;if(!cn(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[qr]).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:Cn,hasOwnProperty:An,hasOwnProp:An,reduceDescriptors:Tn,freezeMethods:e=>{Tn(e,(t,r)=>{if(sn(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];sn(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 tn(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:xn,global:Sn,isContextDefined:kn,isSpecCompliantForm:function(e){return!!(e&&sn(e.append)&&"FormData"===e[Jr]&&e[qr])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(ln(e)){if(t.indexOf(e)>=0)return;if(nn(e))return e;if(!("toJSON"in e)){t[n]=e;const a=tn(e)?[]:{};return wn(e,(e,t)=>{const o=r(e,n+1);!rn(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Rn,isThenable:e=>e&&(ln(e)||sn(e))&&sn(e.then)&&sn(e.catch),setImmediate:Pn,asap:Fn,isIterable:e=>null!=e&&sn(e[qr])};let Mn=class e extends Error{static from(t,r,n,a,o,i){const s=new e(t.message,r||t.code,n,a,o);return s.cause=t,s.name=t.name,i&&Object.assign(s,i),s}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:zn.toJSONObject(this.config),code:this.code,status:this.status}}};Mn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Mn.ERR_BAD_OPTION="ERR_BAD_OPTION",Mn.ECONNABORTED="ECONNABORTED",Mn.ETIMEDOUT="ETIMEDOUT",Mn.ERR_NETWORK="ERR_NETWORK",Mn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Mn.ERR_DEPRECATED="ERR_DEPRECATED",Mn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Mn.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Mn.ERR_CANCELED="ERR_CANCELED",Mn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Mn.ERR_INVALID_URL="ERR_INVALID_URL";function Ln(e){return zn.isPlainObject(e)||zn.isArray(e)}function jn(e){return zn.endsWith(e,"[]")?e.slice(0,-2):e}function $n(e,t,r){return e?e.concat(t).map(function(e,t){return e=jn(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Vn=zn.toFlatObject(zn,{},null,function(e){return/^is[A-Z]/.test(e)});function Wn(e,t,r){if(!zn.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=zn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!zn.isUndefined(t[e])})).metaTokens,a=r.visitor||l,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&zn.isSpecCompliantForm(t);if(!zn.isFunction(a))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(zn.isDate(e))return e.toISOString();if(zn.isBoolean(e))return e.toString();if(!s&&zn.isBlob(e))throw new Mn("Blob is not supported. Use a Buffer instead.");return zn.isArrayBuffer(e)||zn.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(zn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(zn.isArray(e)&&function(e){return zn.isArray(e)&&!e.some(Ln)}(e)||(zn.isFileList(e)||zn.endsWith(r,"[]"))&&(s=zn.toArray(e)))return r=jn(r),s.forEach(function(e,n){!zn.isUndefined(e)&&null!==e&&t.append(!0===i?$n([r],n,o):null===i?r:r+"[]",c(e))}),!1;return!!Ln(e)||(t.append($n(a,r,o),c(e)),!1)}const d=[],u=Object.assign(Vn,{defaultVisitor:l,convertValue:c,isVisitable:Ln});if(!zn.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!zn.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),zn.forEach(r,function(r,o){!0===(!(zn.isUndefined(r)||null===r)&&a.call(t,r,zn.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Bn(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&&Wn(e,this,t)}const Kn=Gn.prototype;function Hn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Zn(e,t,r){if(!t)return e;const n=r&&r.encode||Hn,a=zn.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let i;if(i=o?o(t,a):zn.isURLSearchParams(t)?t.toString():new Gn(t,a).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Kn.append=function(e,t){this._pairs.push([e,t])},Kn.toString=function(e){const t=e?function(t){return e.call(this,t,Bn)}:Bn;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class qn{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){zn.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Jn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Yn={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 Xn="undefined"!=typeof window&&"undefined"!=typeof document,Qn="object"==typeof navigator&&navigator||void 0,ea=Xn&&(!Qn||["ReactNative","NativeScript","NS"].indexOf(Qn.product)<0),ta="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ra=Xn&&window.location.href||"http://localhost";var na={...Object.freeze({__proto__:null,hasBrowserEnv:Xn,hasStandardBrowserEnv:ea,hasStandardBrowserWebWorkerEnv:ta,navigator:Qn,origin:ra}),...Yn};function aa(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&zn.isArray(n)?n.length:o,s)return zn.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&zn.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&zn.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(zn.isFormData(e)&&zn.isFunction(e.entries)){const r={};return zn.forEachEntry(e,(e,n)=>{t(function(e){return zn.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const oa={transitional:Jn,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=zn.isObject(e);a&&zn.isHTMLForm(e)&&(e=new FormData(e));if(zn.isFormData(e))return n?JSON.stringify(aa(e)):e;if(zn.isArrayBuffer(e)||zn.isBuffer(e)||zn.isStream(e)||zn.isFile(e)||zn.isBlob(e)||zn.isReadableStream(e))return e;if(zn.isArrayBufferView(e))return e.buffer;if(zn.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Wn(e,new na.classes.URLSearchParams,{visitor:function(e,t,r,n){return na.isNode&&zn.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=zn.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Wn(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(zn.isString(e))try{return(t||JSON.parse)(e),zn.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||oa.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(zn.isResponse(e)||zn.isReadableStream(e))return e;if(e&&zn.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 Mn.from(e,Mn.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:na.classes.FormData,Blob:na.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};zn.forEach(["delete","get","head","post","put","patch"],e=>{oa.headers[e]={}});const ia=zn.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 sa=Symbol("internals");function ca(e){return e&&String(e).trim().toLowerCase()}function la(e){return!1===e||null==e?e:zn.isArray(e)?e.map(la):String(e)}function da(e,t,r,n,a){return zn.isFunction(n)?n.call(this,t,r):(a&&(t=r),zn.isString(t)?zn.isString(n)?-1!==t.indexOf(n):zn.isRegExp(n)?n.test(t):void 0:void 0)}let ua=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=ca(t);if(!a)throw new Error("header name must be a non-empty string");const o=zn.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=la(e))}const o=(e,t)=>zn.forEach(e,(e,r)=>a(e,r,t));if(zn.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(zn.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((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]&&ia[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(zn.isObject(e)&&zn.isIterable(e)){let r,n,a={};for(const t of e){if(!zn.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?zn.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=ca(e)){const r=zn.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(zn.isFunction(t))return t.call(this,e,r);if(zn.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ca(e)){const r=zn.findKey(this,e);return!(!r||void 0===this[r]||t&&!da(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=ca(e)){const a=zn.findKey(r,e);!a||t&&!da(0,r[a],a,t)||(delete r[a],n=!0)}}return zn.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&&!da(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return zn.forEach(this,(n,a)=>{const o=zn.findKey(r,a);if(o)return t[o]=la(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=la(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return zn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&zn.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[sa]=this[sa]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ca(e);t[n]||(!function(e,t){const r=zn.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 zn.isArray(e)?e.forEach(n):n(e),this}};function fa(e,t){const r=this||oa,n=t||r,a=ua.from(n.headers);let o=n.data;return zn.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function pa(e){return!(!e||!e.__CANCEL__)}ua.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),zn.reduceDescriptors(ua.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),zn.freezeMethods(ua);let ma=class extends Mn{constructor(e,t,r){super(null==e?"canceled":e,Mn.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function ha(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Mn("Request failed with status code "+r.status,[Mn.ERR_BAD_REQUEST,Mn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const ga=(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,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),l=n[i];a||(a=c),r[o]=s,n[o]=c;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+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,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,c=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},ba=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},ya=e=>(...t)=>zn.asap(()=>e(...t));var va=na.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,na.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(na.origin),na.navigator&&/(msie|trident)/i.test(na.navigator.userAgent)):()=>!0,wa=na.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];zn.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),zn.isString(n)&&s.push(`path=${n}`),zn.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),zn.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.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 xa(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 Sa=e=>e instanceof ua?{...e}:e;function ka(e,t){t=t||{};const r={};function n(e,t,r,n){return zn.isPlainObject(e)&&zn.isPlainObject(t)?zn.merge.call({caseless:n},e,t):zn.isPlainObject(t)?zn.merge({},t):zn.isArray(t)?t.slice():t}function a(e,t,r,a){return zn.isUndefined(t)?zn.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!zn.isUndefined(t))return n(void 0,t)}function i(e,t){return zn.isUndefined(t)?zn.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(Sa(e),Sa(t),0,!0)};return zn.forEach(Object.keys({...e,...t}),function(n){const o=c[n]||a,i=o(e[n],t[n],n);zn.isUndefined(i)&&o!==s||(r[n]=i)}),r}var Na=e=>{const t=ka({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=ua.from(i),t.url=Zn(xa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),zn.isFormData(r))if(na.hasStandardBrowserEnv||na.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(zn.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(na.hasStandardBrowserEnv&&(n&&zn.isFunction(n)&&(n=n(t)),n||!1!==n&&va(t.url))){const e=a&&o&&wa.read(o);e&&i.set(a,e)}return t};var Ea="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=Na(e);let a=n.data;const o=ua.from(n.headers).normalize();let i,s,c,l,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){l&&l(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=ua.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());ha(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 Mn("Request aborted",Mn.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new Mn(n,Mn.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||Jn;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Mn(t,a.clarifyTimeoutError?Mn.ETIMEDOUT:Mn.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&zn.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),zn.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([c,d]=ga(p,!0),h.addEventListener("progress",c)),f&&h.upload&&([s,l]=ga(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",l)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new ma(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===na.protocols.indexOf(b)?r(new Mn("Unsupported protocol "+b+":",Mn.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Ca=(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,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Mn?t:new ma(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Mn(`timeout of ${t}ms exceeded`,Mn.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>zn.asap(i),s}},Aa=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},_a=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()}},Ta=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of _a(e))yield*Aa(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:Ra}=zn,Pa=(({Request:e,Response:t})=>({Request:e,Response:t}))(zn.global),{ReadableStream:Oa,TextEncoder:Ia}=zn.global,Da=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ua=e=>{e=zn.merge.call({skipUndefined:!0},Pa,e);const{fetch:t,Request:r,Response:n}=e,a=t?Ra(t):"function"==typeof fetch,o=Ra(r),i=Ra(n);if(!a)return!1;const s=a&&Ra(Oa),c=a&&("function"==typeof Ia?(l=new Ia,e=>l.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var l;const d=o&&s&&Da(()=>{let e=!1;const t=new r(na.origin,{body:new Oa,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&Da(()=>zn.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 Mn(`Response type '${e}' is not supported`,Mn.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=zn.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(zn.isBlob(e))return e.size;if(zn.isSpecCompliantForm(e)){const t=new r(na.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return zn.isArrayBufferView(e)||zn.isArrayBuffer(e)?e.byteLength:(zn.isURLSearchParams(e)&&(e+=""),zn.isString(e)?(await c(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:c,cancelToken:l,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:y,withCredentials:v="same-origin",fetchOptions:w}=Na(e),x=t||fetch;b=b?(b+"").toLowerCase():"text";let S=Ca([c,l&&l.toAbortSignal()],m),k=null;const N=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(E=await p(y,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(zn.isFormData(s)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=ba(E,ga(ya(g)));s=Ta(t.body,65536,e,r)}}zn.isString(v)||(v=v?"include":"omit");const t=o&&"credentials"in r.prototype,c={...w,signal:S,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",credentials:t?v:void 0};k=o&&new r(a,c);let l=await(o?x(k,w):x(a,c));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&N)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=zn.toFiniteNumber(l.headers.get("content-length")),[r,a]=h&&ba(t,ga(ya(h),!0))||[];l=new n(Ta(l.body,65536,r,()=>{a&&a(),N&&N()}),e)}b=b||"text";let C=await f[zn.findKey(f,b)||"text"](l,e);return!m&&N&&N(),await new Promise((t,r)=>{ha(t,r,{data:C,headers:ua.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(N&&N(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Mn("Network Error",Mn.ERR_NETWORK,e,k),{cause:t.cause||t});throw Mn.from(t,t&&t.code,e,k)}}},Fa=new Map,za=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,c=o.length,l=Fa;for(;c--;)i=o[c],s=l.get(i),void 0===s&&l.set(i,s=c?new Map:Ua(t)),l=s;return s};za();const Ma={http:null,xhr:Ea,fetch:{get:za}};zn.forEach(Ma,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const La=e=>`- ${e}`,ja=e=>zn.isFunction(e)||null===e||!1===e;var $a={getAdapter:function(e,t){e=zn.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!ja(n)&&(a=Ma[(r=String(n)).toLowerCase()],void 0===a))throw new Mn(`Unknown adapter '${r}'`);if(a&&(zn.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).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(La).join("\n"):" "+La(e[0]):"as no adapter specified";throw new Mn("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:Ma};function Va(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ma(null,e)}function Wa(e){Va(e),e.headers=ua.from(e.headers),e.data=fa.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return $a.getAdapter(e.adapter||oa.adapter,e)(e).then(function(t){return Va(e),t.data=fa.call(e,e.transformResponse,t),t.headers=ua.from(t.headers),t},function(t){return pa(t)||(Va(e),t&&t.response&&(t.response.data=fa.call(e,e.transformResponse,t.response),t.response.headers=ua.from(t.response.headers))),Promise.reject(t)})}const Ba="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 Ka={};Ga.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ba+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Mn(n(a," has been removed"+(t?" in "+t:"")),Mn.ERR_DEPRECATED);return t&&!Ka[a]&&(Ka[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},Ga.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Ha={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Mn("options must be an object",Mn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new Mn("option "+o+" must be "+r,Mn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Mn("Unknown option "+o,Mn.ERR_BAD_OPTION)}},validators:Ga};const Za=Ha.validators;let qa=class{constructor(e){this.defaults=e||{},this.interceptors={request:new qn,response:new qn}}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=ka(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ha.assertOptions(r,{silentJSONParsing:Za.transitional(Za.boolean),forcedJSONParsing:Za.transitional(Za.boolean),clarifyTimeoutError:Za.transitional(Za.boolean)},!1),null!=n&&(zn.isFunction(n)?t.paramsSerializer={serialize:n}:Ha.assertOptions(n,{encode:Za.function,serialize:Za.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ha.assertOptions(t,{baseUrl:Za.spelling("baseURL"),withXsrfToken:Za.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&zn.merge(a.common,a[t.method]);a&&zn.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=ua.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.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(!s){const e=[Wa.bind(this),void 0];for(e.unshift(...i),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=Wa.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 Zn(xa((e=ka(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};zn.forEach(["delete","get","head","options"],function(e){qa.prototype[e]=function(t,r){return this.request(ka(r||{},{method:e,url:t,data:(r||{}).data}))}}),zn.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(ka(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}qa.prototype[e]=t(),qa.prototype[e+"Form"]=t(!0)});const Ja={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(Ja).forEach(([e,t])=>{Ja[t]=e});const Ya=function e(t){const r=new qa(t),n=Kr(qa.prototype.request,r);return zn.extend(n,qa.prototype,r,{allOwnKeys:!0}),zn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ka(t,r))},n}(oa);Ya.Axios=qa,Ya.CanceledError=ma,Ya.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 ma(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}}},Ya.isCancel=pa,Ya.VERSION=Ba,Ya.toFormData=Wn,Ya.AxiosError=Mn,Ya.Cancel=Ya.CanceledError,Ya.all=function(e){return Promise.all(e)},Ya.spread=function(e){return function(t){return e.apply(null,t)}},Ya.isAxiosError=function(e){return zn.isObject(e)&&!0===e.isAxiosError},Ya.mergeConfig=ka,Ya.AxiosHeaders=ua,Ya.formToJSON=e=>aa(zn.isHTMLForm(e)?new FormData(e):e),Ya.getAdapter=$a.getAdapter,Ya.HttpStatusCode=Ja,Ya.default=Ya;const{Axios:Xa,AxiosError:Qa,CanceledError:eo,isCancel:to,CancelToken:ro,VERSION:no,all:ao,Cancel:oo,isAxiosError:io,spread:so,toFormData:co,AxiosHeaders:lo,HttpStatusCode:uo,formToJSON:fo,getAdapter:po,mergeConfig:mo}=Ya;const ho=new class{constructor(e={}){this.client=Ya.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=bt();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 go=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 bo(){return jr(e=>e.auth)}function yo(){const e=$r(),t=bo(),r=fr(),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:c}=gr(),l=u(async()=>{e.auth(et());try{const t=await ho.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(rt()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(rt()),Ye(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),d=u(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut(),e.auth(at()),i(),gt()}catch(e){Ye(e,{component:"useSaaSAuth",action:"signOut"}),gt()}},[e,i,o?.callbacks?.onSignOut]),f=u(e=>{c?go.openWorkspaceSettings(e):Ye(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[c]),p=s(()=>ct(t.status),[t.status]);return s(()=>({user:t.session?.user,session:t.session,status:t.status,...p,signIn:l,signOut:d,openWorkspaceSettings:f}),[t.session,t.status,p,l,d,f])}const vo=a.memo(({children:e,callbacks:n})=>{const o=$r(),i=bo(),c=fr(),l=ct(i.status).isAuthenticated,f=a.useRef(!1),p=a.useRef(null),m=a.useRef(!1),h=s(()=>n,[n]),g=u(async e=>{try{if(h?.handleAuthentication){const{sessionId:t}=await h.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=c;if(!S(r))throw new Error("OS configuration is not available");const{serverUrl:n,version:a,orgId:i}=r,s=new Gr({serverUrl:n,version:a}),l=await s.getProfile(t),d=wt(ht(l,i,r.auth?.clientId||""),t);o.auth(nt(d)),function(){try{const e=new URL(window.location.href);e.searchParams.delete(ft),window.history.replaceState({},"",e.toString())}catch(e){Ye(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:ft}})}}()}}catch(t){throw Ye(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(rt()),t}},[o,h,c]);return cr(async e=>{if("undefined"==typeof window)return;if(l)return;if(m.current)return;if(vt())return;const t=bt();if(t){m.current=!0;try{if(!S(c))return m.current=!1,void Ye(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const{orgId:r}=c;let n;try{const r=new Gr({serverUrl:c.serverUrl,version:c.version});n=await r.getProfile(t,e)}catch(e){if(!Xe(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return m.current=!1,gt(),void o.auth(rt())}const a=wt(ht(n,r,c.auth?.clientId||""),t);o.auth(nt(a))}catch(e){if(!Xe(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;gt(),o.auth(rt())}finally{m.current=!1}}else o.auth(rt())},[l,o,c]),d(()=>{const e=vt();e&&(f.current||p.current===e||S(c)&&(f.current=!0,p.current=e,o.auth(tt()),g(e).then(()=>{p.current=null}).catch(t=>{Ye(t,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{code:e.substring(0,10)+"..."}}),p.current=null}).finally(()=>{f.current=!1})))},[g,c.serverUrl,c.version,c.orgId]),t(r,{children:e})});vo.displayName="AuthProviderWrapper";const wo=a.memo(({config:e,auth:n,children:o})=>{const i=$r(),c=fr(),l=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);d(()=>{i.os(Rt({...e,auth:l}))},[e,l,i]);const u=s(()=>S(c)?new ur(c):null,[c.serverUrl,c.version,c.orgId]);return cr(async e=>{if(!u||c.settings)return;const t=await u.getSettings(e);i.os(Pt(t))},[u,c.settings,i],{onError:e=>Ye(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:c.serverUrl,version:c.version,orgId:c.orgId}})}),t(r,{children:o})});wo.displayName="ContextConfigProvider";const xo=c({container:null,setContainer:()=>{}}),So=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(xo.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});So.displayName="PortalProvider";class ko extends dr{constructor(e){super(e)}async getAttributes(e){const t=await this.fetchResponse("users/attributes",{signal:e});if(!t.ok)throw new Error(await Ke(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 Ke(t,"Failed to fetch user features"));const r=await t.json();return"object"==typeof r&&null!==r?r:{}}}const No=a.createContext(void 0),Eo=a.memo(({children:e})=>{const r=fr(),n=function(){const e=fr();return s(()=>new ko(e),[e.serverUrl,e.version])}(),{isAuthenticated:o}=yo(),{serverUrl:i,version:c}=r,[l,d]=f({}),[p,m]=f({}),[h,g]=f(!1),[b,y]=f(null),v=u(async e=>{if(i&&c&&o)try{const t=await n.getAttributes(e);d(t)}catch(e){if(Be(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");y(t),Ye(e,{component:"UserProvider",action:"fetchAttributes"})}else d({})},[n,i,c,o]),w=u(async()=>{if(i&&c&&o){g(!0),y(null);try{await v()}finally{g(!1)}}},[i,c,o,v]),x=u(async e=>{g(!0),y(null);try{const t=await n.updateAttributes(e);return await v(),t}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw y(r),Ye(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),t}finally{g(!1)}},[n,v]),S=u(async(e,t)=>{g(!0),y(null);try{const r=await n.updateAttribute(e,t);return await v(),r}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw y(n),Ye(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),r}finally{g(!1)}},[n,v]),k=u(async e=>{if(i&&c&&o)try{const t=await n.getFeatures(e);m(t)}catch(e){if(Be(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");y(t),Ye(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[n,i,c,o]),N=u(async()=>{if(i&&c&&o){g(!0),y(null);try{await k()}finally{g(!1)}}},[i,c,o,k]);cr(async e=>{if(!o||!i||!c)return d({}),void m({});g(!0),y(null);try{await Promise.all([v(e),k(e)])}finally{g(!1)}},[o,i,c,v,k],{onError:e=>Ye(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const E=a.useMemo(()=>({attributes:l,features:p,isLoading:h,error:b,updateAttributes:x,updateAttribute:S,refreshAttributes:w,refreshFeatures:N}),[l,p,h,b,x,S,w,N]);return t(No.Provider,{value:E,children:e})});Eo.displayName="UserProvider";const Co=h(()=>Promise.resolve().then(function(){return dE}).then(e=>({default:e.default}))),Ao=({children:n})=>{const{currentWorkspace:a}=gr(),[o,i]=f(!1),[s,c]=f("profile");return d(()=>{const e=go.getState();i(e.open),c(e.section);return go.subscribe((e,t)=>{i(e),c(t)})},[]),e(r,{children:[n,a&&o&&t(m,{fallback:null,children:t(Co,{workspace:a,open:o,onOpenChange:e=>{e||go.closeSettings()},section:s,onSectionChange:e=>{go.setSection(e)},showTrigger:!1})})]})},_o=(e,t,r)=>{if(t!==x.V1)throw new Error(`Invalid version: "${t}". Only "${x.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).`)},To=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{_o(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),c=a.useMemo(()=>o?.callbacks,[o?.callbacks]),l=a.useMemo(()=>o?.callbacks?.handleEvent,[o?.callbacks]);return d(()=>(sr.setCallbacks(l?{handleEvent:l}:null),()=>{sr.setCallbacks(null)}),[l]),t(Qe,{children:t(ir,{children:t(vo,{callbacks:c,children:t(So,{children:t(wo,{config:s,auth:o,children:t(Eo,{children:t(Mr,{children:t(Wr,{children:t(Ao,{children:i})})})})})})})})})});To.displayName="SaaSOSProvider";var Ro=e=>"checkbox"===e.type,Po=e=>e instanceof Date,Oo=e=>null==e;const Io=e=>"object"==typeof e;var Do=e=>!Oo(e)&&!Array.isArray(e)&&Io(e)&&!Po(e),Uo=e=>Do(e)&&e.target?Ro(e.target)?e.target.checked:e.target.value:e,Fo=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),zo="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Mo(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(zo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Do(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Do(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]=Mo(e[t]));return n}var Lo=e=>/^\w*$/.test(e),jo=e=>void 0===e,$o=e=>Array.isArray(e)?e.filter(Boolean):[],Vo=e=>$o(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Wo=(e,t,r)=>{if(!t||!Do(e))return r;const n=(Lo(t)?[t]:Vo(t)).reduce((e,t)=>Oo(e)?e:e[t],e);return jo(n)||n===e?jo(e[t])?r:e[t]:n},Bo=e=>"boolean"==typeof e,Go=e=>"function"==typeof e,Ko=(e,t,r)=>{let n=-1;const a=Lo(t)?[t]:Vo(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Do(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Ho="blur",Zo="focusout",qo="change",Jo="onBlur",Yo="onChange",Xo="onSubmit",Qo="onTouched",ei="all",ti="max",ri="min",ni="maxLength",ai="minLength",oi="pattern",ii="required",si="validate",ci=a.createContext(null);ci.displayName="HookFormControlContext";const li=()=>a.useContext(ci);var di=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==ei&&(t._proxyFormState[a]=!n||ei),r&&(r[a]=!0),e[a]}});return a};const ui="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var fi=e=>"string"==typeof e,pi=(e,t,r,n,a)=>fi(e)?(n&&t.watch.add(e),Wo(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Wo(r,e))):(n&&(t.watchAll=!0),r),mi=e=>Oo(e)||!Io(e);function hi(e,t,r=new WeakSet){if(mi(e)||mi(t))return Object.is(e,t);if(Po(e)&&Po(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 o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(Po(n)&&Po(e)||Do(n)&&Do(e)||Array.isArray(n)&&Array.isArray(e)?!hi(n,e,r):!Object.is(n,e))return!1}}return!0}function gi(e){const t=li(),{name:r,disabled:n,control:o=t,shouldUnregister:i,defaultValue:s,exact:c=!0}=e,l=Fo(o._names.array,r),d=a.useMemo(()=>Wo(o._formValues,r,Wo(o._defaultValues,r,s)),[o,r,s]),u=function(e){const t=li(),{control:r=t,name:n,defaultValue:o,disabled:i,exact:s,compute:c}=e||{},l=a.useRef(o),d=a.useRef(c),u=a.useRef(void 0),f=a.useRef(r),p=a.useRef(n);d.current=c;const[m,h]=a.useState(()=>{const e=r._getWatch(n,l.current);return d.current?d.current(e):e}),g=a.useCallback(e=>{const t=pi(n,r._names,e||r._formValues,!1,l.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),b=a.useCallback(e=>{if(!i){const t=pi(n,r._names,e||r._formValues,!1,l.current);if(d.current){const e=d.current(t);hi(e,u.current)||(h(e),u.current=e)}else h(t)}},[r._formValues,r._names,i,n]);ui(()=>(f.current===r&&hi(p.current,n)||(f.current=r,p.current=n,b()),r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{b(e.values)}})),[r,s,n,b]),a.useEffect(()=>r._removeUnmounted());const y=f.current!==r,v=p.current,w=a.useMemo(()=>{if(i)return null;const e=!y&&!hi(v,n);return y||e?g():null},[i,y,n,v,g]);return null!==w?w:m}({control:o,name:r,defaultValue:d,exact:c}),f=function(e){const t=li(),{control:r=t,disabled:n,name:o,exact:i}=e||{},[s,c]=a.useState(r._formState),l=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ui(()=>r._subscribe({name:o,formState:l.current,exact:i,callback:e=>{!n&&c({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>di(s,r,l.current,!1),[s,r])}({control:o,name:r,exact:c}),p=a.useRef(e),m=a.useRef(void 0),h=a.useRef(o.register(r,{...e.rules,value:u,...Bo(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Wo(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Wo(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Wo(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Wo(f.validatingFields,r)},error:{enumerable:!0,get:()=>Wo(f.errors,r)}}),[f,r]),b=a.useCallback(e=>h.current.onChange({target:{value:Uo(e),name:r},type:qo}),[r]),y=a.useCallback(()=>h.current.onBlur({target:{value:Wo(o._formValues,r),name:r},type:Ho}),[r,o._formValues]),v=a.useCallback(e=>{const t=Wo(o._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>Go(e.focus)&&e.focus(),select:()=>Go(e.select)&&e.select(),setCustomValidity:t=>Go(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Go(e.reportValidity)&&e.reportValidity()})},[o._fields,r]),w=a.useMemo(()=>({name:r,value:u,...Bo(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:b,onBlur:y,ref:v}),[r,n,f.disabled,b,y,v,u]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i,t=m.current;t&&t!==r&&!l&&o.unregister(t),o.register(r,{...p.current.rules,...Bo(p.current.disabled)?{disabled:p.current.disabled}:{}});const n=(e,t)=>{const r=Wo(o._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=Mo(Wo(o._options.defaultValues,r,p.current.defaultValue));Ko(o._defaultValues,r,e),jo(Wo(o._formValues,r))&&Ko(o._formValues,r,e)}return!l&&o.register(r),m.current=r,()=>{(l?e&&!o._state.action:e)?o.unregister(r):n(r,!1)}},[r,o,l,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:w,formState:f,fieldState:g}),[w,f,g])}const bi=e=>e.render(gi(e)),yi=a.createContext(null);yi.displayName="HookFormContext";const vi=e=>{const{children:t,watch:r,getValues:n,getFieldState:o,setError:i,clearErrors:s,setValue:c,trigger:l,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}=e;return a.createElement(yi.Provider,{value:a.useMemo(()=>({watch:r,getValues:n,getFieldState:o,setError:i,clearErrors:s,setValue:c,trigger:l,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}),[s,h,d,o,n,p,g,f,u,i,b,c,y,l,m,r])},a.createElement(ci.Provider,{value:h},t))};var wi=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},xi=e=>Array.isArray(e)?e:[e],Si=()=>{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 ki(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Do(a)&&o){const e=ki(a,o);Do(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var Ni=e=>Do(e)&&!Object.keys(e).length,Ei=e=>"file"===e.type,Ci=e=>{if(!zo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ai=e=>"select-multiple"===e.type,_i=e=>"radio"===e.type,Ti=e=>Ci(e)&&e.isConnected;function Ri(e,t){const r=Array.isArray(t)?t:Lo(t)?[t]:Vo(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=jo(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Do(n)&&Ni(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!jo(e[t]))return!1;return!0}(n))&&Ri(e,r.slice(0,-1)),e}function Pi(e){return Array.isArray(e)||Do(e)&&!(e=>{for(const t in e)if(Go(e[t]))return!0;return!1})(e)}function Oi(e,t={}){for(const r in e){const n=e[r];Pi(n)?(t[r]=Array.isArray(n)?[]:{},Oi(n,t[r])):jo(n)||(t[r]=!0)}return t}function Ii(e,t,r){r||(r=Oi(t));for(const n in e){const a=e[n];if(Pi(a))jo(t)||mi(r[n])?r[n]=Oi(a,Array.isArray(a)?[]:{}):Ii(a,Oo(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!hi(a,e)}}return r}const Di={value:!1,isValid:!1},Ui={value:!0,isValid:!0};var Fi=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&&!jo(e[0].attributes.value)?jo(e[0].value)||""===e[0].value?Ui:{value:e[0].value,isValid:!0}:Ui:Di}return Di},zi=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>jo(e)?e:t?""===e?NaN:e?+e:e:r&&fi(e)?new Date(e):n?n(e):e;const Mi={isValid:!1,value:null};var Li=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Mi):Mi;function ji(e){const t=e.ref;return Ei(t)?t.files:_i(t)?Li(e.refs).value:Ai(t)?[...t.selectedOptions].map(({value:e})=>e):Ro(t)?Fi(e.refs).value:zi(jo(t.value)?e.ref.value:t.value,e)}var $i=e=>e instanceof RegExp,Vi=e=>jo(e)?e:$i(e)?e.source:Do(e)?$i(e.value)?e.value.source:e.value:e,Wi=e=>({isOnSubmit:!e||e===Xo,isOnBlur:e===Jo,isOnChange:e===Yo,isOnAll:e===ei,isOnTouch:e===Qo});const Bi="AsyncFunction";var Gi=e=>!!e&&!!e.validate&&!!(Go(e.validate)&&e.validate.constructor.name===Bi||Do(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===Bi)),Ki=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Hi=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Wo(e,a);if(r){const{_f:e,...o}=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(Hi(o,t))break}else if(Do(o)&&Hi(o,t))break}}};function Zi(e,t,r){const n=Wo(e,r);if(n||Lo(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Wo(t,n),i=Wo(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var qi=(e,t,r)=>{const n=xi(Wo(e,r));return Ko(n,"root",t[r]),Ko(e,r,n),e};function Ji(e,t,r="validate"){if(fi(e)||Array.isArray(e)&&e.every(fi)||Bo(e)&&!e)return{type:r,message:fi(e)?e:"",ref:t}}var Yi=e=>Do(e)&&!$i(e)?e:{value:e,message:""},Xi=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:c,maxLength:l,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,y=Wo(r,h);if(!b||t.has(h))return{};const v=s?s[0]:i,w=e=>{a&&v.reportValidity&&(v.setCustomValidity(Bo(e)?"":e||""),v.reportValidity())},x={},S=_i(i),k=Ro(i),N=S||k,E=(g||Ei(i))&&jo(i.value)&&jo(y)||Ci(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,C=wi.bind(null,h,n,x),A=(e,t,r,n=ni,a=ai)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:c&&(!N&&(E||Oo(y))||Bo(y)&&!y||k&&!Fi(s).isValid||S&&!Li(s).isValid)){const{value:e,message:t}=fi(c)?{value:!!c,message:c}:Yi(c);if(e&&(x[h]={type:ii,message:t,ref:v,...C(ii,t)},!n))return w(t),x}if(!(E||Oo(u)&&Oo(f))){let e,t;const r=Yi(f),a=Yi(u);if(Oo(y)||isNaN(y)){const n=i.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,c="week"==i.type;fi(r.value)&&y&&(e=s?o(y)>o(r.value):c?y>r.value:n>new Date(r.value)),fi(a.value)&&y&&(t=s?o(y)<o(a.value):c?y<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(y?+y:y);Oo(r.value)||(e=n>r.value),Oo(a.value)||(t=n<a.value)}if((e||t)&&(A(!!e,r.message,a.message,ti,ri),!n))return w(x[h].message),x}if((l||d)&&!E&&(fi(y)||o&&Array.isArray(y))){const e=Yi(l),t=Yi(d),r=!Oo(e.value)&&y.length>+e.value,a=!Oo(t.value)&&y.length<+t.value;if((r||a)&&(A(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!E&&fi(y)){const{value:e,message:t}=Yi(p);if($i(e)&&!y.match(e)&&(x[h]={type:oi,message:t,ref:i,...C(oi,t)},!n))return w(t),x}if(m)if(Go(m)){const e=Ji(await m(y,r),v);if(e&&(x[h]={...e,...C(si,e.message)},!n))return w(e.message),x}else if(Do(m)){let e={};for(const t in m){if(!Ni(e)&&!n)break;const a=Ji(await m[t](y,r),v,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!Ni(e)&&(x[h]={ref:v,...e},!n))return x}return w(!0),x};const Qi={mode:Xo,reValidateMode:Yo,shouldFocusError:!0};function es(e={}){let t,r={...Qi,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Go(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Do(r.defaultValues)||Do(r.values))&&Mo(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Mo(o),s={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:Si(),state:Si()},m=r.criteriaMode===ei,h=async e=>{if(!s.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=Ni((await w()).errors),g()):e=await x(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?Ko(n.validatingFields,e,t):Ri(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Ni(n.validatingFields)}))},b=(e,t,r,n)=>{const c=Wo(a,e);if(c){const a=Wo(i,e,jo(r)?Wo(o,e):r);jo(a)||n&&n.defaultChecked||t?Ko(i,e,t?a:ji(c._f)):N(e,a),s.mount&&!s.action&&h()}},y=(e,t,a,i,s)=>{let c=!1,l=!1;const d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=d.isDirty=S(),c=l!==d.isDirty);const r=hi(Wo(o,e),t);l=!!Wo(n.dirtyFields,e),r?Ri(n.dirtyFields,e):Ko(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,c=c||(u.dirtyFields||f.dirtyFields)&&l!==!r}if(a){const t=Wo(n.touchedFields,e);t||(Ko(n.touchedFields,e,a),d.touchedFields=n.touchedFields,c=c||(u.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(d)}return c?d:{}},v=(e,a,o,i)=>{const s=Wo(n.errors,e),c=(u.isValid||f.isValid)&&Bo(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{Ko(n.errors,e,t),p.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(l),l=setTimeout(d,e)},t(r.delayError)):(clearTimeout(l),t=null,o?Ko(n.errors,e,o):Ri(n.errors,e)),(o?!hi(s,o):s)||!Ni(i)||c){const t={...i,...c&&Bo(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Wo(t,r);e&&Ko(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||c.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(t,a,o={valid:!0})=>{for(const s in t){const l=t[s];if(l){const{_f:t,...s}=l;if(t){const s=c.array.has(t.name),d=l._f&&Gi(l._f);d&&u.validatingFields&&g([t.name],!0);const f=await Xi(l,c.disabled,i,m,r.shouldUseNativeValidation&&!a,s);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Wo(f,t.name)?s?qi(n.errors,f,t.name):Ko(n.errors,t.name,f[t.name]):Ri(n.errors,t.name))}!Ni(s)&&await x(s,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&Ko(i,e,t),!hi(R(),o)),k=(e,t,r)=>pi(e,c,{...s.mount?i:jo(t)?o:fi(e)?{[e]:t}:t},r,t),N=(e,t,r={})=>{const n=Wo(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Ko(i,e,zi(t,r)),o=Ci(r.ref)&&Oo(t)?"":t,Ai(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?Ro(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):Ei(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:Mo(i)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&T(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Wo(a,i);(c.array.has(e)||Do(o)||s&&!s._f)&&!Po(o)?E(i,o,r):N(i,o,r)}},C=(e,t,r={})=>{const l=Wo(a,e),d=c.array.has(e),m=Mo(t);Ko(i,e,m),d?(p.array.next({name:e,values:Mo(i)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:Ii(o,i),isDirty:S(e,m)})):!l||l._f||Oo(m)?N(e,m,r):E(e,m,r),Ki(e,c)?p.state.next({...n,name:e,values:Mo(i)}):p.state.next({name:s.mount?e:void 0,values:Mo(i)})},A=async e=>{s.mount=!0;const o=e.target;let l=o.name,d=!0;const b=Wo(a,l),S=e=>{d=Number.isNaN(e)||Po(e)&&isNaN(e.getTime())||hi(e,Wo(i,l,e))},k=Wi(r.mode),N=Wi(r.reValidateMode);if(b){let s,E;const C=o.type?ji(b._f):Uo(e),A=e.type===Ho||e.type===Zo,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!Wo(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))(A,Wo(n.touchedFields,l),n.isSubmitted,N,k),R=Ki(l,c,A);Ko(i,l,C),A?o&&o.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const P=y(l,C,A),O=!Ni(P)||R;if(!A&&p.state.next({name:l,type:e.type,values:Mo(i)}),_)return(u.isValid||f.isValid)&&("onBlur"===r.mode?A&&h():A||h()),O&&p.state.next({name:l,...R?{}:P});if(!A&&R&&p.state.next({...n}),r.resolver){const{errors:e}=await w([l]);if(g([l]),S(C),d){const t=Zi(n.errors,a,l),r=Zi(e,a,t.name||l);s=r.error,l=r.name,E=Ni(e)}}else g([l],!0),s=(await Xi(b,c.disabled,i,m,r.shouldUseNativeValidation))[l],g([l]),S(C),d&&(s?E=!1:(u.isValid||f.isValid)&&(E=await x(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&T(b._f.deps),v(l,E,s,P))}},_=(e,t)=>{if(Wo(n.errors,t)&&e.focus)return e.focus(),1},T=async(e,t={})=>{let o,i;const s=xi(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=Wo(t,r);e?Ko(n.errors,r,e):Ri(n.errors,r)}else n.errors=t;return t})(jo(e)?e:s);o=Ni(t),i=e?!s.some(e=>Wo(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Wo(a,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&h()):i=o=await x(a);return p.state.next({...!fi(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&Hi(a,_,e?s:c.mount),i},R=(e,t)=>{let r={...s.mount?i:o};return t&&(r=ki(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),jo(e)?r:fi(e)?Wo(r,e):e.map(e=>Wo(r,e))},P=(e,t)=>({invalid:!!Wo((t||n).errors,e),isDirty:!!Wo((t||n).dirtyFields,e),error:Wo((t||n).errors,e),isValidating:!!Wo(n.validatingFields,e),isTouched:!!Wo((t||n).touchedFields,e)}),O=(e,t,r)=>{const o=(Wo(a,e,{_f:{}})._f||{}).ref,i=Wo(n.errors,e)||{},{ref:s,message:c,type:l,...d}=i;Ko(n.errors,e,{...d,...t,ref:o}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},I=e=>p.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!xi(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return Ni(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||ei))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?xi(e):c.mount)c.mount.delete(s),c.array.delete(s),t.keepValue||(Ri(a,s),Ri(i,s)),!t.keepError&&Ri(n.errors,s),!t.keepDirty&&Ri(n.dirtyFields,s),!t.keepTouched&&Ri(n.touchedFields,s),!t.keepIsValidating&&Ri(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Ri(o,s);p.state.next({values:Mo(i)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},U=({disabled:e,name:t})=>{if(Bo(e)&&s.mount||e||c.disabled.has(t)){const r=c.disabled.has(t)!==!!e;e?c.disabled.add(t):c.disabled.delete(t),r&&s.mount&&!s.action&&h()}},F=(e,t={})=>{let n=Wo(a,e);const i=Bo(t.disabled)||Bo(r.disabled);return Ko(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),c.mount.add(e),n?U({disabled:Bo(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Vi(t.min),max:Vi(t.max),minLength:Vi(t.minLength),maxLength:Vi(t.maxLength),pattern:Vi(t.pattern)}:{},name:e,onChange:A,onBlur:A,ref:i=>{if(i){F(e,t),n=Wo(a,e);const r=jo(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>_i(e)||Ro(e))(r),c=n._f.refs||[];if(s?c.find(e=>e===r):r===n._f.ref)return;Ko(a,e,{_f:{...n._f,...s?{refs:[...c.filter(Ti),r,...Array.isArray(Wo(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=Wo(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!Fo(c.array,e)||!s.action)&&c.unMount.add(e)}}},z=()=>r.shouldFocusError&&Hi(a,_,c.mount),M=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=Mo(i);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,l=Mo(t)}else await x(a);if(c.disabled.size)for(const e of c.disabled)Ri(l,e);if(Ri(n.errors,"root"),Ni(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){s=e}}else t&&await t({...n.errors},o),z(),setTimeout(z);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ni(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},L=(e,t={})=>{const l=e?Mo(e):o,d=Mo(l),f=Ni(e),m=f?o:d;if(t.keepDefaultValues||(o=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...c.mount,...Object.keys(Ii(o,i))]);for(const t of Array.from(e)){const e=Wo(n.dirtyFields,t),r=Wo(i,t),a=Wo(m,t);e&&!jo(r)?Ko(m,t,r):e||jo(a)||C(t,a)}}else{if(zo&&jo(e))for(const e of c.mount){const t=Wo(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Ci(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of c.mount)C(e,Wo(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Mo(o):{}:Mo(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:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Ni(m),s.watch=!!r.shouldUnregister,s.keepIsValid=!!t.keepIsValid,s.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||hi(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Ii(o,i):n.dirtyFields:t.keepDefaultValues&&e?Ii(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Go(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:F,unregister:D,getFieldState:P,handleSubmit:M,setError:O,_subscribe:I,_runSchema:w,_updateIsValidating:g,_focusError:z,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],c,l,d=!0,m=!0)=>{if(l&&c&&!r.disabled){if(s.action=!0,m&&Array.isArray(Wo(a,e))){const t=c(Wo(a,e),l.argA,l.argB);d&&Ko(a,e,t)}if(m&&Array.isArray(Wo(n.errors,e))){const t=c(Wo(n.errors,e),l.argA,l.argB);d&&Ko(n.errors,e,t),((e,t)=>{!$o(Wo(e,t)).length&&Ri(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Wo(n.touchedFields,e))){const t=c(Wo(n.touchedFields,e),l.argA,l.argB);d&&Ko(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=Ii(o,i)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ko(i,e,t)},_setDisabledField:U,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>$o(Wo(s.mount?i:o,e,r.shouldUnregister?Wo(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Go(r.defaultValues)&&r.defaultValues().then(e=>{j(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of c.unMount){const t=Wo(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Ti(e)):!Ti(t._f.ref))&&D(e)}c.unMount=new Set},_disableForm:e=>{Bo(e)&&(p.state.next({disabled:e}),Hi(a,(t,r)=>{const n=Wo(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 i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},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=>(s.mount=!0,f={...f,...e.formState},I({...e,formState:{...d,...e.formState}})),trigger:T,register:F,handleSubmit:M,watch:(e,t)=>Go(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:C,getValues:R,reset:j,resetField:(e,t={})=>{Wo(a,e)&&(jo(t.defaultValue)?C(e,Mo(Wo(o,e))):(C(e,t.defaultValue),Ko(o,e,Mo(t.defaultValue))),t.keepTouched||Ri(n.touchedFields,e),t.keepDirty||(Ri(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Mo(Wo(o,e))):S()),t.keepError||(Ri(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&xi(e).forEach(e=>Ri(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:O,setFocus:(e,t={})=>{const r=Wo(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Go(e.select)&&e.select()})}},getFieldState:P};return{...V,formControl:V}}function ts(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:Go(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:Go(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Go(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=es(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,ui(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{var t;e.values&&!hi(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),(null===(t=i._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||i._setValid(),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=a.useMemo(()=>di(n,i),[i,n]),t.current}const rs=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Wo(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ns=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?rs(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>rs(t,r,e))}},as=(e,t)=>{t.shouldUseNativeValidation&&ns(e,t);const r={};for(const n in e){const a=Wo(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(os(t.names||Object.keys(e),n)){const e=Object.assign({},Wo(r,n));Ko(e,"root",o),Ko(r,n,e)}else Ko(r,n,o)}return r},os=(e,t)=>{const r=is(t);return e.some(e=>is(e).match(`^${r}\\.\\d+`))};function is(e){return e.replace(/\]|\[/g,"")}function ss(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:i,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=i.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class cs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ls extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const ds={};function us(e){return ds}function fs(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 ps(e,t){return"bigint"==typeof t?t.toString():t}function ms(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hs(e){return null==e}function gs(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const bs=Symbol("evaluating");function ys(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==bs)return void 0===n&&(n=bs,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function vs(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ws(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function xs(e){return JSON.stringify(e)}const Ss="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ks(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Ns=ms(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Es(e){if(!1===ks(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!==ks(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Cs(e){return Es(e)?{...e}:Array.isArray(e)?[...e]:e}const As=new Set(["string","number","symbol"]);function _s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ts(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Rs(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 Ps(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 Os(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Is(e){return"string"==typeof e?e:e?.message}function Ds(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=Is(e.inst?._zod.def?.error?.(e))??Is(t?.error?.(e))??Is(r.customError?.(e))??Is(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Us(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Fs(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const zs=(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,ps,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ms=ss("$ZodError",zs),Ls=ss("$ZodError",zs,{Parent:Error});const js=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new cs;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ds(e,o,us())));throw Ss(t,a?.callee),t}return i.value},$s=js(Ls),Vs=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ds(e,o,us())));throw Ss(t,a?.callee),t}return i.value},Ws=Vs(Ls),Bs=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new cs;return o.issues.length?{success:!1,error:new(e??Ms)(o.issues.map(e=>Ds(e,a,us())))}:{success:!0,data:o.value}},Gs=Bs(Ls),Ks=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Ds(e,a,us())))}:{success:!0,data:o.value}},Hs=Ks(Ls),Zs=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return js(e)(t,r,a)},qs=e=>(t,r,n)=>js(e)(t,r,n),Js=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vs(e)(t,r,a)},Ys=e=>async(t,r,n)=>Vs(e)(t,r,n),Xs=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,r,a)},Qs=e=>(t,r,n)=>Bs(e)(t,r,n),ec=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ks(e)(t,r,a)},tc=e=>async(t,r,n)=>Ks(e)(t,r,n),rc=/^[cC][^\s-]{8,}$/,nc=/^[0-9a-z]+$/,ac=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,sc=/^[a-zA-Z0-9_-]{21}$/,cc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,lc=/^([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})$/,dc=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)$/,uc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const fc=/^(?:(?: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])$/,pc=/^(([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}|:))$/,mc=/^((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])$/,hc=/^(([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])$/,gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bc=/^[A-Za-z0-9_-]*$/,yc=/^\+[1-9]\d{6,14}$/,vc="(?:(?:\\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])))",wc=new RegExp(`^${vc}$`);function xc(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 Sc=/^[^A-Z]*$/,kc=/^[^a-z]*$/,Nc=ss("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ec=ss("$ZodCheckMaxLength",(e,t)=>{var r;Nc.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!hs(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=Us(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cc=ss("$ZodCheckMinLength",(e,t)=>{var r;Nc.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!hs(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=Us(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ac=ss("$ZodCheckLengthEquals",(e,t)=>{var r;Nc.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!hs(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 o=Us(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),_c=ss("$ZodCheckStringFormat",(e,t)=>{var r,n;Nc.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=()=>{})}),Tc=ss("$ZodCheckRegex",(e,t)=>{_c.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})}}),Rc=ss("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sc),_c.init(e,t)}),Pc=ss("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kc),_c.init(e,t)}),Oc=ss("$ZodCheckIncludes",(e,t)=>{Nc.init(e,t);const r=_s(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})}}),Ic=ss("$ZodCheckStartsWith",(e,t)=>{Nc.init(e,t);const r=new RegExp(`^${_s(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})}}),Dc=ss("$ZodCheckEndsWith",(e,t)=>{Nc.init(e,t);const r=new RegExp(`.*${_s(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})}}),Uc=ss("$ZodCheckOverwrite",(e,t)=>{Nc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Fc{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 zc={major:4,minor:3,patch:6},Mc=ss("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zc;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=Ps(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new cs;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Ps(e,t)))});else{if(e.issues.length===t)continue;a||(a=Ps(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Ps(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new cs;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new cs;return i.then(e=>t(e,n,o))}return t(i,n,o)}}ys(e,"~standard",()=>({validate:t=>{try{const r=Gs(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Hs(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Lc=ss("$ZodString",(e,t)=>{var r;Mc.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}}),jc=ss("$ZodStringFormat",(e,t)=>{_c.init(e,t),Lc.init(e,t)}),$c=ss("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lc),jc.init(e,t)}),Vc=ss("$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=dc(e))}else t.pattern??(t.pattern=dc());jc.init(e,t)}),Wc=ss("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uc),jc.init(e,t)}),Bc=ss("$ZodURL",(e,t)=>{jc.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=ss("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jc.init(e,t)}),Kc=ss("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sc),jc.init(e,t)}),Hc=ss("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rc),jc.init(e,t)}),Zc=ss("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nc),jc.init(e,t)}),qc=ss("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ac),jc.init(e,t)}),Jc=ss("$ZodXID",(e,t)=>{t.pattern??(t.pattern=oc),jc.init(e,t)}),Yc=ss("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),jc.init(e,t)}),Xc=ss("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=xc({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(`^${vc}T(?:${n})$`)}(t)),jc.init(e,t)}),Qc=ss("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=wc),jc.init(e,t)}),el=ss("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${xc(t)}$`)),jc.init(e,t)}),tl=ss("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cc),jc.init(e,t)}),rl=ss("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fc),jc.init(e,t),e._zod.bag.format="ipv4"}),nl=ss("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pc),jc.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})}}}),al=ss("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mc),jc.init(e,t)}),ol=ss("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hc),jc.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 il(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const sl=ss("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gc),jc.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{il(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const cl=ss("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=bc),jc.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!bc.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return il(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})}}),ll=ss("$ZodE164",(e,t)=>{t.pattern??(t.pattern=yc),jc.init(e,t)});const dl=ss("$ZodJWT",(e,t)=>{jc.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})}}),ul=ss("$ZodUnknown",(e,t)=>{Mc.init(e,t),e._zod.parse=e=>e}),fl=ss("$ZodNever",(e,t)=>{Mc.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function pl(e,t,r){e.issues.length&&t.issues.push(...Os(r,e.issues)),t.value[r]=e.value}const ml=ss("$ZodArray",(e,t)=>{Mc.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 o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>pl(t,r,e))):pl(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function hl(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Os(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function gl(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 bl(e,t,r,n,a,o){const i=[],s=a.keySet,c=a.catchall._zod,l=c.def.type,d="optional"===c.optout;for(const a in t){if(s.has(a))continue;if("never"===l){i.push(a);continue}const o=c.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>hl(e,r,a,t,d))):hl(o,r,a,t,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const yl=ss("$ZodObject",(e,t)=>{Mc.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=ms(()=>gl(t));ys(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=ks,o=t.catchall;let i;e._zod.parse=(t,r)=>{i??(i=n.value);const s=t.value;if(!a(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],l=i.shape;for(const e of i.keys){const n=l[e],a="optional"===n._zod.optout,o=n._zod.run({value:s[e],issues:[]},r);o instanceof Promise?c.push(o.then(r=>hl(r,t,e,s,a))):hl(o,t,e,s,a)}return o?bl(c,s,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),vl=ss("$ZodObjectJIT",(e,t)=>{yl.init(e,t);const r=e._zod.parse,n=ms(()=>gl(t));let a;const o=ks,i=!ds.jitless,s=i&&Ns.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new Fc(["shape","payload","ctx"]),r=n.value,a=e=>{const t=xs(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],i=xs(n),s=e[n],c="optional"===s?._zod?.optout;t.write(`const ${r} = ${a(n)};`),c?t.write(`\n if (${r}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${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 ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),c?bl([],f,d,u,l,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function wl(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=>!Ps(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=>Ds(e,n,us())))}),t)}const xl=ss("$ZodUnion",(e,t)=>{Mc.init(e,t),ys(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ys(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ys(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ys(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=>gs(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>wl(t,a,e,o)):wl(s,a,e,o)}}),Sl=ss("$ZodIntersection",(e,t)=>{Mc.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>Nl(e,t,r)):Nl(e,a,o)}});function kl(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(Es(e)&&Es(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=kl(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=kl(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 Nl(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 o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),Ps(e))return e;const i=kl(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const El=ss("$ZodEnum",(e,t)=>{Mc.init(e,t);const r=fs(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>As.has(typeof e)).map(e=>"string"==typeof e?_s(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Cl=ss("$ZodTransform",(e,t)=>{Mc.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ls(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 cs;return r.value=a,r}});function Al(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const _l=ss("$ZodOptional",(e,t)=>{Mc.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ys(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ys(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${gs(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=>Al(t,e.value)):Al(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Tl=ss("$ZodExactOptional",(e,t)=>{_l.init(e,t),ys(e._zod,"values",()=>t.innerType._zod.values),ys(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Rl=ss("$ZodNullable",(e,t)=>{Mc.init(e,t),ys(e._zod,"optin",()=>t.innerType._zod.optin),ys(e._zod,"optout",()=>t.innerType._zod.optout),ys(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${gs(e.source)}|null)$`):void 0}),ys(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)}),Pl=ss("$ZodDefault",(e,t)=>{Mc.init(e,t),e._zod.optin="optional",ys(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=>Ol(e,t)):Ol(n,t)}});function Ol(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Il=ss("$ZodPrefault",(e,t)=>{Mc.init(e,t),e._zod.optin="optional",ys(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))}),Dl=ss("$ZodNonOptional",(e,t)=>{Mc.init(e,t),ys(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=>Ul(t,e)):Ul(a,e)}});function Ul(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 Fl=ss("$ZodCatch",(e,t)=>{Mc.init(e,t),ys(e._zod,"optin",()=>t.innerType._zod.optin),ys(e._zod,"optout",()=>t.innerType._zod.optout),ys(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=>Ds(e,r,us()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ds(e,r,us()))},input:e.value}),e.issues=[]),e)}}),zl=ss("$ZodPipe",(e,t)=>{Mc.init(e,t),ys(e._zod,"values",()=>t.in._zod.values),ys(e._zod,"optin",()=>t.in._zod.optin),ys(e._zod,"optout",()=>t.out._zod.optout),ys(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=>Ml(e,t.in,r)):Ml(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Ml(e,t.out,r)):Ml(n,t.out,r)}});function Ml(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ll=ss("$ZodReadonly",(e,t)=>{Mc.init(e,t),ys(e._zod,"propValues",()=>t.innerType._zod.propValues),ys(e._zod,"values",()=>t.innerType._zod.values),ys(e._zod,"optin",()=>t.innerType?._zod?.optin),ys(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(jl):jl(n)}});function jl(e){return e.value=Object.freeze(e.value),e}const $l=ss("$ZodCustom",(e,t)=>{Nc.init(e,t),Mc.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=>Vl(t,r,n,e));Vl(a,r,n,e)}});function Vl(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(Fs(e))}}var Wl;class Bl{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)}}(Wl=globalThis).__zod_globalRegistry??(Wl.__zod_globalRegistry=new Bl);const Gl=globalThis.__zod_globalRegistry;function Kl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Rs(t)})}function Hl(e,t){return new Ec({check:"max_length",...Rs(t),maximum:e})}function Zl(e,t){return new Cc({check:"min_length",...Rs(t),minimum:e})}function ql(e,t){return new Ac({check:"length_equals",...Rs(t),length:e})}function Jl(e){return new Uc({check:"overwrite",tx:e})}function Yl(e){const t=function(e,t){const r=new Nc({check:"custom",...Rs(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Fs(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(Fs(n))}},e(r.value,r)));return t}function Xl(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 Ql(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,o=t.seen.get(e);if(o){o.count++;return r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,n);else{const r=i.schema,o=t.processors[a.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),Ql(o,t,n),t.seen.get(o).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(i.schema,c),"input"===t.io&&rd(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function ed(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:o}=(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 o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:a+o}})(t);n.def={...n.schema},o&&(n.defId=o);const i=n.schema;for(const e in i)delete i[e];i.$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 o=e.metadataRegistry.get(r[0])?.id;o?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function td(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,o={...a},i=r.ref;if(r.ref=null,i){n(i);const r=e.seen.get(i),s=r.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,s):(a.allOf=a.allOf??[],a.allOf.push(s)),Object.assign(a,o);if(t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(s.$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 s=t._zod.parent;if(s&&s!==i){n(s);const t=e.seen.get(s);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 o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?a.$defs=o:a.definitions=o);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:nd(t,"input",e.processors),output:nd(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function rd(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 rd(n.element,r);if("set"===n.type)return rd(n.valueType,r);if("lazy"===n.type)return rd(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 rd(n.innerType,r);if("intersection"===n.type)return rd(n.left,r)||rd(n.right,r);if("record"===n.type||"map"===n.type)return rd(n.keyType,r)||rd(n.valueType,r);if("pipe"===n.type)return rd(n.in,r)||rd(n.out,r);if("object"===n.type){for(const e in n.shape)if(rd(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(rd(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(rd(e,r))return!0;return!(!n.rest||!rd(n.rest,r))}return!1}const nd=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},i=Xl({...a??{},target:o,io:t,processors:r});return Ql(e,i),ed(i,e),td(i,e)},ad={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},od=(e,t,r,n)=>{const a=e._zod.def;Ql(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function id(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function sd(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,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[i].types,l=c&&c[n.code];r[i]=wi(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function cd(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,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[i].types,l=c&&c[n.code];r[i]=wi(i,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r}function ld(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,o){try{return Promise.resolve(id(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&ns({},o),{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:as(sd(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(id(function(){return Promise.resolve(("sync"===r.mode?$s:Ws)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&ns({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ms}(e))return{values:{},errors:as(cd(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function dd(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ud(...e){return t=>{let r=!1;const n=e.map(e=>{const n=dd(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():dd(e[t],null)}}}}function fd(...e){return n.useCallback(ud(...e),e)}var pd=Symbol.for("react.lazy"),md=n[" use ".trim().toString()];function hd(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===pd&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function gd(e){const r=yd(e),a=n.forwardRef((e,a)=>{let{children:o,...i}=e;hd(o)&&"function"==typeof md&&(o=md(o._payload));const s=n.Children.toArray(o),c=s.find(wd);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var bd=gd("Slot");function yd(e){const t=n.forwardRef((e,t)=>{let{children:r,...a}=e;if(hd(r)&&"function"==typeof md&&(r=md(r._payload)),n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vd=Symbol("radix.slottable");function wd(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===vd}const xd=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Sd=N,kd=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Sd(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=xd(t)||xd(n);return a[e][i]}),s=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({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return Sd(e,i,c,null==r?void 0:r.class,null==r?void 0:r.className)},Nd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ed=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)},Cd=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),Ad=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import a,{Component as o,useRef as i,useMemo as s,createContext as l,useReducer as c,useEffect as d,useCallback as u,useState as f,useContext as p,Suspense as m,lazy as h,forwardRef as g,createElement as b,useLayoutEffect as y}from"react";import*as v from"react-dom";import w from"react-dom";var x;function S(e){return Boolean(e?.serverUrl&&e?.version&&e?.orgId)}function k(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=k(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function N(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=k(e))&&(n&&(n+=" "),n+=t);return n}!function(e){e.V1="v1"}(x||(x={}));const E=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),C="-",A=[],_=e=>{const t=P(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return R(e);const r=e.split(C),n=""===r[0]&&r.length>1?1:0;return T(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||A}return r[e]||A}}},T=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=T(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(C):e.slice(t).join(C),s=o.length;for(let e=0;e<s;e++){const t=o[e];if(t.validator(i))return t.classGroupId}},R=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})(),P=e=>{const{theme:t,classGroups:r}=e;return O(r,t)},O=(e,t)=>{const r=E();for(const n in e){const a=e[n];I(a,r,n,t)}return r},I=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];D(a,t,r,n)}},D=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?F(e,t,r,n):M(e,t,r,n):U(e,t,r)},U=(e,t,r)=>{(""===e?t:z(t,e)).classGroupId=r},M=(e,t,r,n)=>{L(e)?I(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},F=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,i]=a[e];I(i,z(t,o),r,n)}},z=(e,t)=>{let r=e;const n=t.split(C),a=n.length;for(let e=0;e<a;e++){const t=n[e];let a=r.nextPart.get(t);a||(a=E(),r.nextPart.set(t,a)),r=a}return r},L=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,o)=>{r[a]=o,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)}}},$=[],V=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),W=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let s=0;s<i;s++){const i=e[s];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,s)),o=s+1;continue}if("/"===i){r=s;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let l=s,c=!1;s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0);return V(t,c,l,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):V($,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},B=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 o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},G=/\s+/,K=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=K(e[n]))&&(r&&(r+=" "),r+=t);return r},H=(e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(G);let l="";for(let e=s.length-1;e>=0;e-=1){const t=s[e],{isExternal:c,modifiers:d,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:p}=r(t);if(c){l=t+(l.length>0?" "+l:l);continue}let m=!!p,h=n(m?f.substring(0,p):f);if(!h){if(!m){l=t+(l.length>0?" "+l:l);continue}if(h=n(f),!h){l=t+(l.length>0?" "+l:l);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:o(d).join(":"),b=u?g+"!":g,y=b+h;if(i.indexOf(y)>-1)continue;i.push(y);const v=a(h,m);for(let e=0;e<v.length;++e){const t=v[e];i.push(b+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return a(e,o),o};return o=s=>{const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:j(e.cacheSize),parseClassName:W(e),sortModifiers:B(e),..._(e)}))(l),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=K(t))&&(a&&(a+=" "),a+=r);return a})(...e))},Z=[],q=e=>{const t=t=>t[e]||Z;return t.isThemeGetter=!0,t},J=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Y=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X=/^\d+\/\d+$/,Q=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ee=/\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$/,te=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,re=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ae=e=>X.test(e),oe=e=>!!e&&!Number.isNaN(Number(e)),ie=e=>!!e&&Number.isInteger(Number(e)),se=e=>e.endsWith("%")&&oe(e.slice(0,-1)),le=e=>Q.test(e),ce=()=>!0,de=e=>ee.test(e)&&!te.test(e),ue=()=>!1,fe=e=>re.test(e),pe=e=>ne.test(e),me=e=>!ge(e)&&!Se(e),he=e=>Te(e,Ie,ue),ge=e=>J.test(e),be=e=>Te(e,De,de),ye=e=>Te(e,Ue,oe),ve=e=>Te(e,Pe,ue),we=e=>Te(e,Oe,pe),xe=e=>Te(e,Fe,fe),Se=e=>Y.test(e),ke=e=>Re(e,De),Ne=e=>Re(e,Me),Ee=e=>Re(e,Pe),Ce=e=>Re(e,Ie),Ae=e=>Re(e,Oe),_e=e=>Re(e,Fe,!0),Te=(e,t,r)=>{const n=J.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Re=(e,t,r=!1)=>{const n=Y.exec(e);return!!n&&(n[1]?t(n[1]):r)},Pe=e=>"position"===e||"percentage"===e,Oe=e=>"image"===e||"url"===e,Ie=e=>"length"===e||"size"===e||"bg-size"===e,De=e=>"length"===e,Ue=e=>"number"===e,Me=e=>"family-name"===e,Fe=e=>"shadow"===e,ze=H(()=>{const e=q("color"),t=q("font"),r=q("text"),n=q("font-weight"),a=q("tracking"),o=q("leading"),i=q("breakpoint"),s=q("container"),l=q("spacing"),c=q("radius"),d=q("shadow"),u=q("inset-shadow"),f=q("text-shadow"),p=q("drop-shadow"),m=q("blur"),h=q("perspective"),g=q("aspect"),b=q("ease"),y=q("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Se,ge],w=()=>[Se,ge,l],x=()=>[ae,"full","auto",...w()],S=()=>[ie,"none","subgrid",Se,ge],k=()=>["auto",{span:["full",ie,Se,ge]},ie,Se,ge],N=()=>[ie,"auto",Se,ge],E=()=>["auto","min","max","fr",Se,ge],C=()=>["auto",...w()],A=()=>[ae,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],_=()=>[e,Se,ge],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ee,ve,{position:[Se,ge]}],R=()=>["auto","cover","contain",Ce,he,{size:[Se,ge]}],P=()=>[se,ke,be],O=()=>["","none","full",c,Se,ge],I=()=>["",oe,ke,be],D=()=>[oe,se,Ee,ve],U=()=>["","none",m,Se,ge],M=()=>["none",oe,Se,ge],F=()=>["none",oe,Se,ge],z=()=>[oe,Se,ge],L=()=>[ae,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[le],breakpoint:[le],color:[ce],container:[le],"drop-shadow":[le],ease:["in","out","in-out"],font:[me],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[le],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[le],shadow:[le],spacing:["px",oe],text:[le],"text-shadow":[le],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ae,ge,Se,g]}],container:["container"],columns:[{columns:[oe,ge,Se,s]}],"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:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[ie,"auto",Se,ge]}],basis:[{basis:[ae,"full","auto",s,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[oe,ae,"auto","initial","none",ge]}],grow:[{grow:["",oe,Se,ge]}],shrink:[{shrink:["",oe,Se,ge]}],order:[{order:[ie,"first","last","none",Se,ge]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:k()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:k()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":E()}],"auto-rows":[{"auto-rows":E()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"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:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],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":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:A()}],w:[{w:[s,"screen",...A()]}],"min-w":[{"min-w":[s,"screen","none",...A()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...A()]}],h:[{h:["screen","lh",...A()]}],"min-h":[{"min-h":["screen","lh","none",...A()]}],"max-h":[{"max-h":["screen","lh",...A()]}],"font-size":[{text:["base",r,ke,be]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Se,ye]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",se,ge]}],"font-family":[{font:[Ne,ge,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,ge]}],"line-clamp":[{"line-clamp":[oe,"none",Se,ye]}],leading:[{leading:[o,...w()]}],"list-image":[{"list-image":["none",Se,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[oe,"from-font","auto",Se,be]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[oe,"auto",Se,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,ge]}],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,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ie,Se,ge],radial:["",Se,ge],conic:[ie,Se,ge]},Ae,we]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],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:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[oe,Se,ge]}],"outline-w":[{outline:["",oe,ke,be]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",d,_e,xe]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",u,_e,xe]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[oe,be]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",f,_e,xe]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[oe,Se,ge]}],"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":[oe]}],"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":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"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":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"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":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"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":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"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":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"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":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"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":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[Se,ge]}],"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":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":[oe]}],"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":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,ge]}],filter:[{filter:["","none",Se,ge]}],blur:[{blur:U()}],brightness:[{brightness:[oe,Se,ge]}],contrast:[{contrast:[oe,Se,ge]}],"drop-shadow":[{"drop-shadow":["","none",p,_e,xe]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",oe,Se,ge]}],"hue-rotate":[{"hue-rotate":[oe,Se,ge]}],invert:[{invert:["",oe,Se,ge]}],saturate:[{saturate:[oe,Se,ge]}],sepia:[{sepia:["",oe,Se,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,ge]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[oe,Se,ge]}],"backdrop-contrast":[{"backdrop-contrast":[oe,Se,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",oe,Se,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[oe,Se,ge]}],"backdrop-invert":[{"backdrop-invert":["",oe,Se,ge]}],"backdrop-opacity":[{"backdrop-opacity":[oe,Se,ge]}],"backdrop-saturate":[{"backdrop-saturate":[oe,Se,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",oe,Se,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[oe,"initial",Se,ge]}],ease:[{ease:["linear","initial",b,Se,ge]}],delay:[{delay:[oe,Se,ge]}],animate:[{animate:["none",y,Se,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,Se,ge]}],"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,ge,"","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:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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,ge]}],"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":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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,ge]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[oe,ke,be,ye]}],stroke:[{stroke:["none",..._()]}],"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 Le(){try{const e="undefined"!=typeof globalThis?globalThis:null;return"development"===e?.process?.env?.NODE_ENV}catch{return!1}}function je(...e){return ze(N(e))}let $e=!0;function Ve(e,...t){console.error(e,...t)}function We(e){if(null==e)return e;if("object"!=typeof e)return e;const t=new Set(["authorization","token","password","accesstoken","refreshtoken","secret","apikey","api_key","session","sessionid","x-session-id"]);if(Array.isArray(e))return e.map(We);const r={};for(const[n,a]of Object.entries(e))r[n]=t.has(n.toLowerCase())?"[redacted]":We(a);return r}function Be(e){return e instanceof Error&&("AbortError"===e.name||"ERR_CANCELED"===e.code)}async function Ge(e,t){try{const r=await fetch(e,t);if(Le()){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 o=r.clone();let i;try{const e=await o.text();if(e)try{i=JSON.parse(e)}catch{i=e.substring(0,200)+(e.length>200?"...":"")}}catch{i="(read failed)"}!function(e,...t){$e&&Le()&&console.log(e,...t)}("[SDK API]",n,e,{request:We(a),response:We(i),status:r.status})}return r}catch(e){if(Be(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 Ke(e,t){try{const r=await e.json();return r?.message||r?.error||t}catch{return t}}async function He(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 Ze(e,t="Request failed"){if(!e.ok){let r=t;try{const t=await He(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 He(e)}catch(e){if(e instanceof Error&&e.message.includes("Invalid JSON"))throw e;throw new Error("Failed to parse response as JSON")}}class qe 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,qe)}}const Je=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&&($e=e.enableLogging)}({enableLogging:e.enableConsoleLogging})}handleError(e,t={}){if(Be(e))return;const r=e instanceof Error?e:new qe("string"==typeof e?e:"An unknown error occurred","UNKNOWN_ERROR",t),n=r instanceof qe?r:new qe(r.message,"SDK_ERROR",t,r);if(this.config.enableConsoleLogging&&function(e,...t){$e&&Le()&&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){Ve("[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 Ye(e,t={}){Je.handleError(e,t)}function Xe(e,t={}){return!Be(e)&&(Je.handleError(e,t),!0)}class Qe extends o{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(Ye(e,{component:"ErrorBoundary",action:"componentDidCatch",metadata:{componentStack:t.componentStack,errorBoundary:this.constructor.name}}),this.props.onError)try{this.props.onError(e,t)}catch(e){Ve("[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("div",{style:{padding:"1rem",border:"1px solid #ef4444",borderRadius:"0.5rem",backgroundColor:"#fef2f2",color:"#991b1b"},children:[t("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem",fontWeight:600},children:"Something went wrong"}),t("p",{style:{margin:"0 0 1rem 0",fontSize:"0.875rem"},children:this.state.error.message||"An unexpected error occurred"}),t("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 et=()=>({type:"AUTHENTICATION_STARTED"}),tt=()=>({type:"AUTHENTICATION_PROCESSING"}),rt=()=>({type:"AUTHENTICATION_FAILED"}),nt=e=>({type:"SET_SESSION",payload:e}),at=()=>({type:"REMOVE_SESSION"});function ot(e,t,r){const n=i(t),a=i(r),o=i(void 0),l=i(!1);return n.current=t,a.current=r,s(()=>{const t=n.current(e);if(l.current){if(a.current?a.current(o.current,t):Object.is(o.current,t))return o.current}return o.current=t,l.current=!0,t},[e])}function it({name:e,initialState:r,reducer:n,initializer:o}){const i=l(null),d=l(null),u=l(null),f=a.memo(({children:e})=>{const[a,l]=c(n,r,o||(e=>e)),f=s(()=>({state:a,dispatch:l}),[a,l]);return t(u.Provider,{value:f,children:t(i.Provider,{value:a,children:t(d.Provider,{value:l,children:e})})})});f.displayName=`${e}Provider`;const p=t=>new Error(`use${e}${t} must be used within a ${e}Provider. Make sure SaaSOSProvider is wrapping your application.`),m=()=>{const e=a.useContext(i);if(null===e)throw p("State");return e};return{Provider:f,useContext:()=>{const e=a.useContext(u);if(!e)throw p("Context");return e},useState:m,useDispatch:()=>{const e=a.useContext(d);if(null===e)throw p("Dispatch");return e},useSelector:(e,t)=>{const r=e||(e=>e);return ot(m(),r,t)}}}var st;function lt(e){return{isAuthenticated:e===st.authenticated,isLoading:e===st.loading||e===st.redirecting||e===st.authenticating,isRedirecting:e===st.redirecting}}function ct(e,t,r){return{...e,[t]:r}}function dt(e,t){return{...e,...t}}!function(e){e.loading="loading",e.redirecting="redirecting",e.authenticated="authenticated",e.unauthenticated="unauthenticated",e.authenticating="authenticating"}(st||(st={}));const ut=()=>({session:null,status:st.loading}),{Provider:ft,useState:pt,useDispatch:mt}=it({name:"Auth",initialState:ut(),reducer:(e,t)=>{switch(t.type){case"AUTHENTICATION_STARTED":return ct(e,"status",st.redirecting);case"AUTHENTICATION_PROCESSING":return ct(e,"status",st.authenticating);case"AUTHENTICATION_FAILED":case"REMOVE_SESSION":return dt(e,{session:null,status:st.unauthenticated});case"SET_SESSION":return dt(e,{session:t.payload,status:st.authenticated});default:return e}},initializer:ut}),ht=ft,gt=pt,bt=mt,yt=e=>({type:"SET_SAAS_OS_CONFIG",payload:e}),vt=e=>({type:"SET_SETTINGS",payload:e}),wt=()=>({serverUrl:"",version:x.V1,orgId:"",settings:null}),{Provider:xt,useState:St,useDispatch:kt}=it({name:"OS",initialState:wt(),reducer:(e,t)=>{switch(t.type){case"SET_SAAS_OS_CONFIG":return dt(e,t.payload);case"REMOVE_SAAS_OS_CONFIG":return wt();case"SET_SETTINGS":return ct(e,"settings",t.payload);default:return e}}}),Nt=xt,Et=St,Ct=kt,At=e=>({type:"SET_WORKSPACES",payload:e}),_t=e=>({type:"ADD_WORKSPACE",payload:e}),Tt=e=>({type:"UPDATE_WORKSPACE",payload:e}),Rt=e=>({type:"REMOVE_WORKSPACE",payload:e}),Pt=e=>({type:"SET_ALL_FEATURES",payload:e}),Ot=e=>({type:"SET_CURRENT_WORKSPACE",payload:e}),It=()=>({type:"RESET_CURRENT_WORKSPACE"}),Dt=e=>({type:"SET_IS_INITIALIZED",payload:e}),Ut=e=>({type:"SET_LOADING",payload:e}),Mt=e=>({type:"SET_ERROR",payload:e}),Ft=e=>({type:"SET_REFRESHING",payload:e}),zt=e=>({type:"SET_SWITCHING_TO_ID",payload:e}),{Provider:Lt,useState:jt,useDispatch:$t}=it({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 ct(e,"workspaces",t.payload);case"ADD_WORKSPACE":return ct(e,"workspaces",[...e.workspaces,t.payload]);case"UPDATE_WORKSPACE":return ct(e,"workspaces",e.workspaces.map(e=>e._id===t.payload._id?t.payload:e));case"REMOVE_WORKSPACE":return ct(e,"workspaces",e.workspaces.filter(e=>e._id!==t.payload));case"SET_ALL_FEATURES":return ct(e,"allFeatures",t.payload);case"SET_CURRENT_WORKSPACE":return ct(e,"currentWorkspace",t.payload);case"RESET_CURRENT_WORKSPACE":return ct(e,"currentWorkspace",null);case"SET_IS_INITIALIZED":return ct(e,"isInitialized",t.payload);case"SET_LOADING":return ct(e,"loading",t.payload);case"SET_ERROR":return ct(e,"error",t.payload);case"SET_REFRESHING":return ct(e,"refreshing",t.payload);case"SET_SWITCHING_TO_ID":return ct(e,"switchingToId",t.payload);default:return e}}}),Vt=Lt,Wt=jt,Bt=$t,Gt=a.memo(({children:e})=>t(Nt,{children:t(ht,{children:t(Vt,{children:e})})}));Gt.displayName="SDKContextProvider";const Kt=new Set;function Ht(){Kt.forEach(e=>e())}const Zt=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){Ye(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 qt(e,t,r){d(()=>{const t=new AbortController;return e(t.signal).catch(e=>{Be(e)||(r?.onError?r.onError(e):Ye(e,{component:"useAsyncEffect",action:"effect",metadata:{note:"Unhandled rejection - consider passing onError"}}))}),()=>t.abort()},t)}function Jt(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch(t){return Ye(t,{component:"storage",action:"getStorageItem",metadata:{key:e}}),null}}function Yt(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch(t){Ye(t,{component:"storage",action:"setStorageItem",metadata:{key:e}})}}function Xt(e){if("undefined"!=typeof window)try{localStorage.removeItem(e)}catch(t){Ye(t,{component:"storage",action:"removeStorageItem",metadata:{key:e}})}}const Qt="code",er="saas-session-id",tr="saas-workspace-current";function rr(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 nr(e){Yt(er,e)}function ar(){Xt(er)}function or(){if("undefined"==typeof window)return null;try{return Jt(er)}catch(e){return Ye(e,{component:"auth/utils",action:"getSessionId",metadata:{key:er}}),null}}function ir(){const e=or(),t={};return e&&(t["x-session-id"]=e),t}function sr(){if("undefined"==typeof window)return null;try{return new URLSearchParams(window.location.search).get(Qt)}catch(e){return Ye(e,{component:"auth/utils",action:"getTokenFromUrl",metadata:{param:Qt}}),null}}function lr(e,t){return{user:e,sessionId:t,expires:new Date(Date.now()+864e5).toISOString()}}const cr="SDK is not ready (missing serverUrl, version, or orgId)";class dr{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(cr);if(this.requireOrgId&&!this.orgId?.trim())throw new Error(cr)}get baseUrl(){return this.ensureReady(),`${this.serverUrl}/api/${this.version}/${this.basePath}`}getAuthHeaders(){return ir()}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 Ze(await Ge(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"),Ge(this.url(e),{...t,headers:r})}}class ur extends dr{constructor(e){super({...e,requireOrgId:!0})}async getSettings(e){return this.fetchJson(`${this.orgId}/settings`,{signal:e},"Failed to fetch settings")}}function fr(){return Br(e=>e.os)}function pr(){const e=Gr(),t=fr(),{serverUrl:r,version:n,orgId:a,settings:o}=t,l=i(!1),c=s(()=>S(t)?new ur({serverUrl:r,version:n,orgId:a}):null,[r,n,a]),d=u(async t=>{if(l.current)return o||null;if(o)return o;if(!c)return null;l.current=!0;try{const r=await c.getSettings(t);return e.os(vt(r)),r}catch(e){return Xe(e,{component:"useSaaSSettings",action:"getSettings",metadata:{serverUrl:r,version:n,orgId:a}}),null}finally{l.current=!1}},[c,o,e]);return qt(async e=>{!S(t)||o||l.current||await d(e)},[r,n,a,d],{onError:e=>Xe(e,{component:"useSaaSSettings",action:"fetchSettings",metadata:{serverUrl:r,version:n,orgId:a}})}),s(()=>({settings:o,getSettings:d}),[o,d])}class mr extends dr{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||r}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||r}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||n}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||r}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||r}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}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 o=await a.json();if(void 0!==o.success){if(!o.success)throw new Error(o.message||"Failed to fetch invoices");return o}return o}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}async recordUsage(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/usage`,{method:"POST",body:JSON.stringify(t)});if(!r.ok){let e="Failed to record usage";try{e=(await r.json()).message||e}catch{e=`Failed to record usage (${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 record usage");return n.data||n}return n}async getQuotaUsageStatus(e,t){const r=await this.fetchResponse(`workspaces/${e}/subscription/usage/status?quotaSlug=${encodeURIComponent(t)}`);if(!r.ok){let e="Failed to fetch quota usage status";try{e=(await r.json()).message||e}catch{e=404===r.status?"Workspace not found or no subscription available":401===r.status?"Unauthorized - Please check your session":`Failed to fetch quota usage status (${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 quota usage status");return n.data||n}return n}async getAllQuotaUsage(e){const t=await this.fetchResponse(`workspaces/${e}/subscription/usage/all`);if(!t.ok){let e="Failed to fetch all quota usage";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 all quota usage (${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 all quota usage");return r.data||r}return r}async getUsageLogs(e,t){const r=new URLSearchParams;t?.quotaSlug&&r.append("quotaSlug",t.quotaSlug),t?.from&&r.append("from",t.from),t?.to&&r.append("to",t.to),t?.source&&r.append("source",t.source),t?.page&&r.append("page",t.page.toString()),t?.limit&&r.append("limit",t.limit.toString());const n=r.toString(),a=`workspaces/${e}/subscription/usage/logs${n?`?${n}`:""}`,o=await this.fetchResponse(a);if(!o.ok){let e="Failed to fetch usage logs";try{e=(await o.json()).message||e}catch{e=404===o.status?"Workspace not found":401===o.status?"Unauthorized - Please check your session":`Failed to fetch usage logs (${o.status}: ${o.statusText})`}throw new Error(e)}const i=await o.json();if(void 0!==i.success){if(!i.success)throw new Error(i.message||"Failed to fetch usage logs");return i.data||i}return i}}const hr=e=>{e?Yt(tr,e._id):Xt(tr)},gr=()=>Jt(tr),br=()=>{Xt(tr)},yr=(e,t)=>!!e&&t.some(t=>t._id===e);function vr(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 wr(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}function xr(){const e=fr(),t=function(e){return s(()=>new mr(e),[e.serverUrl,e.version,e.orgId])}(e);return s(()=>({os:e,api:t}),[e,t])}const Sr=()=>{const e=Gr(),{os:t,api:r}=xr(),n=Br(e=>e.workspaces),o=Br(e=>e.auth.session?.user),i=u((t,r)=>{if((!(t._id===n.currentWorkspace?._id)||r?.forceEmit)&&t){const r=n.currentWorkspace;hr(t),e.workspaces(Ot(t)),Zt.emitWorkspaceChanged(t,r).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceChanged",metadata:{workspaceId:t._id}})})}},[n.currentWorkspace,e]),s=u(async(r,n)=>{const a=++p.current;e.workspaces(zt(r._id));try{const e=t.auth?.callbacks?.onWorkspaceChange;if(e){const t=wr(r,o?.id);try{await e({workspace:r,user:o??null,role:t})}catch(e){throw Ye(e,{component:"useSaaSWorkspaces",action:"onWorkspaceChange",metadata:{workspaceId:r._id}}),e}if(a!==p.current)return}i(r,n)}finally{a===p.current&&e.workspaces(zt(null))}},[e,t.auth?.callbacks?.onWorkspaceChange,i,o]);d(()=>{if(!n.isInitialized){const t=gr();if(e.workspaces(Dt(!0)),t){const e=n.workspaces.find(e=>e._id===t);e&&s(e,{forceEmit:!0}).catch(()=>{})}}},[n.isInitialized,n.workspaces,n.currentWorkspace,e,s]);const l=u(()=>{br(),e.workspaces(It())},[e]),c=a.useRef(!1),f=a.useRef(!1),p=a.useRef(0),m=u(async()=>{if(!n.loading&&!c.current){c.current=!0,e.workspaces(Ut(!0)),e.workspaces(Mt(null));try{const t=await r.getWorkspaces();if(e.workspaces(At(t)),t.length>0){const e=gr();if(e&&yr(e,t)){const r=t.find(t=>t._id===e);if(r)try{await s(r,{forceEmit:!0})}catch{}}else{const e=t[0];try{await s(e,{forceEmit:!0})}catch{}}}}catch(t){e.workspaces(Mt(t instanceof Error?t.message:"Failed to fetch workspaces"))}finally{e.workspaces(Ut(!1)),c.current=!1}}},[r,n.loading,e,s]),h=u(async()=>{if(!n.refreshing&&!c.current){c.current=!0,e.workspaces(Ft(!0));try{const t=await r.getWorkspaces();e.workspaces(At(t))}catch(e){}finally{e.workspaces(Ft(!1)),c.current=!1}}},[r,n.refreshing,e]),g=u(async(t,n)=>{const a=await r.createWorkspace({name:t,image:n});e.workspaces(_t(a)),Zt.emitWorkspaceCreated(a).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceCreated",metadata:{workspaceId:a._id}})})},[r,e]),b=u(async(t,n)=>{const a=await r.updateWorkspace(t._id,n);e.workspaces(Tt(a)),Zt.emitWorkspaceUpdated(a).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceUpdated",metadata:{workspaceId:a._id}})})},[r,e]),y=u(async()=>{if(f.current)return n.allFeatures.length>0?n.allFeatures:null;if(n.allFeatures.length>0)return n.allFeatures;f.current=!0;try{const t=await r.getFeatures();return e.workspaces(Pt(t)),t}catch(e){return Ye(e,{component:"useSaaSWorkspaces",action:"getFeatures"}),null}finally{f.current=!1}},[r,e,n.allFeatures]),v=u(async(e,t,n)=>await r.updateFeature(e,t,n),[r]);d(()=>{if(!n.currentWorkspace?._id||0===n.workspaces.length)return;const t=n.currentWorkspace._id,r=n.workspaces.find(e=>e._id===t);if(r)r!==n.currentWorkspace&&(hr(r),e.workspaces(Ot(r)));else if(n.workspaces.length>0){const e=n.workspaces[0];e._id!==t&&s(e).catch(()=>{})}},[n.workspaces,n.currentWorkspace,e,s]);const w=u(async e=>await r.getWorkspaceUsers(e),[r]),x=u(async(e,t,a)=>{const o=await r.addUser(e,{email:t,role:a}),i=n.workspaces.find(t=>t._id===e);return i&&Zt.emitWorkspaceUserAdded(o.userId,i,a).catch(t=>{Ye(t,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserAdded",metadata:{workspaceId:e,userId:o.userId,role:a}})}),h().catch(()=>{}),Ht(),o},[r,n.workspaces,h]),S=u(async(e,t)=>{const a=n.workspaces.find(t=>t._id===e);if(a&&vr(a,t))throw new Error("Cannot remove the workspace owner");const o=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t),i=await r.removeUser(e,t);if(a&&o){const t=o.role;Zt.emitWorkspaceUserRemoved(i.userId,a,t).catch(r=>{Ye(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRemoved",metadata:{workspaceId:e,userId:i.userId,role:t}})})}return h().catch(()=>{}),Ht(),i},[r,n.workspaces,h]),k=u(async(e,t,a)=>{if(a.role){const r=n.workspaces.find(t=>t._id===e);if(r&&vr(r,t))throw new Error("Cannot change the role of the workspace owner")}let o;if(a.role){const n=(await r.getWorkspaceUsers(e).catch(()=>[])).find(e=>("string"==typeof e.user?e.user:e.user._id)===t);o=n?.role}const i=await r.updateUser(e,t,a);return a.role&&o&&o!==a.role&&Zt.emitWorkspaceUserRoleChanged(i.userId,i.workspace,o,a.role).catch(r=>{Ye(r,{component:"useSaaSWorkspaces",action:"emitWorkspaceUserRoleChanged",metadata:{workspaceId:e,userId:t,previousRole:o,newRole:a.role}})}),i},[r,n.workspaces]),N=u(async e=>{const t=await r.getProfile().catch(()=>null),n=await r.updateUserProfile(e);return Zt.emitUserUpdated(n,t||void 0).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitUserUpdated",metadata:{userId:n._id}})}),n},[r]),E=u(async()=>await r.getProfile(),[r]),C=u(async e=>await r.getWorkspace(e),[r]),A=u(async t=>{if(!o)throw new Error("User must be authenticated to delete a workspace");const a=n.workspaces.find(e=>e._id===t);if(!a)throw new Error("Workspace not found");if(!vr(a,o.id))throw new Error("Only the workspace creator can delete the workspace");const i=await r.deleteWorkspace(t);return e.workspaces(Rt(t)),n.currentWorkspace?._id===t&&(br(),e.workspaces(It())),a&&Zt.emitWorkspaceDeleted(a).catch(e=>{Ye(e,{component:"useSaaSWorkspaces",action:"emitWorkspaceDeleted",metadata:{workspaceId:t}})}),i},[r,n.workspaces,n.currentWorkspace,e,o]);return{workspaces:n.workspaces,loading:n.loading,error:n.error,fetchWorkspaces:m,refreshWorkspaces:h,refreshing:n.refreshing,currentWorkspace:n.currentWorkspace,setCurrentWorkspace:i,switchToWorkspace:s,resetCurrentWorkspace:l,createWorkspace:g,allFeatures:n.allFeatures,getFeatures:y,updateFeature:v,getWorkspace:C,updateWorkspace:b,getUsers:w,addUser:x,removeUser:S,updateUser:k,getProfile:E,updateUserProfile:N,deleteWorkspace:A,switching:null!==n.switchingToId,switchingToId:n.switchingToId}},kr=new Set;function Nr(){kr.forEach(e=>e())}const Er=e=>{const{os:t,api:r}=xr(),n=S(t),[a,o]=f(null),[i,s]=f(!1),[l,c]=f(null),p=u(async()=>{if(e&&n){s(!0),c(null);try{const t=await r.getPublicPlans(e);o(t)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plans";c(r),Ye(t,{component:"usePublicPlans",action:"fetchPlans",metadata:{slug:e}})}finally{s(!1)}}else o(null)},[r,e,n]);d(()=>{p()},[p]);const m=e&&!n||i;return{items:a?.items??[],plans:a?.plans??[],notes:a?.notes,loading:m,error:l,refetch:p}},Cr=e=>{const{api:t}=xr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),l=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getPlanGroupVersion(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group version";s(r),Ye(t,{component:"usePublicPlanGroupVersion",action:"fetchVersion",metadata:{groupVersionId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{l()},[l]),{planGroupVersion:r,loading:a,error:i,refetch:l}},Ar=e=>{const{api:t}=xr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),l=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getCurrentSubscription(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch subscription";s(r),Ye(t,{component:"useSubscription",action:"fetchSubscription",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{l()},[l]),{subscription:r,loading:a,error:i,refetch:l}},_r=(e,t)=>{const{api:r}=xr(),[n,a]=f(null),[o,i]=f(!1),[s,l]=f(null),c=u(async()=>{if(e){i(!0),l(null);try{const n=t?await r.getPlanGroupByVersion(e,t):await r.getPlanGroup(e);a(n)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch plan group";l(n),Ye(r,{component:"usePlanGroup",action:"fetchPlanGroup",metadata:{workspaceId:e,groupVersionId:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{c()},[c]),{planGroup:n,loading:o,error:s,refetch:c}},Tr=e=>{const{api:t}=xr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),l=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getPlanGroupVersions(e);n(r)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch plan group versions";s(r),Ye(t,{component:"usePlanGroupVersions",action:"fetchVersions",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{l()},[l]),{versions:r,loading:a,error:i,refetch:l}},Rr=e=>{const{api:t}=xr(),[r,n]=f(!1),[a,o]=f(null);return{createCheckoutSession:u(async r=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const n=await t.createCheckoutSession(e,r);return"trial_started"===n.type&&(Ht(),Nr()),n}catch(t){const n=t instanceof Error?t.message:"Failed to create checkout session";throw o(n),Ye(t,{component:"useCreateCheckoutSession",action:"createCheckoutSession",metadata:{workspaceId:e,request:r}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Pr=e=>{const{api:t}=xr(),[r,n]=f(!1),[a,o]=f(null),i=u(async(r,a)=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const n={planVersionId:r,...a?.billingInterval&&{billingInterval:a.billingInterval},...a?.successUrl&&{successUrl:a.successUrl},...a?.cancelUrl&&{cancelUrl:a.cancelUrl}},o=await t.updateSubscription(e,n);return Ht(),o}catch(t){const n=t instanceof Error?t.message:"Failed to update subscription";throw o(n),Ye(t,{component:"useUpdateSubscription",action:"updateSubscription",metadata:{workspaceId:e,planVersionId:r,options:a}}),t}finally{n(!1)}},[t,e]);return{updateSubscription:i,loading:r,error:a}},Or=(e,t)=>{const r=Ar(e),n=_r(e,t),a=Pr(e),o=u(async()=>{await Promise.all([r.refetch(),n.refetch()])},[r.refetch,n.refetch]);return{subscription:r.subscription,planGroup:n.planGroup,loading:r.loading||n.loading||a.loading,error:r.error||n.error||a.error,updateSubscription:a.updateSubscription,refetch:o}},Ir=(e,t=10,r)=>{const{api:n}=xr(),[a,o]=f([]),[i,s]=f(!1),[l,c]=f(!1),[p,m]=f(null),h=u(async()=>{if(!e)return o([]),void s(!1);c(!0),m(null);try{const a=await n.listInvoices(e,t,r);o(a.invoices||[]),s(a.has_more||!1)}catch(n){const a=n instanceof Error?n.message:"Failed to fetch invoices";m(a),Ye(n,{component:"useInvoices",action:"fetchInvoices",metadata:{workspaceId:e,limit:t,startingAfter:r}})}finally{c(!1)}},[n,e,t,r]);return d(()=>{h()},[h]),{invoices:a,hasMore:i,loading:l,error:p,refetch:h}},Dr=(e,t)=>{const{api:r}=xr(),[n,a]=f(null),[o,i]=f(!1),[s,l]=f(null),c=u(async()=>{if(e&&t){i(!0),l(null);try{const n=await r.getInvoice(e,t);a(n.invoice)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch invoice";l(n),Ye(r,{component:"useInvoice",action:"fetchInvoice",metadata:{workspaceId:e,invoiceId:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{c()},[c]),{invoice:n,loading:o,error:s,refetch:c}},Ur=e=>{const{api:t}=xr(),[r,n]=f(!1),[a,o]=f(null);return{cancelSubscription:u(async()=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const r=await t.cancelSubscriptionAtPeriodEnd(e);return Ht(),r}catch(t){const r=t instanceof Error?t.message:"Failed to cancel subscription";throw o(r),Ye(t,{component:"useCancelSubscription",action:"cancelSubscription",metadata:{workspaceId:e}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Mr=e=>{const{api:t}=xr(),[r,n]=f(!1),[a,o]=f(null);return{resumeSubscription:u(async()=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const r=await t.resumeSubscription(e);return Ht(),r}catch(t){const r=t instanceof Error?t.message:"Failed to resume subscription";throw o(r),Ye(t,{component:"useResumeSubscription",action:"resumeSubscription",metadata:{workspaceId:e}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},Fr=e=>{const{api:t}=xr(),[r,n]=f(!1),[a,o]=f(null);return{recordUsage:u(async r=>{if(!e)throw new Error("Workspace ID is required");n(!0),o(null);try{const n=await t.recordUsage(e,r);return Nr(),n}catch(t){const n=t instanceof Error?t.message:"Failed to record usage";throw o(n),Ye(t,{component:"useRecordUsage",action:"recordUsage",metadata:{workspaceId:e,request:r}}),t}finally{n(!1)}},[t,e]),loading:r,error:a}},zr=(e,t)=>{const{api:r}=xr(),[n,a]=f(null),[o,i]=f(!1),[s,l]=f(null),c=u(async()=>{if(e&&t){i(!0),l(null);try{const n=await r.getQuotaUsageStatus(e,t);a(n)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch quota usage status";l(n),Ye(r,{component:"useQuotaUsageStatus",action:"fetchStatus",metadata:{workspaceId:e,quotaSlug:t}})}finally{i(!1)}}else a(null)},[r,e,t]);return d(()=>{c()},[c]),{status:n,loading:o,error:s,refetch:c}},Lr=e=>{const{api:t}=xr(),[r,n]=f(null),[a,o]=f(!1),[i,s]=f(null),l=u(async()=>{if(e){o(!0),s(null);try{const r=await t.getAllQuotaUsage(e);n(r.quotas)}catch(t){const r=t instanceof Error?t.message:"Failed to fetch all quota usage";s(r),Ye(t,{component:"useAllQuotaUsage",action:"fetchAllUsage",metadata:{workspaceId:e}})}finally{o(!1)}}else n(null)},[t,e]);return d(()=>{l()},[l]),{quotas:r,loading:a,error:i,refetch:l}},jr=(e,t,r)=>{const{api:n}=xr(),[a,o]=f([]),[i,s]=f(0),[l,c]=f(0),[p,m]=f(1),[h,g]=f(!1),[b,y]=f(!1),[v,w]=f(!1),[x,S]=f(null),k=r?.from,N=r?.to,E=r?.source,C=r?.page,A=r?.limit,_=u(async()=>{if(!e)return o([]),s(0),c(0),m(1),g(!1),void y(!1);w(!0),S(null);try{const r={...t&&{quotaSlug:t},...k&&{from:k},...N&&{to:N},...E&&{source:E},...C&&{page:C},...A&&{limit:A}},a=await n.getUsageLogs(e,r);o(a.docs||[]),s(a.totalDocs||0),c(a.totalPages||0),m(a.page||1),g(a.hasNextPage||!1),y(a.hasPrevPage||!1)}catch(r){const n=r instanceof Error?r.message:"Failed to fetch usage logs";S(n),Ye(r,{component:"useUsageLogs",action:"fetchLogs",metadata:{workspaceId:e,quotaSlug:t}})}finally{w(!1)}},[n,e,t,k,N,E,C,A]);return d(()=>{_()},[_]),{logs:a,totalDocs:i,totalPages:l,page:p,hasNextPage:h,hasPrevPage:b,loading:v,error:x,refetch:_}},$r=l(null);$r.displayName="SubscriptionContext";const Vr=a.memo(function({children:e}){const{currentWorkspace:r}=Sr(),{subscription:n,loading:a,error:o,refetch:i}=Ar(r?._id);d(()=>{return e=i,Kt.add(e),()=>{Kt.delete(e)};var e},[i]);const l=s(()=>({response:n,loading:a,error:o,refetch:i}),[n,a,o,i]);return t($r.Provider,{value:l,children:e})});function Wr(){const e=p($r);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 Br(e,t){const r=Et(),n=gt(),a=Wt(),o=e||(e=>e);return ot(s(()=>({os:r,auth:n,workspaces:a}),[r,n,a]),o,t)}function Gr(){const e=bt(),t=Ct(),r=Bt();return s(()=>({auth:e,os:t,workspaces:r}),[e,t,r])}Vr.displayName="SubscriptionContextProvider";const Kr=l(null);Kr.displayName="QuotaUsageContext";const Hr=a.memo(function({children:e}){const{currentWorkspace:r}=Sr(),{quotas:n,loading:a,error:o,refetch:i}=Lr(r?._id);d(()=>{return e=i,kr.add(e),()=>{kr.delete(e)};var e},[i]);const l=s(()=>({quotas:n,loading:a,error:o,refetch:i}),[n,a,o,i]);return t(Kr.Provider,{value:l,children:e})});function Zr(){const e=p(Kr);if(null===e)throw new Error("useQuotaUsageContext must be used within QuotaUsageContextProvider. Make sure QuotaUsageContextProvider is wrapping your application (or the tree that uses quota gates).");return e}Hr.displayName="QuotaUsageContextProvider";class qr extends dr{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 Jr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Yr}=Object.prototype,{getPrototypeOf:Xr}=Object,{iterator:Qr,toStringTag:en}=Symbol,tn=(rn=Object.create(null),e=>{const t=Yr.call(e);return rn[t]||(rn[t]=t.slice(8,-1).toLowerCase())});var rn;const nn=e=>(e=e.toLowerCase(),t=>tn(t)===e),an=e=>t=>typeof t===e,{isArray:on}=Array,sn=an("undefined");function ln(e){return null!==e&&!sn(e)&&null!==e.constructor&&!sn(e.constructor)&&un(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const cn=nn("ArrayBuffer");const dn=an("string"),un=an("function"),fn=an("number"),pn=e=>null!==e&&"object"==typeof e,mn=e=>{if("object"!==tn(e))return!1;const t=Xr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||en in e||Qr in e)},hn=nn("Date"),gn=nn("File"),bn=nn("Blob"),yn=nn("FileList"),vn=nn("URLSearchParams"),[wn,xn,Sn,kn]=["ReadableStream","Request","Response","Headers"].map(nn);function Nn(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),on(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(ln(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function En(e,t){if(ln(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 Cn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,An=e=>!sn(e)&&e!==Cn;const _n=(Tn="undefined"!=typeof Uint8Array&&Xr(Uint8Array),e=>Tn&&e instanceof Tn);var Tn;const Rn=nn("HTMLFormElement"),Pn=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),On=nn("RegExp"),In=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Nn(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Dn=nn("AsyncFunction"),Un=(Mn="function"==typeof setImmediate,Fn=un(Cn.postMessage),Mn?setImmediate:Fn?(zn=`axios@${Math.random()}`,Ln=[],Cn.addEventListener("message",({source:e,data:t})=>{e===Cn&&t===zn&&Ln.length&&Ln.shift()()},!1),e=>{Ln.push(e),Cn.postMessage(zn,"*")}):e=>setTimeout(e));var Mn,Fn,zn,Ln;const jn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Cn):"undefined"!=typeof process&&process.nextTick||Un;var $n={isArray:on,isArrayBuffer:cn,isBuffer:ln,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||un(e.append)&&("formdata"===(t=tn(e))||"object"===t&&un(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&cn(e.buffer),t},isString:dn,isNumber:fn,isBoolean:e=>!0===e||!1===e,isObject:pn,isPlainObject:mn,isEmptyObject:e=>{if(!pn(e)||ln(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:wn,isRequest:xn,isResponse:Sn,isHeaders:kn,isUndefined:sn,isDate:hn,isFile:gn,isBlob:bn,isRegExp:On,isFunction:un,isStream:e=>pn(e)&&un(e.pipe),isURLSearchParams:vn,isTypedArray:_n,isFileList:yn,forEach:Nn,merge:function e(){const{caseless:t,skipUndefined:r}=An(this)&&this||{},n={},a=(a,o)=>{const i=t&&En(n,o)||o;mn(n[i])&&mn(a)?n[i]=e(n[i],a):mn(a)?n[i]=e({},a):on(a)?n[i]=a.slice():r&&sn(a)||(n[i]=a)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Nn(arguments[e],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(Nn(t,(t,n)=>{r&&un(t)?Object.defineProperty(e,n,{value:Jr(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,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Xr(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:tn,kindOfTest:nn,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(on(e))return e;let t=e.length;if(!fn(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Qr]).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:Rn,hasOwnProperty:Pn,hasOwnProp:Pn,reduceDescriptors:In,freezeMethods:e=>{In(e,(t,r)=>{if(un(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];un(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 on(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:En,global:Cn,isContextDefined:An,isSpecCompliantForm:function(e){return!!(e&&un(e.append)&&"FormData"===e[en]&&e[Qr])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(pn(e)){if(t.indexOf(e)>=0)return;if(ln(e))return e;if(!("toJSON"in e)){t[n]=e;const a=on(e)?[]:{};return Nn(e,(e,t)=>{const o=r(e,n+1);!sn(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Dn,isThenable:e=>e&&(pn(e)||un(e))&&un(e.then)&&un(e.catch),setImmediate:Un,asap:jn,isIterable:e=>null!=e&&un(e[Qr])};let Vn=class e extends Error{static from(t,r,n,a,o,i){const s=new e(t.message,r||t.code,n,a,o);return s.cause=t,s.name=t.name,i&&Object.assign(s,i),s}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:$n.toJSONObject(this.config),code:this.code,status:this.status}}};Vn.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Vn.ERR_BAD_OPTION="ERR_BAD_OPTION",Vn.ECONNABORTED="ECONNABORTED",Vn.ETIMEDOUT="ETIMEDOUT",Vn.ERR_NETWORK="ERR_NETWORK",Vn.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Vn.ERR_DEPRECATED="ERR_DEPRECATED",Vn.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Vn.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Vn.ERR_CANCELED="ERR_CANCELED",Vn.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Vn.ERR_INVALID_URL="ERR_INVALID_URL";function Wn(e){return $n.isPlainObject(e)||$n.isArray(e)}function Bn(e){return $n.endsWith(e,"[]")?e.slice(0,-2):e}function Gn(e,t,r){return e?e.concat(t).map(function(e,t){return e=Bn(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Kn=$n.toFlatObject($n,{},null,function(e){return/^is[A-Z]/.test(e)});function Hn(e,t,r){if(!$n.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=$n.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!$n.isUndefined(t[e])})).metaTokens,a=r.visitor||c,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$n.isSpecCompliantForm(t);if(!$n.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if($n.isDate(e))return e.toISOString();if($n.isBoolean(e))return e.toString();if(!s&&$n.isBlob(e))throw new Vn("Blob is not supported. Use a Buffer instead.");return $n.isArrayBuffer(e)||$n.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if($n.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if($n.isArray(e)&&function(e){return $n.isArray(e)&&!e.some(Wn)}(e)||($n.isFileList(e)||$n.endsWith(r,"[]"))&&(s=$n.toArray(e)))return r=Bn(r),s.forEach(function(e,n){!$n.isUndefined(e)&&null!==e&&t.append(!0===i?Gn([r],n,o):null===i?r:r+"[]",l(e))}),!1;return!!Wn(e)||(t.append(Gn(a,r,o),l(e)),!1)}const d=[],u=Object.assign(Kn,{defaultVisitor:c,convertValue:l,isVisitable:Wn});if(!$n.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!$n.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),$n.forEach(r,function(r,o){!0===(!($n.isUndefined(r)||null===r)&&a.call(t,r,$n.isString(o)?o.trim():o,n,u))&&e(r,n?n.concat(o):[o])}),d.pop()}}(e),t}function Zn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function qn(e,t){this._pairs=[],e&&Hn(e,this,t)}const Jn=qn.prototype;function Yn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xn(e,t,r){if(!t)return e;const n=r&&r.encode||Yn,a=$n.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let i;if(i=o?o(t,a):$n.isURLSearchParams(t)?t.toString():new qn(t,a).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Jn.append=function(e,t){this._pairs.push([e,t])},Jn.toString=function(e){const t=e?function(t){return e.call(this,t,Zn)}:Zn;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Qn{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){$n.forEach(this.handlers,function(t){null!==t&&e(t)})}}var ea={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ta={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:qn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ra="undefined"!=typeof window&&"undefined"!=typeof document,na="object"==typeof navigator&&navigator||void 0,aa=ra&&(!na||["ReactNative","NativeScript","NS"].indexOf(na.product)<0),oa="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ia=ra&&window.location.href||"http://localhost";var sa={...Object.freeze({__proto__:null,hasBrowserEnv:ra,hasStandardBrowserEnv:aa,hasStandardBrowserWebWorkerEnv:oa,navigator:na,origin:ia}),...ta};function la(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&$n.isArray(n)?n.length:o,s)return $n.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&$n.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&$n.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if($n.isFormData(e)&&$n.isFunction(e.entries)){const r={};return $n.forEachEntry(e,(e,n)=>{t(function(e){return $n.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const ca={transitional:ea,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=$n.isObject(e);a&&$n.isHTMLForm(e)&&(e=new FormData(e));if($n.isFormData(e))return n?JSON.stringify(la(e)):e;if($n.isArrayBuffer(e)||$n.isBuffer(e)||$n.isStream(e)||$n.isFile(e)||$n.isBlob(e)||$n.isReadableStream(e))return e;if($n.isArrayBufferView(e))return e.buffer;if($n.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Hn(e,new sa.classes.URLSearchParams,{visitor:function(e,t,r,n){return sa.isNode&&$n.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=$n.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Hn(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if($n.isString(e))try{return(t||JSON.parse)(e),$n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ca.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if($n.isResponse(e)||$n.isReadableStream(e))return e;if(e&&$n.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 Vn.from(e,Vn.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:sa.classes.FormData,Blob:sa.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$n.forEach(["delete","get","head","post","put","patch"],e=>{ca.headers[e]={}});const da=$n.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 ua=Symbol("internals");function fa(e){return e&&String(e).trim().toLowerCase()}function pa(e){return!1===e||null==e?e:$n.isArray(e)?e.map(pa):String(e)}function ma(e,t,r,n,a){return $n.isFunction(n)?n.call(this,t,r):(a&&(t=r),$n.isString(t)?$n.isString(n)?-1!==t.indexOf(n):$n.isRegExp(n)?n.test(t):void 0:void 0)}let ha=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=fa(t);if(!a)throw new Error("header name must be a non-empty string");const o=$n.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=pa(e))}const o=(e,t)=>$n.forEach(e,(e,r)=>a(e,r,t));if($n.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if($n.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((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]&&da[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($n.isObject(e)&&$n.isIterable(e)){let r,n,a={};for(const t of e){if(!$n.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?$n.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=fa(e)){const r=$n.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($n.isFunction(t))return t.call(this,e,r);if($n.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fa(e)){const r=$n.findKey(this,e);return!(!r||void 0===this[r]||t&&!ma(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=fa(e)){const a=$n.findKey(r,e);!a||t&&!ma(0,r[a],a,t)||(delete r[a],n=!0)}}return $n.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&&!ma(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return $n.forEach(this,(n,a)=>{const o=$n.findKey(r,a);if(o)return t[o]=pa(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=pa(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $n.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&$n.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[ua]=this[ua]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=fa(e);t[n]||(!function(e,t){const r=$n.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 $n.isArray(e)?e.forEach(n):n(e),this}};function ga(e,t){const r=this||ca,n=t||r,a=ha.from(n.headers);let o=n.data;return $n.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function ba(e){return!(!e||!e.__CANCEL__)}ha.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$n.reduceDescriptors(ha.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),$n.freezeMethods(ha);let ya=class extends Vn{constructor(e,t,r){super(null==e?"canceled":e,Vn.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function va(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Vn("Request failed with status code "+r.status,[Vn.ERR_BAD_REQUEST,Vn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const wa=(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,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const l=Date.now(),c=n[i];a||(a=l),r[o]=s,n[o]=l;let d=i,u=0;for(;d!==o;)u+=r[d++],d%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),l-a<t)return;const f=c&&l-c;return f?Math.round(1e3*u/f):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,l=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:l||void 0,estimated:l&&i&&o<=i?(i-o)/l:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},xa=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Sa=e=>(...t)=>$n.asap(()=>e(...t));var ka=sa.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,sa.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(sa.origin),sa.navigator&&/(msie|trident)/i.test(sa.navigator.userAgent)):()=>!0,Na=sa.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];$n.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),$n.isString(n)&&s.push(`path=${n}`),$n.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),$n.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.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 Ea(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 Ca=e=>e instanceof ha?{...e}:e;function Aa(e,t){t=t||{};const r={};function n(e,t,r,n){return $n.isPlainObject(e)&&$n.isPlainObject(t)?$n.merge.call({caseless:n},e,t):$n.isPlainObject(t)?$n.merge({},t):$n.isArray(t)?t.slice():t}function a(e,t,r,a){return $n.isUndefined(t)?$n.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!$n.isUndefined(t))return n(void 0,t)}function i(e,t){return $n.isUndefined(t)?$n.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(Ca(e),Ca(t),0,!0)};return $n.forEach(Object.keys({...e,...t}),function(n){const o=l[n]||a,i=o(e[n],t[n],n);$n.isUndefined(i)&&o!==s||(r[n]=i)}),r}var _a=e=>{const t=Aa({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=ha.from(i),t.url=Xn(Ea(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),$n.isFormData(r))if(sa.hasStandardBrowserEnv||sa.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if($n.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(sa.hasStandardBrowserEnv&&(n&&$n.isFunction(n)&&(n=n(t)),n||!1!==n&&ka(t.url))){const e=a&&o&&Na.read(o);e&&i.set(a,e)}return t};var Ta="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=_a(e);let a=n.data;const o=ha.from(n.headers).normalize();let i,s,l,c,d,{responseType:u,onUploadProgress:f,onDownloadProgress:p}=n;function m(){c&&c(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=ha.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());va(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 Vn("Request aborted",Vn.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new Vn(n,Vn.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||ea;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Vn(t,a.clarifyTimeoutError?Vn.ETIMEDOUT:Vn.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&$n.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),$n.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),u&&"json"!==u&&(h.responseType=n.responseType),p&&([l,d]=wa(p,!0),h.addEventListener("progress",l)),f&&h.upload&&([s,c]=wa(f),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new ya(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const b=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);b&&-1===sa.protocols.indexOf(b)?r(new Vn("Unsupported protocol "+b+":",Vn.ERR_BAD_REQUEST,e)):h.send(a||null)})};const Ra=(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,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Vn?t:new ya(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Vn(`timeout of ${t}ms exceeded`,Vn.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>$n.asap(i),s}},Pa=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},Oa=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()}},Ia=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Oa(e))yield*Pa(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw s(e),e}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:Da}=$n,Ua=(({Request:e,Response:t})=>({Request:e,Response:t}))($n.global),{ReadableStream:Ma,TextEncoder:Fa}=$n.global,za=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},La=e=>{e=$n.merge.call({skipUndefined:!0},Ua,e);const{fetch:t,Request:r,Response:n}=e,a=t?Da(t):"function"==typeof fetch,o=Da(r),i=Da(n);if(!a)return!1;const s=a&&Da(Ma),l=a&&("function"==typeof Fa?(c=new Fa,e=>c.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var c;const d=o&&s&&za(()=>{let e=!1;const t=new r(sa.origin,{body:new Ma,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&za(()=>$n.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 Vn(`Response type '${e}' is not supported`,Vn.ERR_NOT_SUPPORT,r)})});const p=async(e,t)=>{const n=$n.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if($n.isBlob(e))return e.size;if($n.isSpecCompliantForm(e)){const t=new r(sa.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $n.isArrayBufferView(e)||$n.isArrayBuffer(e)?e.byteLength:($n.isURLSearchParams(e)&&(e+=""),$n.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:l,cancelToken:c,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:b,headers:y,withCredentials:v="same-origin",fetchOptions:w}=_a(e),x=t||fetch;b=b?(b+"").toLowerCase():"text";let S=Ra([l,c&&c.toAbortSignal()],m),k=null;const N=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let E;try{if(g&&d&&"get"!==i&&"head"!==i&&0!==(E=await p(y,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if($n.isFormData(s)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,r]=xa(E,wa(Sa(g)));s=Ia(t.body,65536,e,r)}}$n.isString(v)||(v=v?"include":"omit");const t=o&&"credentials"in r.prototype,l={...w,signal:S,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:"half",credentials:t?v:void 0};k=o&&new r(a,l);let c=await(o?x(k,w):x(a,l));const m=u&&("stream"===b||"response"===b);if(u&&(h||m&&N)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=c[t]});const t=$n.toFiniteNumber(c.headers.get("content-length")),[r,a]=h&&xa(t,wa(Sa(h),!0))||[];c=new n(Ia(c.body,65536,r,()=>{a&&a(),N&&N()}),e)}b=b||"text";let C=await f[$n.findKey(f,b)||"text"](c,e);return!m&&N&&N(),await new Promise((t,r)=>{va(t,r,{data:C,headers:ha.from(c.headers),status:c.status,statusText:c.statusText,config:e,request:k})})}catch(t){if(N&&N(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Vn("Network Error",Vn.ERR_NETWORK,e,k),{cause:t.cause||t});throw Vn.from(t,t&&t.code,e,k)}}},ja=new Map,$a=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,l=o.length,c=ja;for(;l--;)i=o[l],s=c.get(i),void 0===s&&c.set(i,s=l?new Map:La(t)),c=s;return s};$a();const Va={http:null,xhr:Ta,fetch:{get:$a}};$n.forEach(Va,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Wa=e=>`- ${e}`,Ba=e=>$n.isFunction(e)||null===e||!1===e;var Ga={getAdapter:function(e,t){e=$n.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!Ba(n)&&(a=Va[(r=String(n)).toLowerCase()],void 0===a))throw new Vn(`Unknown adapter '${r}'`);if(a&&($n.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).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(Wa).join("\n"):" "+Wa(e[0]):"as no adapter specified";throw new Vn("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:Va};function Ka(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ya(null,e)}function Ha(e){Ka(e),e.headers=ha.from(e.headers),e.data=ga.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ga.getAdapter(e.adapter||ca.adapter,e)(e).then(function(t){return Ka(e),t.data=ga.call(e,e.transformResponse,t),t.headers=ha.from(t.headers),t},function(t){return ba(t)||(Ka(e),t&&t.response&&(t.response.data=ga.call(e,e.transformResponse,t.response),t.response.headers=ha.from(t.response.headers))),Promise.reject(t)})}const Za="1.13.4",qa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{qa[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ja={};qa.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Za+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Vn(n(a," has been removed"+(t?" in "+t:"")),Vn.ERR_DEPRECATED);return t&&!Ja[a]&&(Ja[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},qa.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 Vn("options must be an object",Vn.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new Vn("option "+o+" must be "+r,Vn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Vn("Unknown option "+o,Vn.ERR_BAD_OPTION)}},validators:qa};const Xa=Ya.validators;let Qa=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Qn,response:new Qn}}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=Aa(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Ya.assertOptions(r,{silentJSONParsing:Xa.transitional(Xa.boolean),forcedJSONParsing:Xa.transitional(Xa.boolean),clarifyTimeoutError:Xa.transitional(Xa.boolean)},!1),null!=n&&($n.isFunction(n)?t.paramsSerializer={serialize:n}:Ya.assertOptions(n,{encode:Xa.function,serialize:Xa.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ya.assertOptions(t,{baseUrl:Xa.spelling("baseURL"),withXsrfToken:Xa.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&$n.merge(a.common,a[t.method]);a&&$n.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=ha.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let d,u=0;if(!s){const e=[Ha.bind(this),void 0];for(e.unshift(...i),e.push(...l),d=e.length,c=Promise.resolve(t);u<d;)c=c.then(e[u++],e[u++]);return c}d=i.length;let f=t;for(;u<d;){const e=i[u++],t=i[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{c=Ha.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=l.length;u<d;)c=c.then(l[u++],l[u++]);return c}getUri(e){return Xn(Ea((e=Aa(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};$n.forEach(["delete","get","head","options"],function(e){Qa.prototype[e]=function(t,r){return this.request(Aa(r||{},{method:e,url:t,data:(r||{}).data}))}}),$n.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(Aa(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Qa.prototype[e]=t(),Qa.prototype[e+"Form"]=t(!0)});const eo={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(eo).forEach(([e,t])=>{eo[t]=e});const to=function e(t){const r=new Qa(t),n=Jr(Qa.prototype.request,r);return $n.extend(n,Qa.prototype,r,{allOwnKeys:!0}),$n.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Aa(t,r))},n}(ca);to.Axios=Qa,to.CanceledError=ya,to.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 ya(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}}},to.isCancel=ba,to.VERSION=Za,to.toFormData=Hn,to.AxiosError=Vn,to.Cancel=to.CanceledError,to.all=function(e){return Promise.all(e)},to.spread=function(e){return function(t){return e.apply(null,t)}},to.isAxiosError=function(e){return $n.isObject(e)&&!0===e.isAxiosError},to.mergeConfig=Aa,to.AxiosHeaders=ha,to.formToJSON=e=>la($n.isHTMLForm(e)?new FormData(e):e),to.getAdapter=Ga.getAdapter,to.HttpStatusCode=eo,to.default=to;const{Axios:ro,AxiosError:no,CanceledError:ao,isCancel:oo,CancelToken:io,VERSION:so,all:lo,Cancel:co,isAxiosError:uo,spread:fo,toFormData:po,AxiosHeaders:mo,HttpStatusCode:ho,formToJSON:go,getAdapter:bo,mergeConfig:yo}=to;const vo=new class{constructor(e={}){if(e.baseURL)try{new URL(e.baseURL)}catch{throw new Error(`[BuildBase SDK] Invalid baseURL: "${e.baseURL}"`)}this.client=to.create({baseURL:e.baseURL||"",timeout:e.timeout||1e4,headers:{"Content-Type":"application/json",...e.headers}}),this.client.interceptors.request.use(e=>{const t=or();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 wo=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 xo(){return Br(e=>e.auth)}function So(){const e=Gr(),t=xo(),r=fr(),{serverUrl:n,orgId:a,auth:o}=r,{resetCurrentWorkspace:i,currentWorkspace:l}=Sr(),c=u(async()=>{e.auth(et());try{const t=await vo.post(`${n}/api/v1/auth/request`,{orgId:a,clientId:o?.clientId,redirect:{success:o?.redirectUrl||window.location.href,error:o?.redirectUrl||window.location.href}});if(!t.data.success)throw e.auth(rt()),new Error(t.data.message||"Authentication failed");window.location.href=t.data.data.redirectUrl}catch(t){throw e.auth(rt()),Ye(t,{component:"useSaaSAuth",action:"signIn"}),t}},[n,a,o,e]),d=u(async()=>{try{o?.callbacks?.onSignOut&&"function"==typeof o.callbacks.onSignOut&&await o.callbacks.onSignOut()}catch(e){Ye(e,{component:"useSaaSAuth",action:"signOut"})}finally{ar(),e.auth(at()),i()}},[e,i,o?.callbacks?.onSignOut]),f=u(e=>{l?wo.openWorkspaceSettings(e):Ye(new Error("Cannot open settings: No current workspace"),{component:"useSaaSAuth",action:"openWorkspaceSettings"})},[l]),p=s(()=>lt(t.status),[t.status]);return s(()=>({user:t.session?.user,session:t.session,status:t.status,...p,signIn:c,signOut:d,openWorkspaceSettings:f}),[t.session,t.status,p,c,d,f])}const ko=a.memo(({children:e,callbacks:n})=>{const o=Gr(),i=xo(),l=fr(),c=lt(i.status).isAuthenticated,f=a.useRef(!1),p=a.useRef(null),m=a.useRef(!1),h=s(()=>n,[n]),g=u(async e=>{try{if(h?.handleAuthentication){const{sessionId:t}=await h.handleAuthentication(e);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid sessionId received from authentication callback");const r=l;if(!S(r))throw new Error("OS configuration is not available");const{serverUrl:n,version:a,orgId:i}=r,s=new qr({serverUrl:n,version:a}),c=await s.getProfile(t),d=lr(rr(c,i,r.auth?.clientId||""),t);nr(d.sessionId),o.auth(nt(d)),function(){if("undefined"!=typeof window)try{const e=new URL(window.location.href);e.searchParams.delete(Qt),window.history.replaceState({},"",e.toString())}catch(e){Ye(e,{component:"auth/utils",action:"removeTokenFromUrl",metadata:{param:Qt}})}}()}}catch(t){throw Ye(t,{component:"AuthProviderWrapper",action:"handleAuthRedirect",metadata:{hasCode:!!e}}),o.auth(rt()),t}},[o,h,l]);return qt(async e=>{if("undefined"==typeof window)return;if(c)return;if(m.current)return;if(sr())return;const t=or();if(t){m.current=!0;try{if(!S(l))return m.current=!1,void Ye(new Error("OS configuration not available, cannot fetch user profile"),{component:"AuthProviderWrapper",action:"fetchUserProfile"});const{orgId:r}=l;let n;try{const r=new qr({serverUrl:l.serverUrl,version:l.version});n=await r.getProfile(t,e)}catch(e){if(!Xe(e,{component:"AuthProviderWrapper",action:"fetchUserProfile",metadata:{step:"fetchProfile"}}))return;return m.current=!1,ar(),void o.auth(rt())}const a=lr(rr(n,r,l.auth?.clientId||""),t);nr(a.sessionId),o.auth(nt(a))}catch(e){if(!Xe(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;ar(),o.auth(rt())}finally{m.current=!1}}else o.auth(rt())},[c,o,l]),d(()=>{const e=sr();if(!e)return;if(f.current||p.current===e)return;if(!S(l))return;f.current=!0,p.current=e;let t=!1;return o.auth(tt()),g(e).then(()=>{t||(p.current=null)}).catch(e=>{t||(Ye(e,{component:"AuthProviderWrapper",action:"handleAuthRedirectEffect",metadata:{hasCode:!0}}),p.current=null)}).finally(()=>{f.current=!1}),()=>{t=!0}},[g,l.serverUrl,l.version,l.orgId]),t(r,{children:e})});ko.displayName="AuthProviderWrapper";const No=a.memo(({config:e,auth:n,children:o})=>{const i=Gr(),l=fr(),c=a.useMemo(()=>({clientId:n?.clientId||"",redirectUrl:n?.redirectUrl||"",callbacks:n?.callbacks}),[n?.clientId,n?.redirectUrl,n?.callbacks]);d(()=>{i.os(yt({...e,auth:c}))},[e,c,i]);const u=s(()=>S(l)?new ur(l):null,[l.serverUrl,l.version,l.orgId]);return qt(async e=>{if(!u||l.settings)return;const t=await u.getSettings(e);i.os(vt(t))},[u,l.settings,i],{onError:e=>Ye(e,{component:"ContextConfigProvider",action:"fetchSettings",metadata:{serverUrl:l.serverUrl,version:l.version,orgId:l.orgId}})}),t(r,{children:o})});No.displayName="ContextConfigProvider";const Eo=l({container:null,setContainer:()=>{}}),Co=a.memo(({children:r})=>{const[n,o]=a.useState(null),i=a.useMemo(()=>({container:n,setContainer:o}),[n]),s=a.useMemo(()=>r,[r]);return e(Eo.Provider,{value:i,children:[s,t("div",{ref:o,id:"saas-os-portal",className:"saas-os-ui",style:{width:"100%",height:"100%"}})]})});Co.displayName="PortalProvider";class Ao extends dr{constructor(e){super(e)}async getAttributes(e){const t=await this.fetchResponse("users/attributes",{signal:e});if(!t.ok)throw new Error(await Ke(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 Ke(t,"Failed to fetch user features"));const r=await t.json();return"object"==typeof r&&null!==r?r:{}}}const _o=a.createContext(void 0),To=a.memo(({children:e})=>{const r=fr(),n=function(){const e=fr();return s(()=>new Ao(e),[e.serverUrl,e.version])}(),{isAuthenticated:o}=So(),{serverUrl:i,version:l}=r,[c,d]=f({}),[p,m]=f({}),[h,g]=f(!1),[b,y]=f(null),v=u(async e=>{if(i&&l&&o)try{const t=await n.getAttributes(e);d(t)}catch(e){if(Be(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user attributes");y(t),Ye(e,{component:"UserProvider",action:"fetchAttributes"})}else d({})},[n,i,l,o]),w=u(async()=>{if(i&&l&&o){g(!0),y(null);try{await v()}finally{g(!1)}}},[i,l,o,v]),x=u(async e=>{g(!0),y(null);try{const t=await n.updateAttributes(e);return await v(),t}catch(t){const r=t instanceof Error?t:new Error("Failed to update user attributes");throw y(r),Ye(t,{component:"UserProvider",action:"updateAttributes",metadata:{updates:e}}),t}finally{g(!1)}},[n,v]),S=u(async(e,t)=>{g(!0),y(null);try{const r=await n.updateAttribute(e,t);return await v(),r}catch(r){const n=r instanceof Error?r:new Error("Failed to update user attribute");throw y(n),Ye(r,{component:"UserProvider",action:"updateAttribute",metadata:{attributeKey:e,value:t}}),r}finally{g(!1)}},[n,v]),k=u(async e=>{if(i&&l&&o)try{const t=await n.getFeatures(e);m(t)}catch(e){if(Be(e))return;const t=e instanceof Error?e:new Error("Failed to fetch user features");y(t),Ye(e,{component:"UserProvider",action:"fetchFeatures"})}else m({})},[n,i,l,o]),N=u(async()=>{if(i&&l&&o){g(!0),y(null);try{await k()}finally{g(!1)}}},[i,l,o,k]);qt(async e=>{if(!o||!i||!l)return d({}),void m({});g(!0),y(null);try{await Promise.all([v(e),k(e)])}finally{g(!1)}},[o,i,l,v,k],{onError:e=>Ye(e,{component:"UserProvider",action:"initialFetch",metadata:{step:"fetchAttributesAndFeatures"}})});const E=a.useMemo(()=>({attributes:c,features:p,isLoading:h,error:b,updateAttributes:x,updateAttribute:S,refreshAttributes:w,refreshFeatures:N}),[c,p,h,b,x,S,w,N]);return t(_o.Provider,{value:E,children:e})});To.displayName="UserProvider";const Ro=h(()=>Promise.resolve().then(function(){return SE}).then(e=>({default:e.default}))),Po=({children:n})=>{const{currentWorkspace:a}=Sr(),[o,i]=f(!1),[s,l]=f("profile");return d(()=>{const e=wo.getState();i(e.open),l(e.section);return wo.subscribe((e,t)=>{i(e),l(t)})},[]),e(r,{children:[n,a&&o&&t(m,{fallback:null,children:t(Ro,{workspace:a,open:o,onOpenChange:e=>{e||wo.closeSettings()},section:s,onSectionChange:e=>{wo.setSection(e)},showTrigger:!1})})]})},Oo=(e,t,r)=>{if(t!==x.V1)throw new Error(`Invalid version: "${t}". Only "${x.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).`)},Io=a.memo(({serverUrl:e,version:r,orgId:n,auth:o,children:i})=>{Oo(e,r,n);const s=a.useMemo(()=>({serverUrl:e,version:r,orgId:n}),[e,r,n]),l=a.useMemo(()=>o?.callbacks,[o?.callbacks?.handleAuthentication,o?.callbacks?.onSignOut,o?.callbacks?.handleEvent,o?.callbacks?.onWorkspaceChange]),c=o?.callbacks?.handleEvent;return d(()=>(Zt.setCallbacks(c?{handleEvent:c}:null),()=>{Zt.setCallbacks(null)}),[c]),t(Gt,{children:t(ko,{callbacks:l,children:t(Co,{children:t(No,{config:s,auth:o,children:t(To,{children:t(Vr,{children:t(Hr,{children:t(Po,{children:i})})})})})})})})});Io.displayName="SaaSOSProviderInner";const Do=({children:e,...r})=>t(Qe,{children:t(Io,{...r,children:e})});Do.displayName="SaaSOSProvider";var Uo=e=>"checkbox"===e.type,Mo=e=>e instanceof Date,Fo=e=>null==e;const zo=e=>"object"==typeof e;var Lo=e=>!Fo(e)&&!Array.isArray(e)&&zo(e)&&!Mo(e),jo=e=>Lo(e)&&e.target?Uo(e.target)?e.target.checked:e.target.value:e,$o=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Vo="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Wo(e){if(e instanceof Date)return new Date(e);const t="undefined"!=typeof FileList&&e instanceof FileList;if(Vo&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!(r||Lo(e)&&(e=>{const t=e.constructor&&e.constructor.prototype;return Lo(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]=Wo(e[t]));return n}var Bo=e=>/^\w*$/.test(e),Go=e=>void 0===e,Ko=e=>Array.isArray(e)?e.filter(Boolean):[],Ho=e=>Ko(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Zo=(e,t,r)=>{if(!t||!Lo(e))return r;const n=(Bo(t)?[t]:Ho(t)).reduce((e,t)=>Fo(e)?e:e[t],e);return Go(n)||n===e?Go(e[t])?r:e[t]:n},qo=e=>"boolean"==typeof e,Jo=e=>"function"==typeof e,Yo=(e,t,r)=>{let n=-1;const a=Bo(t)?[t]:Ho(t),o=a.length,i=o-1;for(;++n<o;){const t=a[n];let o=r;if(n!==i){const r=e[t];o=Lo(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=o,e=e[t]}};const Xo="blur",Qo="focusout",ei="change",ti="onBlur",ri="onChange",ni="onSubmit",ai="onTouched",oi="all",ii="max",si="min",li="maxLength",ci="minLength",di="pattern",ui="required",fi="validate",pi=a.createContext(null);pi.displayName="HookFormControlContext";const mi=()=>a.useContext(pi);var hi=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const a=o;return t._proxyFormState[a]!==oi&&(t._proxyFormState[a]=!n||oi),r&&(r[a]=!0),e[a]}});return a};const gi="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;var bi=e=>"string"==typeof e,yi=(e,t,r,n,a)=>bi(e)?(n&&t.watch.add(e),Zo(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),Zo(r,e))):(n&&(t.watchAll=!0),r),vi=e=>Fo(e)||!zo(e);function wi(e,t,r=new WeakSet){if(vi(e)||vi(t))return Object.is(e,t);if(Mo(e)&&Mo(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 o of n){const n=e[o];if(!a.includes(o))return!1;if("ref"!==o){const e=t[o];if(Mo(n)&&Mo(e)||Lo(n)&&Lo(e)||Array.isArray(n)&&Array.isArray(e)?!wi(n,e,r):!Object.is(n,e))return!1}}return!0}function xi(e){const t=mi(),{name:r,disabled:n,control:o=t,shouldUnregister:i,defaultValue:s,exact:l=!0}=e,c=$o(o._names.array,r),d=a.useMemo(()=>Zo(o._formValues,r,Zo(o._defaultValues,r,s)),[o,r,s]),u=function(e){const t=mi(),{control:r=t,name:n,defaultValue:o,disabled:i,exact:s,compute:l}=e||{},c=a.useRef(o),d=a.useRef(l),u=a.useRef(void 0),f=a.useRef(r),p=a.useRef(n);d.current=l;const[m,h]=a.useState(()=>{const e=r._getWatch(n,c.current);return d.current?d.current(e):e}),g=a.useCallback(e=>{const t=yi(n,r._names,e||r._formValues,!1,c.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),b=a.useCallback(e=>{if(!i){const t=yi(n,r._names,e||r._formValues,!1,c.current);if(d.current){const e=d.current(t);wi(e,u.current)||(h(e),u.current=e)}else h(t)}},[r._formValues,r._names,i,n]);gi(()=>(f.current===r&&wi(p.current,n)||(f.current=r,p.current=n,b()),r._subscribe({name:n,formState:{values:!0},exact:s,callback:e=>{b(e.values)}})),[r,s,n,b]),a.useEffect(()=>r._removeUnmounted());const y=f.current!==r,v=p.current,w=a.useMemo(()=>{if(i)return null;const e=!y&&!wi(v,n);return y||e?g():null},[i,y,n,v,g]);return null!==w?w:m}({control:o,name:r,defaultValue:d,exact:l}),f=function(e){const t=mi(),{control:r=t,disabled:n,name:o,exact:i}=e||{},[s,l]=a.useState(r._formState),c=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return gi(()=>r._subscribe({name:o,formState:c.current,exact:i,callback:e=>{!n&&l({...r._formState,...e})}}),[o,n,i]),a.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),a.useMemo(()=>hi(s,r,c.current,!1),[s,r])}({control:o,name:r,exact:l}),p=a.useRef(e),m=a.useRef(void 0),h=a.useRef(o.register(r,{...e.rules,value:u,...qo(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Zo(f.errors,r)},isDirty:{enumerable:!0,get:()=>!!Zo(f.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Zo(f.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Zo(f.validatingFields,r)},error:{enumerable:!0,get:()=>Zo(f.errors,r)}}),[f,r]),b=a.useCallback(e=>h.current.onChange({target:{value:jo(e),name:r},type:ei}),[r]),y=a.useCallback(()=>h.current.onBlur({target:{value:Zo(o._formValues,r),name:r},type:Xo}),[r,o._formValues]),v=a.useCallback(e=>{const t=Zo(o._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>Jo(e.focus)&&e.focus(),select:()=>Jo(e.select)&&e.select(),setCustomValidity:t=>Jo(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Jo(e.reportValidity)&&e.reportValidity()})},[o._fields,r]),w=a.useMemo(()=>({name:r,value:u,...qo(n)||f.disabled?{disabled:f.disabled||n}:{},onChange:b,onBlur:y,ref:v}),[r,n,f.disabled,b,y,v,u]);return a.useEffect(()=>{const e=o._options.shouldUnregister||i,t=m.current;t&&t!==r&&!c&&o.unregister(t),o.register(r,{...p.current.rules,...qo(p.current.disabled)?{disabled:p.current.disabled}:{}});const n=(e,t)=>{const r=Zo(o._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){const e=Wo(Zo(o._options.defaultValues,r,p.current.defaultValue));Yo(o._defaultValues,r,e),Go(Zo(o._formValues,r))&&Yo(o._formValues,r,e)}return!c&&o.register(r),m.current=r,()=>{(c?e&&!o._state.action:e)?o.unregister(r):n(r,!1)}},[r,o,c,i]),a.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),a.useMemo(()=>({field:w,formState:f,fieldState:g}),[w,f,g])}const Si=e=>e.render(xi(e)),ki=a.createContext(null);ki.displayName="HookFormContext";const Ni=e=>{const{children:t,watch:r,getValues:n,getFieldState:o,setError:i,clearErrors:s,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}=e;return a.createElement(ki.Provider,{value:a.useMemo(()=>({watch:r,getValues:n,getFieldState:o,setError:i,clearErrors:s,setValue:l,trigger:c,formState:d,resetField:u,reset:f,handleSubmit:p,unregister:m,control:h,register:g,setFocus:b,subscribe:y}),[s,h,d,o,n,p,g,f,u,i,b,l,y,c,m,r])},a.createElement(pi.Provider,{value:h},t))};var Ei=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},Ci=e=>Array.isArray(e)?e:[e],Ai=()=>{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 _i(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],o=t[n];if(a&&Lo(a)&&o){const e=_i(a,o);Lo(e)&&(r[n]=e)}else e[n]&&(r[n]=o)}return r}var Ti=e=>Lo(e)&&!Object.keys(e).length,Ri=e=>"file"===e.type,Pi=e=>{if(!Vo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Oi=e=>"select-multiple"===e.type,Ii=e=>"radio"===e.type,Di=e=>Pi(e)&&e.isConnected;function Ui(e,t){const r=Array.isArray(t)?t:Bo(t)?[t]:Ho(t),n=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Go(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,o=r[a];return n&&delete n[o],0!==a&&(Lo(n)&&Ti(n)||Array.isArray(n)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Go(e[t]))return!1;return!0}(n))&&Ui(e,r.slice(0,-1)),e}function Mi(e){return Array.isArray(e)||Lo(e)&&!(e=>{for(const t in e)if(Jo(e[t]))return!0;return!1})(e)}function Fi(e,t={}){for(const r in e){const n=e[r];Mi(n)?(t[r]=Array.isArray(n)?[]:{},Fi(n,t[r])):Go(n)||(t[r]=!0)}return t}function zi(e,t,r){r||(r=Fi(t));for(const n in e){const a=e[n];if(Mi(a))Go(t)||vi(r[n])?r[n]=Fi(a,Array.isArray(a)?[]:{}):zi(a,Fo(t)?{}:t[n],r[n]);else{const e=t[n];r[n]=!wi(a,e)}}return r}const Li={value:!1,isValid:!1},ji={value:!0,isValid:!0};var $i=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&&!Go(e[0].attributes.value)?Go(e[0].value)||""===e[0].value?ji:{value:e[0].value,isValid:!0}:ji:Li}return Li},Vi=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Go(e)?e:t?""===e?NaN:e?+e:e:r&&bi(e)?new Date(e):n?n(e):e;const Wi={isValid:!1,value:null};var Bi=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Wi):Wi;function Gi(e){const t=e.ref;return Ri(t)?t.files:Ii(t)?Bi(e.refs).value:Oi(t)?[...t.selectedOptions].map(({value:e})=>e):Uo(t)?$i(e.refs).value:Vi(Go(t.value)?e.ref.value:t.value,e)}var Ki=e=>e instanceof RegExp,Hi=e=>Go(e)?e:Ki(e)?e.source:Lo(e)?Ki(e.value)?e.value.source:e.value:e,Zi=e=>({isOnSubmit:!e||e===ni,isOnBlur:e===ti,isOnChange:e===ri,isOnAll:e===oi,isOnTouch:e===ai});const qi="AsyncFunction";var Ji=e=>!!e&&!!e.validate&&!!(Jo(e.validate)&&e.validate.constructor.name===qi||Lo(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===qi)),Yi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Xi=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const r=Zo(e,a);if(r){const{_f:e,...o}=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(Xi(o,t))break}else if(Lo(o)&&Xi(o,t))break}}};function Qi(e,t,r){const n=Zo(e,r);if(n||Bo(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const n=a.join("."),o=Zo(t,n),i=Zo(e,n);if(o&&!Array.isArray(o)&&r!==n)return{name:r};if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var es=(e,t,r)=>{const n=Ci(Zo(e,r));return Yo(n,"root",t[r]),Yo(e,r,n),e};function ts(e,t,r="validate"){if(bi(e)||Array.isArray(e)&&e.every(bi)||qo(e)&&!e)return{type:r,message:bi(e)?e:"",ref:t}}var rs=e=>Lo(e)&&!Ki(e)?e:{value:e,message:""},ns=async(e,t,r,n,a,o)=>{const{ref:i,refs:s,required:l,maxLength:c,minLength:d,min:u,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:b}=e._f,y=Zo(r,h);if(!b||t.has(h))return{};const v=s?s[0]:i,w=e=>{a&&v.reportValidity&&(v.setCustomValidity(qo(e)?"":e||""),v.reportValidity())},x={},S=Ii(i),k=Uo(i),N=S||k,E=(g||Ri(i))&&Go(i.value)&&Go(y)||Pi(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,C=Ei.bind(null,h,n,x),A=(e,t,r,n=li,a=ci)=>{const o=e?t:r;x[h]={type:e?n:a,message:o,ref:i,...C(e?n:a,o)}};if(o?!Array.isArray(y)||!y.length:l&&(!N&&(E||Fo(y))||qo(y)&&!y||k&&!$i(s).isValid||S&&!Bi(s).isValid)){const{value:e,message:t}=bi(l)?{value:!!l,message:l}:rs(l);if(e&&(x[h]={type:ui,message:t,ref:v,...C(ui,t)},!n))return w(t),x}if(!(E||Fo(u)&&Fo(f))){let e,t;const r=rs(f),a=rs(u);if(Fo(y)||isNaN(y)){const n=i.valueAsDate||new Date(y),o=e=>new Date((new Date).toDateString()+" "+e),s="time"==i.type,l="week"==i.type;bi(r.value)&&y&&(e=s?o(y)>o(r.value):l?y>r.value:n>new Date(r.value)),bi(a.value)&&y&&(t=s?o(y)<o(a.value):l?y<a.value:n<new Date(a.value))}else{const n=i.valueAsNumber||(y?+y:y);Fo(r.value)||(e=n>r.value),Fo(a.value)||(t=n<a.value)}if((e||t)&&(A(!!e,r.message,a.message,ii,si),!n))return w(x[h].message),x}if((c||d)&&!E&&(bi(y)||o&&Array.isArray(y))){const e=rs(c),t=rs(d),r=!Fo(e.value)&&y.length>+e.value,a=!Fo(t.value)&&y.length<+t.value;if((r||a)&&(A(r,e.message,t.message),!n))return w(x[h].message),x}if(p&&!E&&bi(y)){const{value:e,message:t}=rs(p);if(Ki(e)&&!y.match(e)&&(x[h]={type:di,message:t,ref:i,...C(di,t)},!n))return w(t),x}if(m)if(Jo(m)){const e=ts(await m(y,r),v);if(e&&(x[h]={...e,...C(fi,e.message)},!n))return w(e.message),x}else if(Lo(m)){let e={};for(const t in m){if(!Ti(e)&&!n)break;const a=ts(await m[t](y,r),v,t);a&&(e={...a,...C(t,a.message)},w(a.message),n&&(x[h]=e))}if(!Ti(e)&&(x[h]={ref:v,...e},!n))return x}return w(!0),x};const as={mode:ni,reValidateMode:ri,shouldFocusError:!0};function os(e={}){let t,r={...as,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Jo(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},o=(Lo(r.defaultValues)||Lo(r.values))&&Wo(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:Wo(o),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=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:Ai(),state:Ai()},m=r.criteriaMode===oi,h=async e=>{if(!s.keepIsValid&&!r.disabled&&(u.isValid||f.isValid||e)){let e;r.resolver?(e=Ti((await w()).errors),g()):e=await x(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(l.mount)).forEach(e=>{e&&(t?Yo(n.validatingFields,e,t):Ui(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Ti(n.validatingFields)}))},b=(e,t,r,n)=>{const l=Zo(a,e);if(l){const a=Zo(i,e,Go(r)?Zo(o,e):r);Go(a)||n&&n.defaultChecked||t?Yo(i,e,t?a:Gi(l._f)):N(e,a),s.mount&&!s.action&&h()}},y=(e,t,a,i,s)=>{let l=!1,c=!1;const d={name:e};if(!r.disabled){if(!a||i){(u.isDirty||f.isDirty)&&(c=n.isDirty,n.isDirty=d.isDirty=S(),l=c!==d.isDirty);const r=wi(Zo(o,e),t);c=!!Zo(n.dirtyFields,e),r?Ui(n.dirtyFields,e):Yo(n.dirtyFields,e,!0),d.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||f.dirtyFields)&&c!==!r}if(a){const t=Zo(n.touchedFields,e);t||(Yo(n.touchedFields,e,a),d.touchedFields=n.touchedFields,l=l||(u.touchedFields||f.touchedFields)&&t!==a)}l&&s&&p.state.next(d)}return l?d:{}},v=(e,a,o,i)=>{const s=Zo(n.errors,e),l=(u.isValid||f.isValid)&&qo(a)&&n.isValid!==a;var d;if(r.delayError&&o?(d=()=>((e,t)=>{Yo(n.errors,e,t),p.state.next({errors:n.errors})})(e,o),t=e=>{clearTimeout(c),c=setTimeout(d,e)},t(r.delayError)):(clearTimeout(c),t=null,o?Yo(n.errors,e,o):Ui(n.errors,e)),(o?!wi(s,o):s)||!Ti(i)||l){const t={...i,...l&&qo(a)?{isValid:a}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{g(e,!0);const t=await r.resolver(i,r.context,((e,t,r,n)=>{const a={};for(const r of e){const e=Zo(t,r);e&&Yo(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation));return t},x=async(t,a,o={valid:!0})=>{for(const s in t){const c=t[s];if(c){const{_f:t,...s}=c;if(t){const s=l.array.has(t.name),d=c._f&&Ji(c._f);d&&u.validatingFields&&g([t.name],!0);const f=await ns(c,l.disabled,i,m,r.shouldUseNativeValidation&&!a,s);if(d&&u.validatingFields&&g([t.name]),f[t.name]&&(o.valid=!1,a||e.shouldUseNativeValidation))break;!a&&(Zo(f,t.name)?s?es(n.errors,f,t.name):Yo(n.errors,t.name,f[t.name]):Ui(n.errors,t.name))}!Ti(s)&&await x(s,a,o)}}return o.valid},S=(e,t)=>!r.disabled&&(e&&t&&Yo(i,e,t),!wi(R(),o)),k=(e,t,r)=>yi(e,l,{...s.mount?i:Go(t)?o:bi(e)?{[e]:t}:t},r,t),N=(e,t,r={})=>{const n=Zo(a,e);let o=t;if(n){const r=n._f;r&&(!r.disabled&&Yo(i,e,Vi(t,r)),o=Pi(r.ref)&&Fo(t)?"":t,Oi(r.ref)?[...r.ref.options].forEach(e=>e.selected=o.includes(e.value)):r.refs?Uo(r.ref)?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):r.refs.forEach(e=>e.checked=e.value===o):Ri(r.ref)?r.ref.value="":(r.ref.value=o,r.ref.type||p.state.next({name:e,values:Wo(i)})))}(r.shouldDirty||r.shouldTouch)&&y(e,o,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&T(e)},E=(e,t,r)=>{for(const n in t){if(!t.hasOwnProperty(n))return;const o=t[n],i=e+"."+n,s=Zo(a,i);(l.array.has(e)||Lo(o)||s&&!s._f)&&!Mo(o)?E(i,o,r):N(i,o,r)}},C=(e,t,r={})=>{const c=Zo(a,e),d=l.array.has(e),m=Wo(t);Yo(i,e,m),d?(p.array.next({name:e,values:Wo(i)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&r.shouldDirty&&p.state.next({name:e,dirtyFields:zi(o,i),isDirty:S(e,m)})):!c||c._f||Fo(m)?N(e,m,r):E(e,m,r),Yi(e,l)?p.state.next({...n,name:e,values:Wo(i)}):p.state.next({name:s.mount?e:void 0,values:Wo(i)})},A=async e=>{s.mount=!0;const o=e.target;let c=o.name,d=!0;const b=Zo(a,c),S=e=>{d=Number.isNaN(e)||Mo(e)&&isNaN(e.getTime())||wi(e,Zo(i,c,e))},k=Zi(r.mode),N=Zi(r.reValidateMode);if(b){let s,E;const C=o.type?Gi(b._f):jo(e),A=e.type===Xo||e.type===Qo,_=!(e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate))(b._f)&&!r.resolver&&!Zo(n.errors,c)&&!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))(A,Zo(n.touchedFields,c),n.isSubmitted,N,k),R=Yi(c,l,A);Yo(i,c,C),A?o&&o.readOnly||(b._f.onBlur&&b._f.onBlur(e),t&&t(0)):b._f.onChange&&b._f.onChange(e);const P=y(c,C,A),O=!Ti(P)||R;if(!A&&p.state.next({name:c,type:e.type,values:Wo(i)}),_)return(u.isValid||f.isValid)&&("onBlur"===r.mode?A&&h():A||h()),O&&p.state.next({name:c,...R?{}:P});if(!A&&R&&p.state.next({...n}),r.resolver){const{errors:e}=await w([c]);if(g([c]),S(C),d){const t=Qi(n.errors,a,c),r=Qi(e,a,t.name||c);s=r.error,c=r.name,E=Ti(e)}}else g([c],!0),s=(await ns(b,l.disabled,i,m,r.shouldUseNativeValidation))[c],g([c]),S(C),d&&(s?E=!1:(u.isValid||f.isValid)&&(E=await x(a,!0)));d&&(b._f.deps&&(!Array.isArray(b._f.deps)||b._f.deps.length>0)&&T(b._f.deps),v(c,E,s,P))}},_=(e,t)=>{if(Zo(n.errors,t)&&e.focus)return e.focus(),1},T=async(e,t={})=>{let o,i;const s=Ci(e);if(r.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(g(e),e)for(const r of e){const e=Zo(t,r);e?Yo(n.errors,r,e):Ui(n.errors,r)}else n.errors=t;return t})(Go(e)?e:s);o=Ti(t),i=e?!s.some(e=>Zo(t,e)):o}else e?(i=(await Promise.all(s.map(async e=>{const t=Zo(a,e);return await x(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||n.isValid)&&h()):i=o=await x(a);return p.state.next({...!bi(e)||(u.isValid||f.isValid)&&o!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:o}:{},errors:n.errors}),t.shouldFocus&&!i&&Xi(a,_,e?s:l.mount),i},R=(e,t)=>{let r={...s.mount?i:o};return t&&(r=_i(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),Go(e)?r:bi(e)?Zo(r,e):e.map(e=>Zo(r,e))},P=(e,t)=>({invalid:!!Zo((t||n).errors,e),isDirty:!!Zo((t||n).dirtyFields,e),error:Zo((t||n).errors,e),isValidating:!!Zo(n.validatingFields,e),isTouched:!!Zo((t||n).touchedFields,e)}),O=(e,t,r)=>{const o=(Zo(a,e,{_f:{}})._f||{}).ref,i=Zo(n.errors,e)||{},{ref:s,message:l,type:c,...d}=i;Yo(n.errors,e,{...d,...t,ref:o}),p.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&o&&o.focus&&o.focus()},I=e=>p.state.subscribe({next:t=>{var r,a,s;r=e.name,a=t.name,s=e.exact,r&&a&&r!==a&&!Ci(r).some(e=>e&&(s?e===a:e.startsWith(a)||a.startsWith(e)))||!((e,t,r,n)=>{r(e);const{name:a,...o}=e;return Ti(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!n||oi))})(t,e.formState||u,$,e.reRenderRoot)||e.callback({values:{...i},...n,...t,defaultValues:o})}}).unsubscribe,D=(e,t={})=>{for(const s of e?Ci(e):l.mount)l.mount.delete(s),l.array.delete(s),t.keepValue||(Ui(a,s),Ui(i,s)),!t.keepError&&Ui(n.errors,s),!t.keepDirty&&Ui(n.dirtyFields,s),!t.keepTouched&&Ui(n.touchedFields,s),!t.keepIsValidating&&Ui(n.validatingFields,s),!r.shouldUnregister&&!t.keepDefaultValue&&Ui(o,s);p.state.next({values:Wo(i)}),p.state.next({...n,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&h()},U=({disabled:e,name:t})=>{if(qo(e)&&s.mount||e||l.disabled.has(t)){const r=l.disabled.has(t)!==!!e;e?l.disabled.add(t):l.disabled.delete(t),r&&s.mount&&!s.action&&h()}},M=(e,t={})=>{let n=Zo(a,e);const i=qo(t.disabled)||qo(r.disabled);return Yo(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n?U({disabled:qo(t.disabled)?t.disabled:r.disabled,name:e}):b(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:Hi(t.min),max:Hi(t.max),minLength:Hi(t.minLength),maxLength:Hi(t.maxLength),pattern:Hi(t.pattern)}:{},name:e,onChange:A,onBlur:A,ref:i=>{if(i){M(e,t),n=Zo(a,e);const r=Go(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,s=(e=>Ii(e)||Uo(e))(r),l=n._f.refs||[];if(s?l.find(e=>e===r):r===n._f.ref)return;Yo(a,e,{_f:{...n._f,...s?{refs:[...l.filter(Di),r,...Array.isArray(Zo(o,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),b(e,!1,void 0,r)}else n=Zo(a,e,{}),n._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!$o(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>r.shouldFocusError&&Xi(a,_,l.mount),z=(e,t)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=Wo(i);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await w();g(),n.errors=e,c=Wo(t)}else await x(a);if(l.disabled.size)for(const e of l.disabled)Ui(c,e);if(Ui(n.errors,"root"),Ti(n.errors)){p.state.next({errors:{}});try{await e(c,o)}catch(e){s=e}}else t&&await t({...n.errors},o),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ti(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},L=(e,t={})=>{const c=e?Wo(e):o,d=Wo(c),f=Ti(e),m=f?o:d;if(t.keepDefaultValues||(o=c),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(zi(o,i))]);for(const t of Array.from(e)){const e=Zo(n.dirtyFields,t),r=Zo(i,t),a=Zo(m,t);e&&!Go(r)?Yo(m,t,r):e||Go(a)||C(t,a)}}else{if(Vo&&Go(e))for(const e of l.mount){const t=Zo(a,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Pi(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of l.mount)C(e,Zo(m,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?Wo(o):{}:Wo(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!Ti(m),s.watch=!!r.shouldUnregister,s.keepIsValid=!!t.keepIsValid,s.action=!1,t.keepErrors||(n.errors={}),p.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!f&&(t.keepDirty?n.isDirty:!(!t.keepDefaultValues||wi(e,o))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:t.keepDirtyValues?t.keepDefaultValues&&i?zi(o,i):n.dirtyFields:t.keepDefaultValues&&e?zi(o,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:o})},j=(e,t)=>L(Jo(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},V={control:{register:M,unregister:D,getFieldState:P,handleSubmit:z,setError:O,_subscribe:I,_runSchema:w,_updateIsValidating:g,_focusError:F,_getWatch:k,_getDirty:S,_setValid:h,_setFieldArray:(e,t=[],l,c,d=!0,m=!0)=>{if(c&&l&&!r.disabled){if(s.action=!0,m&&Array.isArray(Zo(a,e))){const t=l(Zo(a,e),c.argA,c.argB);d&&Yo(a,e,t)}if(m&&Array.isArray(Zo(n.errors,e))){const t=l(Zo(n.errors,e),c.argA,c.argB);d&&Yo(n.errors,e,t),((e,t)=>{!Ko(Zo(e,t)).length&&Ui(e,t)})(n.errors,e)}if((u.touchedFields||f.touchedFields)&&m&&Array.isArray(Zo(n.touchedFields,e))){const t=l(Zo(n.touchedFields,e),c.argA,c.argB);d&&Yo(n.touchedFields,e,t)}(u.dirtyFields||f.dirtyFields)&&(n.dirtyFields=zi(o,i)),p.state.next({name:e,isDirty:S(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Yo(i,e,t)},_setDisabledField:U,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ko(Zo(s.mount?i:o,e,r.shouldUnregister?Zo(o,e,[]):[])),_reset:L,_resetDefaultValues:()=>Jo(r.defaultValues)&&r.defaultValues().then(e=>{j(e,r.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=Zo(a,e);t&&(t._f.refs?t._f.refs.every(e=>!Di(e)):!Di(t._f.ref))&&D(e)}l.unMount=new Set},_disableForm:e=>{qo(e)&&(p.state.next({disabled:e}),Xi(a,(t,r)=>{const n=Zo(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 i},get _state(){return s},set _state(e){s=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return r},set _options(e){r={...r,...e}}},subscribe:e=>(s.mount=!0,f={...f,...e.formState},I({...e,formState:{...d,...e.formState}})),trigger:T,register:M,handleSubmit:z,watch:(e,t)=>Jo(e)?p.state.subscribe({next:r=>"values"in r&&e(k(void 0,t),r)}):k(e,t,!0),setValue:C,getValues:R,reset:j,resetField:(e,t={})=>{Zo(a,e)&&(Go(t.defaultValue)?C(e,Wo(Zo(o,e))):(C(e,t.defaultValue),Yo(o,e,Wo(t.defaultValue))),t.keepTouched||Ui(n.touchedFields,e),t.keepDirty||(Ui(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Wo(Zo(o,e))):S()),t.keepError||(Ui(n.errors,e),u.isValid&&h()),p.state.next({...n}))},clearErrors:e=>{e&&Ci(e).forEach(e=>Ui(n.errors,e)),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:O,setFocus:(e,t={})=>{const r=Zo(a,e),n=r&&r._f;if(n){const e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Jo(e.select)&&e.select()})}},getFieldState:P};return{...V,formControl:V}}function is(e={}){const t=a.useRef(void 0),r=a.useRef(void 0),[n,o]=a.useState({isDirty:!1,isValidating:!1,isLoading:Jo(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:Jo(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Jo(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:r,...a}=os(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,gi(()=>{const e=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),i._formState.isReady=!0,e},[i]),a.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),a.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),a.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),a.useEffect(()=>{if(i._proxyFormState.isDirty){const e=i._getDirty();e!==n.isDirty&&i._subjects.state.next({isDirty:e})}},[i,n.isDirty]),a.useEffect(()=>{var t;e.values&&!wi(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),(null===(t=i._options.resetOptions)||void 0===t?void 0:t.keepIsValid)||i._setValid(),r.current=e.values,o(e=>({...e}))):i._resetDefaultValues()},[i,e.values]),a.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=a.useMemo(()=>hi(n,i),[i,n]),t.current}const ss=(e,t,r)=>{if(e&&"reportValidity"in e){const n=Zo(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},ls=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?ss(n.ref,r,e):n&&n.refs&&n.refs.forEach(t=>ss(t,r,e))}},cs=(e,t)=>{t.shouldUseNativeValidation&&ls(e,t);const r={};for(const n in e){const a=Zo(t.fields,n),o=Object.assign(e[n]||{},{ref:a&&a.ref});if(ds(t.names||Object.keys(e),n)){const e=Object.assign({},Zo(r,n));Yo(e,"root",o),Yo(r,n,e)}else Yo(r,n,o)}return r},ds=(e,t)=>{const r=us(t);return e.some(e=>us(e).match(`^${r}\\.\\d+`))};function us(e){return e.replace(/\]|\[/g,"")}function fs(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:i,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const a=i.prototype,o=Object.keys(a);for(let e=0;e<o.length;e++){const t=o[e];t in r||(r[t]=a[t].bind(r))}}const a=r?.Parent??Object;class o extends a{}function i(e){var t;const a=r?.Parent?new o:this;n(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ps extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ms extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const hs={};function gs(e){return hs}function bs(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 ys(e,t){return"bigint"==typeof t?t.toString():t}function vs(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ws(e){return null==e}function xs(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Ss=Symbol("evaluating");function ks(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ss)return void 0===n&&(n=Ss,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Ns(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Es(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function Cs(e){return JSON.stringify(e)}const As="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _s(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Ts=vs(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Rs(e){if(!1===_s(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!==_s(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function Ps(e){return Rs(e)?{...e}:Array.isArray(e)?[...e]:e}const Os=new Set(["string","number","symbol"]);function Is(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ds(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Us(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 Ms(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 Fs(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function zs(e){return"string"==typeof e?e:e?.message}function Ls(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const a=zs(e.inst?._zod.def?.error?.(e))??zs(t?.error?.(e))??zs(r.customError?.(e))??zs(r.localeError?.(e))??"Invalid input";n.message=a}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function js(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function $s(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const Vs=(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,ys,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ws=fs("$ZodError",Vs),Bs=fs("$ZodError",Vs,{Parent:Error});const Gs=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ps;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ls(e,o,gs())));throw As(t,a?.callee),t}return i.value},Ks=Gs(Bs),Hs=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map(e=>Ls(e,o,gs())));throw As(t,a?.callee),t}return i.value},Zs=Hs(Bs),qs=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new ps;return o.issues.length?{success:!1,error:new(e??Ws)(o.issues.map(e=>Ls(e,a,gs())))}:{success:!0,data:o.value}},Js=qs(Bs),Ys=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>Ls(e,a,gs())))}:{success:!0,data:o.value}},Xs=Ys(Bs),Qs=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Gs(e)(t,r,a)},el=e=>(t,r,n)=>Gs(e)(t,r,n),tl=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hs(e)(t,r,a)},rl=e=>async(t,r,n)=>Hs(e)(t,r,n),nl=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qs(e)(t,r,a)},al=e=>(t,r,n)=>qs(e)(t,r,n),ol=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ys(e)(t,r,a)},il=e=>async(t,r,n)=>Ys(e)(t,r,n),sl=/^[cC][^\s-]{8,}$/,ll=/^[0-9a-z]+$/,cl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dl=/^[0-9a-vA-V]{20}$/,ul=/^[A-Za-z0-9]{27}$/,fl=/^[a-zA-Z0-9_-]{21}$/,pl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ml=/^([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})$/,hl=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)$/,gl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const bl=/^(?:(?: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])$/,yl=/^(([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}|:))$/,vl=/^((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])$/,wl=/^(([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])$/,xl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sl=/^[A-Za-z0-9_-]*$/,kl=/^\+[1-9]\d{6,14}$/,Nl="(?:(?:\\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])))",El=new RegExp(`^${Nl}$`);function Cl(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 Al=/^[^A-Z]*$/,_l=/^[^a-z]*$/,Tl=fs("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Rl=fs("$ZodCheckMaxLength",(e,t)=>{var r;Tl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ws(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=js(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Pl=fs("$ZodCheckMinLength",(e,t)=>{var r;Tl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ws(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=js(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ol=fs("$ZodCheckLengthEquals",(e,t)=>{var r;Tl.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!ws(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 o=js(n),i=a>t.length;r.issues.push({origin:o,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Il=fs("$ZodCheckStringFormat",(e,t)=>{var r,n;Tl.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=()=>{})}),Dl=fs("$ZodCheckRegex",(e,t)=>{Il.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})}}),Ul=fs("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Al),Il.init(e,t)}),Ml=fs("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_l),Il.init(e,t)}),Fl=fs("$ZodCheckIncludes",(e,t)=>{Tl.init(e,t);const r=Is(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})}}),zl=fs("$ZodCheckStartsWith",(e,t)=>{Tl.init(e,t);const r=new RegExp(`^${Is(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})}}),Ll=fs("$ZodCheckEndsWith",(e,t)=>{Tl.init(e,t);const r=new RegExp(`.*${Is(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})}}),jl=fs("$ZodCheckOverwrite",(e,t)=>{Tl.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class $l{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 Vl={major:4,minor:3,patch:6},Wl=fs("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vl;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=Ms(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=o._zod.check(e);if(i instanceof Promise&&!1===r?.async)throw new ps;if(n||i instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(a||(a=Ms(e,t)))});else{if(e.issues.length===t)continue;a||(a=Ms(e,t))}}return n?n.then(()=>e):e},r=(r,a,o)=>{if(Ms(r))return r.aborted=!0,r;const i=t(a,n,o);if(i instanceof Promise){if(!1===o.async)throw new ps;return i.then(t=>e._zod.parse(t,o))}return e._zod.parse(i,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if("backward"===o.direction){const t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,a,o)):r(t,a,o)}const i=e._zod.parse(a,o);if(i instanceof Promise){if(!1===o.async)throw new ps;return i.then(e=>t(e,n,o))}return t(i,n,o)}}ks(e,"~standard",()=>({validate:t=>{try{const r=Js(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Xs(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Bl=fs("$ZodString",(e,t)=>{var r;Wl.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}}),Gl=fs("$ZodStringFormat",(e,t)=>{Il.init(e,t),Bl.init(e,t)}),Kl=fs("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ml),Gl.init(e,t)}),Hl=fs("$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=hl(e))}else t.pattern??(t.pattern=hl());Gl.init(e,t)}),Zl=fs("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gl),Gl.init(e,t)}),ql=fs("$ZodURL",(e,t)=>{Gl.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})}}}),Jl=fs("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Gl.init(e,t)}),Yl=fs("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fl),Gl.init(e,t)}),Xl=fs("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sl),Gl.init(e,t)}),Ql=fs("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ll),Gl.init(e,t)}),ec=fs("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cl),Gl.init(e,t)}),tc=fs("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dl),Gl.init(e,t)}),rc=fs("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ul),Gl.init(e,t)}),nc=fs("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Cl({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(`^${Nl}T(?:${n})$`)}(t)),Gl.init(e,t)}),ac=fs("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=El),Gl.init(e,t)}),oc=fs("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Cl(t)}$`)),Gl.init(e,t)}),ic=fs("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pl),Gl.init(e,t)}),sc=fs("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bl),Gl.init(e,t),e._zod.bag.format="ipv4"}),lc=fs("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=yl),Gl.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})}}}),cc=fs("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vl),Gl.init(e,t)}),dc=fs("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wl),Gl.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 uc(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const fc=fs("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=xl),Gl.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{uc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const pc=fs("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Sl),Gl.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!Sl.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return uc(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})}}),mc=fs("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kl),Gl.init(e,t)});const hc=fs("$ZodJWT",(e,t)=>{Gl.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})}}),gc=fs("$ZodUnknown",(e,t)=>{Wl.init(e,t),e._zod.parse=e=>e}),bc=fs("$ZodNever",(e,t)=>{Wl.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function yc(e,t,r){e.issues.length&&t.issues.push(...Fs(r,e.issues)),t.value[r]=e.value}const vc=fs("$ZodArray",(e,t)=>{Wl.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 o=[];for(let e=0;e<a.length;e++){const i=a[e],s=t.element._zod.run({value:i,issues:[]},n);s instanceof Promise?o.push(s.then(t=>yc(t,r,e))):yc(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function wc(e,t,r,n,a){if(e.issues.length){if(a&&!(r in n))return;t.issues.push(...Fs(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function xc(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 Sc(e,t,r,n,a,o){const i=[],s=a.keySet,l=a.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const a in t){if(s.has(a))continue;if("never"===c){i.push(a);continue}const o=l.run({value:t[a],issues:[]},n);o instanceof Promise?e.push(o.then(e=>wc(e,r,a,t,d))):wc(o,r,a,t,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const kc=fs("$ZodObject",(e,t)=>{Wl.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=vs(()=>xc(t));ks(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=_s,o=t.catchall;let i;e._zod.parse=(t,r)=>{i??(i=n.value);const s=t.value;if(!a(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const l=[],c=i.shape;for(const e of i.keys){const n=c[e],a="optional"===n._zod.optout,o=n._zod.run({value:s[e],issues:[]},r);o instanceof Promise?l.push(o.then(r=>wc(r,t,e,s,a))):wc(o,t,e,s,a)}return o?Sc(l,s,t,r,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Nc=fs("$ZodObjectJIT",(e,t)=>{kc.init(e,t);const r=e._zod.parse,n=vs(()=>xc(t));let a;const o=_s,i=!hs.jitless,s=i&&Ts.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=n.value);const f=d.value;return o(f)?i&&s&&!1===u?.async&&!0!==u.jitless?(a||(a=(e=>{const t=new $l(["shape","payload","ctx"]),r=n.value,a=e=>{const t=Cs(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let i=0;for(const e of r.keys)o[e]="key_"+i++;t.write("const newResult = {};");for(const n of r.keys){const r=o[n],i=Cs(n),s=e[n],l="optional"===s?._zod?.optout;t.write(`const ${r} = ${a(n)};`),l?t.write(`\n if (${r}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${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 ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=a(d,u),l?Sc([],f,d,u,c,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function Ec(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=>!Ms(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=>Ls(e,n,gs())))}),t)}const Cc=fs("$ZodUnion",(e,t)=>{Wl.init(e,t),ks(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ks(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ks(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ks(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=>xs(e.source)).join("|")})$`)}});const r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(a,o)=>{if(r)return n(a,o);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},o);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>Ec(t,a,e,o)):Ec(s,a,e,o)}}),Ac=fs("$ZodIntersection",(e,t)=>{Wl.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,a=t.left._zod.run({value:n,issues:[]},r),o=t.right._zod.run({value:n,issues:[]},r);return a instanceof Promise||o instanceof Promise?Promise.all([a,o]).then(([t,r])=>Tc(e,t,r)):Tc(e,a,o)}});function _c(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(Rs(e)&&Rs(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=_c(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=_c(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 Tc(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 o=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&a&&e.issues.push({...a,keys:o}),Ms(e))return e;const i=_c(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Rc=fs("$ZodEnum",(e,t)=>{Wl.init(e,t);const r=bs(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>Os.has(typeof e)).map(e=>"string"==typeof e?Is(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const o=t.value;return n.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Pc=fs("$ZodTransform",(e,t)=>{Wl.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new ms(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 ps;return r.value=a,r}});function Oc(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Ic=fs("$ZodOptional",(e,t)=>{Wl.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ks(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ks(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xs(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=>Oc(t,e.value)):Oc(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Dc=fs("$ZodExactOptional",(e,t)=>{Ic.init(e,t),ks(e._zod,"values",()=>t.innerType._zod.values),ks(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Uc=fs("$ZodNullable",(e,t)=>{Wl.init(e,t),ks(e._zod,"optin",()=>t.innerType._zod.optin),ks(e._zod,"optout",()=>t.innerType._zod.optout),ks(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${xs(e.source)}|null)$`):void 0}),ks(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)}),Mc=fs("$ZodDefault",(e,t)=>{Wl.init(e,t),e._zod.optin="optional",ks(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=>Fc(e,t)):Fc(n,t)}});function Fc(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const zc=fs("$ZodPrefault",(e,t)=>{Wl.init(e,t),e._zod.optin="optional",ks(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))}),Lc=fs("$ZodNonOptional",(e,t)=>{Wl.init(e,t),ks(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=>jc(t,e)):jc(a,e)}});function jc(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 $c=fs("$ZodCatch",(e,t)=>{Wl.init(e,t),ks(e._zod,"optin",()=>t.innerType._zod.optin),ks(e._zod,"optout",()=>t.innerType._zod.optout),ks(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=>Ls(e,r,gs()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>Ls(e,r,gs()))},input:e.value}),e.issues=[]),e)}}),Vc=fs("$ZodPipe",(e,t)=>{Wl.init(e,t),ks(e._zod,"values",()=>t.in._zod.values),ks(e._zod,"optin",()=>t.in._zod.optin),ks(e._zod,"optout",()=>t.out._zod.optout),ks(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=>Wc(e,t.in,r)):Wc(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Wc(e,t.out,r)):Wc(n,t.out,r)}});function Wc(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Bc=fs("$ZodReadonly",(e,t)=>{Wl.init(e,t),ks(e._zod,"propValues",()=>t.innerType._zod.propValues),ks(e._zod,"values",()=>t.innerType._zod.values),ks(e._zod,"optin",()=>t.innerType?._zod?.optin),ks(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(Gc):Gc(n)}});function Gc(e){return e.value=Object.freeze(e.value),e}const Kc=fs("$ZodCustom",(e,t)=>{Tl.init(e,t),Wl.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=>Hc(t,r,n,e));Hc(a,r,n,e)}});function Hc(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($s(e))}}var Zc;class qc{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)}}(Zc=globalThis).__zod_globalRegistry??(Zc.__zod_globalRegistry=new qc);const Jc=globalThis.__zod_globalRegistry;function Yc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Us(t)})}function Xc(e,t){return new Rl({check:"max_length",...Us(t),maximum:e})}function Qc(e,t){return new Pl({check:"min_length",...Us(t),minimum:e})}function ed(e,t){return new Ol({check:"length_equals",...Us(t),length:e})}function td(e){return new jl({check:"overwrite",tx:e})}function rd(e){const t=function(e,t){const r=new Tl({check:"custom",...Us(t)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push($s(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($s(n))}},e(r.value,r)));return t}function nd(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??Jc,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 ad(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,o=t.seen.get(e);if(o){o.count++;return r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema}const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,n);else{const r=i.schema,o=t.processors[a.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);o(e,t,r,n)}const o=e._zod.parent;o&&(i.ref||(i.ref=o),ad(o,t,n),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(i.schema,l),"input"===t.io&&sd(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function od(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:o}=(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 o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${a("__shared")}#/${n}/${o}`}}if(t[1]===r)return{ref:"#"};const a=`#/${n}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:a+o}})(t);n.def={...n.schema},o&&(n.defId=o);const i=n.schema;for(const e in i)delete i[e];i.$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 o=e.metadataRegistry.get(r[0])?.id;o?a(r):(n.cycle||n.count>1&&"ref"===e.reused)&&a(r)}}function id(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,o={...a},i=r.ref;if(r.ref=null,i){n(i);const r=e.seen.get(i),s=r.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,s):(a.allOf=a.allOf??[],a.allOf.push(s)),Object.assign(a,o);if(t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in o||delete a[e]);if(s.$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 s=t._zod.parent;if(s&&s!==i){n(s);const t=e.seen.get(s);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 o=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?a.$defs=o:a.definitions=o);try{const r=JSON.parse(JSON.stringify(a));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ld(t,"input",e.processors),output:ld(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(e){throw new Error("Error converting schema to JSON.")}}function sd(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 sd(n.element,r);if("set"===n.type)return sd(n.valueType,r);if("lazy"===n.type)return sd(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 sd(n.innerType,r);if("intersection"===n.type)return sd(n.left,r)||sd(n.right,r);if("record"===n.type||"map"===n.type)return sd(n.keyType,r)||sd(n.valueType,r);if("pipe"===n.type)return sd(n.in,r)||sd(n.out,r);if("object"===n.type){for(const e in n.shape)if(sd(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(sd(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(sd(e,r))return!0;return!(!n.rest||!sd(n.rest,r))}return!1}const ld=(e,t,r={})=>n=>{const{libraryOptions:a,target:o}=n??{},i=nd({...a??{},target:o,io:t,processors:r});return ad(e,i),od(i,e),id(i,e)},cd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dd=(e,t,r,n)=>{const a=e._zod.def;ad(a.innerType,t,n);t.seen.get(e).ref=a.innerType};function ud(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function fd(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var l=r[i].types,c=l&&l[n.code];r[i]=Ei(i,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function pd(e,t){for(var r={};e.length;){var n=e[0],a=n.code,o=n.message,i=n.path.join(".");if(!r[i])if("invalid_union"===n.code&&n.errors.length>0){var s=n.errors[0][0];r[i]={message:s.message,type:s.code}}else r[i]={message:o,type:a};if("invalid_union"===n.code&&n.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var l=r[i].types,c=l&&l[n.code];r[i]=Ei(i,t,r,a,c?[].concat(c,n.message):n.message)}e.shift()}return r}function md(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,o){try{return Promise.resolve(ud(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then(function(e){return o.shouldUseNativeValidation&&ls({},o),{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:cs(fd(e.errors,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return"_zod"in e&&"object"==typeof e._zod}(e))return function(n,a,o){try{return Promise.resolve(ud(function(){return Promise.resolve(("sync"===r.mode?Ks:Zs)(e,n,t)).then(function(e){return o.shouldUseNativeValidation&&ls({},o),{errors:{},values:r.raw?Object.assign({},n):e}})},function(e){if(function(e){return e instanceof Ws}(e))return{values:{},errors:cs(pd(e.issues,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)};throw e}))}catch(e){return Promise.reject(e)}};throw new Error("Invalid input: not a Zod schema")}function hd(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function gd(...e){return t=>{let r=!1;const n=e.map(e=>{const n=hd(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():hd(e[t],null)}}}}function bd(...e){return n.useCallback(gd(...e),e)}var yd=Symbol.for("react.lazy"),vd=n[" use ".trim().toString()];function wd(e){return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===yd&&"_payload"in e&&("object"==typeof(t=e._payload)&&null!==t&&"then"in t);var t}function xd(e){const r=kd(e),a=n.forwardRef((e,a)=>{let{children:o,...i}=e;wd(o)&&"function"==typeof vd&&(o=vd(o._payload));const s=n.Children.toArray(o),l=s.find(Ed);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}var Sd=xd("Slot");function kd(e){const t=n.forwardRef((e,t)=>{let{children:r,...a}=e;if(wd(r)&&"function"==typeof vd&&(r=vd(r._payload)),n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nd=Symbol("radix.slottable");function Ed(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Nd}const Cd=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,Ad=N,_d=(e,t)=>r=>{var n;if(null==(null==t?void 0:t.variants))return Ad(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(e=>{const t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;const i=Cd(t)||Cd(n);return a[e][i]}),s=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{}),l=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({...o,...s}[t]):{...o,...s}[t]===r})?[...e,r,n]:e},[]);return Ad(e,i,l,null==r?void 0:r.class,null==r?void 0:r.className)},Td=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rd=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)},Pd=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),Od=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 _d={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 Id={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 Td=g(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},c)=>b("svg",{ref:c,..._d,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:Cd("lucide",a),...!o&&!Ad(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>b(e,t)),...Array.isArray(o)?o:[o]])),Rd=(e,t)=>{const r=g(({className:r,...n},a)=>b(Td,{ref:a,iconNode:t,className:Cd(`lucide-${Nd(Ed(e))}`,`lucide-${e}`,r),...n}));return r.displayName=Ed(e),r},Pd=Rd("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"}]]),Od=Rd("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"}]]),Id=Rd("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),Dd=Rd("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),Ud=Rd("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),Fd=Rd("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"}]]),zd=Rd("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"}]]),Md=Rd("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=Rd("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"}]]),jd=Rd("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"}]]),$d=Rd("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Vd=Rd("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Wd=Rd("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"}]]),Bd=Rd("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Gd=Rd("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Kd=Rd("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"}]]),Hd=Rd("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"}]]),Zd=Rd("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),qd=Rd("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"}]]),Jd=Rd("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"}]]),Yd=Rd("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"}]]),Xd=Rd("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"}]]),Qd=Rd("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"}]]),eu=kd("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"}}),tu=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:c,asChild:l=!1,...d},u)=>{const f=l?bd:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:je(eu({variant:a,size:i,withIcon:null!=o||null!=s||null!=c,className:r})),ref:u,...d,children:[o&&t($d,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,c&&n.cloneElement(c,{size:p})]})});
14
+ */const Dd=g(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:i,...s},l)=>b("svg",{ref:l,...Id,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:Pd("lucide",a),...!o&&!Od(s)&&{"aria-hidden":"true"},...s},[...i.map(([e,t])=>b(e,t)),...Array.isArray(o)?o:[o]])),Ud=(e,t)=>{const r=g(({className:r,...n},a)=>b(Dd,{ref:a,iconNode:t,className:Pd(`lucide-${Td(Rd(e))}`,`lucide-${e}`,r),...n}));return r.displayName=Rd(e),r},Md=Ud("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"}]]),Fd=Ud("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"}]]),zd=Ud("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),Ld=Ud("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),jd=Ud("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]),$d=Ud("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"}]]),Vd=Ud("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"}]]),Wd=Ud("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"}]]),Bd=Ud("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"}]]),Gd=Ud("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"}]]),Kd=Ud("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Hd=Ud("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Zd=Ud("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"}]]),qd=Ud("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),Jd=Ud("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Yd=Ud("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"}]]),Xd=Ud("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"}]]),Qd=Ud("toggle-right",[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),eu=Ud("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"}]]),tu=Ud("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"}]]),ru=Ud("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"}]]),nu=Ud("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"}]]),au=Ud("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"}]]),ou=_d("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"}}),iu=n.forwardRef(({className:r,variant:a,progress:o,size:i,startIcon:s,endIcon:l,asChild:c=!1,...d},u)=>{const f=c?Sd:"button",p=function(e){switch(e){case"lg":return 20;case"sm":return 14;default:return 16}}(i);return e(f,{disabled:o||d.disabled,className:je(ou({variant:a,size:i,withIcon:null!=o||null!=s||null!=l,className:r})),ref:u,...d,children:[o&&t(Kd,{size:p,className:"animate-spin"}),s&&n.cloneElement(s,{size:p}),d.children,l&&n.cloneElement(l,{size:p})]})});
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
- */tu.displayName="Button";var ru=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=gd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),nu=n.forwardRef((e,r)=>t(ru.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));nu.displayName="Label";var au=nu;const ou=kd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),iu=n.forwardRef(({className:e,...r},n)=>t(au,{ref:n,className:je(ou(),e),...r}));iu.displayName=au.displayName;const su=vi,cu=n.createContext({}),lu=({...e})=>t(cu.Provider,{value:{name:e.name},children:t(bi,{...e})}),du=()=>{const e=n.useContext(cu),t=n.useContext(uu),{getFieldState:r,formState:o}=a.useContext(yi),i=r(e.name,o);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},uu=n.createContext({}),fu=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(uu.Provider,{value:{id:o},children:t("div",{ref:a,className:je("space-y-2",e),...r})})});fu.displayName="FormItem";const pu=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=du();return t(iu,{ref:n,className:je(a&&"text-destructive",e),htmlFor:o,...r})});pu.displayName="FormLabel";const mu=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=du();return t(bd,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});mu.displayName="FormControl";const hu=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=du();return t("p",{ref:n,id:a,className:je("text-sm text-muted-foreground",e),...r})});hu.displayName="FormDescription";const gu=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=du(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:je("text-sm font-medium text-destructive",e),...n,children:s}):null});gu.displayName="FormMessage";const bu=n.forwardRef(({className:e,type:r,...n},a)=>t("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",e),ref:a,...n}));function yu({className:e,...r}){return t("div",{className:je("animate-pulse rounded-md bg-primary/10",e),...r})}bu.displayName="Input";class vu extends dr{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 wu=class{constructor(e){this.api=new vu(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),o=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:o}})}};const xu=ss("ZodISODateTime",(e,t)=>{Xc.init(e,t),Ku.init(e,t)});function Su(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Rs(t)})}(xu,e)}const ku=ss("ZodISODate",(e,t)=>{Qc.init(e,t),Ku.init(e,t)});function Nu(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Rs(t)})}(ku,e)}const Eu=ss("ZodISOTime",(e,t)=>{el.init(e,t),Ku.init(e,t)});function Cu(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Rs(t)})}(Eu,e)}const Au=ss("ZodISODuration",(e,t)=>{tl.init(e,t),Ku.init(e,t)});function _u(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Rs(t)})}(Au,e)}const Tu=ss("ZodError",(e,t)=>{Ms.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,ps,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Ru=js(Tu),Pu=Vs(Tu),Ou=Bs(Tu),Iu=Ks(Tu),Du=Zs(Tu),Uu=qs(Tu),Fu=Js(Tu),zu=Ys(Tu),Mu=Xs(Tu),Lu=Qs(Tu),ju=ec(Tu),$u=tc(Tu),Vu=ss("ZodType",(e,t)=>(Mc.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:nd(e,"input"),output:nd(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=Xl({...r,processors:t});return Ql(e,n),ed(n,e),td(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ws(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)=>Ts(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Ru(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Ou(e,t,r),e.parseAsync=async(t,r)=>Pu(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Iu(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Du(e,t,r),e.decode=(t,r)=>Uu(e,t,r),e.encodeAsync=async(t,r)=>Fu(e,t,r),e.decodeAsync=async(t,r)=>zu(e,t,r),e.safeEncode=(t,r)=>Mu(e,t,r),e.safeDecode=(t,r)=>Lu(e,t,r),e.safeEncodeAsync=async(t,r)=>ju(e,t,r),e.safeDecodeAsync=async(t,r)=>$u(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,...Rs(r)})}(Ff,e,t)}(t,r)),e.superRefine=t=>e.check(Yl(t)),e.overwrite=t=>e.check(Jl(t)),e.optional=()=>Ef(e),e.exactOptional=()=>new Cf({type:"optional",innerType:e}),e.nullable=()=>_f(e),e.nullish=()=>Ef(_f(e)),e.nonoptional=t=>function(e,t){return new Pf({type:"nonoptional",innerType:e,...Rs(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...Rs(r)})}(bf,e,t);var t},e.or=t=>function(e,t){return new wf({type:"union",options:e,...Rs(t)})}([e,t]),e.and=t=>new xf({type:"intersection",left:e,right:t}),e.transform=t=>Df(e,new kf({type:"transform",transform:t})),e.default=t=>{return r=t,new Tf({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():Cs(r)}});var r},e.prefault=t=>{return r=t,new Rf({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():Cs(r)}});var r},e.catch=t=>{return new Of({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Df(e,t),e.readonly=()=>new Uf({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)),Wu=ss("_ZodString",(e,t)=>{Lc.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=ad[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),c&&(n.contentEncoding=c),s&&s.size>0){const e=[...s];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 Tc({check:"string_format",format:"regex",...Rs(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Oc({check:"string_format",format:"includes",...Rs(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ic({check:"string_format",format:"starts_with",...Rs(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Dc({check:"string_format",format:"ends_with",...Rs(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Zl(...t)),e.max=(...t)=>e.check(Hl(...t)),e.length=(...t)=>e.check(ql(...t)),e.nonempty=(...t)=>e.check(Zl(1,...t)),e.lowercase=t=>e.check(function(e){return new Rc({check:"string_format",format:"lowercase",...Rs(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Pc({check:"string_format",format:"uppercase",...Rs(e)})}(t)),e.trim=()=>e.check(Jl(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Jl(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Jl(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Jl(e=>e.toUpperCase())),e.slugify=()=>e.check(Jl(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Bu=ss("ZodString",(e,t)=>{Lc.init(e,t),Wu.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Rs(t)})}(Hu,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Rs(t)})}(Ju,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Rs(t)})}(ff,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Rs(t)})}(Yu,t)),e.guid=t=>e.check(Kl(Zu,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Rs(t)})}(qu,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Rs(t)})}(qu,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Rs(t)})}(qu,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Rs(t)})}(qu,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Rs(t)})}(Xu,t)),e.guid=t=>e.check(Kl(Zu,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Rs(t)})}(Qu,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Rs(t)})}(ef,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Rs(t)})}(tf,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Rs(t)})}(lf,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Rs(t)})}(df,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Rs(t)})}(rf,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Rs(t)})}(nf,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Rs(t)})}(af,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Rs(t)})}(of,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Rs(t)})}(sf,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Rs(t)})}(cf,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Rs(t)})}(uf,t)),e.datetime=t=>e.check(Su(t)),e.date=t=>e.check(Nu(t)),e.time=t=>e.check(Cu(t)),e.duration=t=>e.check(_u(t))});function Gu(e){return function(e,t){return new e({type:"string",...Rs(t)})}(Bu,e)}const Ku=ss("ZodStringFormat",(e,t)=>{jc.init(e,t),Wu.init(e,t)}),Hu=ss("ZodEmail",(e,t)=>{Wc.init(e,t),Ku.init(e,t)}),Zu=ss("ZodGUID",(e,t)=>{$c.init(e,t),Ku.init(e,t)}),qu=ss("ZodUUID",(e,t)=>{Vc.init(e,t),Ku.init(e,t)}),Ju=ss("ZodURL",(e,t)=>{Bc.init(e,t),Ku.init(e,t)}),Yu=ss("ZodEmoji",(e,t)=>{Gc.init(e,t),Ku.init(e,t)}),Xu=ss("ZodNanoID",(e,t)=>{Kc.init(e,t),Ku.init(e,t)}),Qu=ss("ZodCUID",(e,t)=>{Hc.init(e,t),Ku.init(e,t)}),ef=ss("ZodCUID2",(e,t)=>{Zc.init(e,t),Ku.init(e,t)}),tf=ss("ZodULID",(e,t)=>{qc.init(e,t),Ku.init(e,t)}),rf=ss("ZodXID",(e,t)=>{Jc.init(e,t),Ku.init(e,t)}),nf=ss("ZodKSUID",(e,t)=>{Yc.init(e,t),Ku.init(e,t)}),af=ss("ZodIPv4",(e,t)=>{rl.init(e,t),Ku.init(e,t)}),of=ss("ZodIPv6",(e,t)=>{nl.init(e,t),Ku.init(e,t)}),sf=ss("ZodCIDRv4",(e,t)=>{al.init(e,t),Ku.init(e,t)}),cf=ss("ZodCIDRv6",(e,t)=>{ol.init(e,t),Ku.init(e,t)}),lf=ss("ZodBase64",(e,t)=>{sl.init(e,t),Ku.init(e,t)}),df=ss("ZodBase64URL",(e,t)=>{cl.init(e,t),Ku.init(e,t)}),uf=ss("ZodE164",(e,t)=>{ll.init(e,t),Ku.init(e,t)}),ff=ss("ZodJWT",(e,t)=>{dl.init(e,t),Ku.init(e,t)}),pf=ss("ZodUnknown",(e,t)=>{ul.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function mf(){return new pf({type:"unknown"})}const hf=ss("ZodNever",(e,t)=>{fl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function gf(e){return function(e,t){return new e({type:"never",...Rs(t)})}(hf,e)}const bf=ss("ZodArray",(e,t)=>{ml.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=Ql(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Zl(t,r)),e.nonempty=t=>e.check(Zl(1,t)),e.max=(t,r)=>e.check(Hl(t,r)),e.length=(t,r)=>e.check(ql(t,r)),e.unwrap=()=>e.element});const yf=ss("ZodObject",(e,t)=>{vl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def;a.type="object",a.properties={};const i=o.shape;for(const e in i)a.properties[e]=Ql(i[e],t,{...n,path:[...n.path,"properties",e]});const s=new Set(Object.keys(i)),c=new Set([...s].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(a.required=Array.from(c)),"never"===o.catchall?._zod.def.type?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=Ql(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),ys(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Sf({type:"enum",entries:r,...Rs(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:mf()}),e.loose=()=>e.clone({...e._zod.def,catchall:mf()}),e.strict=()=>e.clone({...e._zod.def,catchall:gf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Es(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=ws(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vs(this,"shape",r),r}});return Ts(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!Es(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=ws(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vs(this,"shape",r),r}});return Ts(e,r)}(e,t),e.merge=t=>function(e,t){const r=ws(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vs(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Ts(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 Ts(e,ws(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 vs(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=ws(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 vs(this,"shape",n),n},checks:[]});return Ts(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=ws(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 vs(this,"shape",a),a},checks:[]});return Ts(t,a)}(Nf,e,t[0]),e.required=(...t)=>function(e,t,r){const n=ws(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 vs(this,"shape",a),a}});return Ts(t,n)}(Pf,e,t[0])});function vf(e,t){const r={type:"object",shape:e??{},...Rs(t)};return new yf(r)}const wf=ss("ZodUnion",(e,t)=>{xl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,i=a.options.map((e,r)=>Ql(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=i:r.anyOf=i})(e,t,r,n),e.options=t.options});const xf=ss("ZodIntersection",(e,t)=>{Sl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ql(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ql(a.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];r.allOf=c})(e,t,r,n)});const Sf=ss("ZodEnum",(e,t)=>{El.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=fs(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 Sf({...t,checks:[],...Rs(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 Sf({...t,checks:[],...Rs(n),entries:a})}});const kf=ss("ZodTransform",(e,t)=>{Cl.init(e,t),Vu.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 ls(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(Fs(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(Fs(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Nf=ss("ZodOptional",(e,t)=>{_l.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>od(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Ef(e){return new Nf({type:"optional",innerType:e})}const Cf=ss("ZodExactOptional",(e,t)=>{Tl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>od(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Af=ss("ZodNullable",(e,t)=>{Rl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=Ql(a.innerType,t,n),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function _f(e){return new Af({type:"nullable",innerType:e})}const Tf=ss("ZodDefault",(e,t)=>{Pl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ql(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 Rf=ss("ZodPrefault",(e,t)=>{Il.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ql(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 Pf=ss("ZodNonOptional",(e,t)=>{Dl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ql(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Of=ss("ZodCatch",(e,t)=>{Fl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;Ql(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const If=ss("ZodPipe",(e,t)=>{zl.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;Ql(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function Df(e,t){return new If({type:"pipe",in:e,out:t})}const Uf=ss("ZodReadonly",(e,t)=>{Ll.init(e,t),Vu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;Ql(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 Ff=ss("ZodCustom",(e,t)=>{$l.init(e,t),Vu.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 zf=vf({name:Gu().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:Gu().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)")}),Mf={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:"์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"}},Lf=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:c={},autoFocus:l=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,b]=f("en"),[y,v]=f(!1),[w,x]=f(!1),{submitBetaForm:S,isLoading:k,isSubmitting:N,error:E,config:C,success:A,message:_}=(()=>{const e=fr(),[t,r]=f(null),[n,a]=f(!0),[o,i]=f(!1),[s,c]=f(null),[l,p]=f(!1),[m,h]=f(null);return d(()=>{(async()=>{a(!0);const t=new wu(e),n=await t.fetchConfig();r(n),a(!1)})()},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:l,message:m,submitBetaForm:u(async t=>{if(!e){const e="SaaS OS context is not initialized";return c(e),{success:!1,message:e}}try{i(!0),c(null),p(!1),h(null);const r=new wu(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return c(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{b((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Mf).indexOf(e)?e:"en"})())},[]),d(()=>{A&&p&&(v(!0),x(!0)),E&&x(!0)},[A,p,E]);const T={...Mf[s||g],...c},R=ts({resolver:ld(zf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{l&&R.setFocus("name")},[l,R]);const P=R.formState.isValid&&!N;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{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",o),children:[t(yu,{className:"h-24 w-24 rounded-lg"}),t(yu,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(yu,{className:"h-4 w-16"}),t(yu,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(yu,{className:"h-4 w-16"}),t(yu,{className:"h-10 w-full"})]}),t(yu,{className:"h-10 w-full"})]})]}:{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:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&t($f,{logo:C?.logo}),C?.name&&t("div",{children:C?.name})]}),t(vi,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&v(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:T.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":N,children:[!w&&e(r,{children:[!h&&C?.screen?.register&&t(jf,{screen:C?.screen?.register}),t(lu,{control:R.control,name:"name",render:({field:r})=>e(fu,{className:i,children:[t(pu,{children:T.nameLabel}),t(mu,{children:t(bu,{...r})}),t(hu,{}),t(gu,{})]})}),t(lu,{control:R.control,name:"email",render:({field:r})=>e(fu,{className:i,children:[t(pu,{children:T.emailLabel}),t(mu,{children:t(bu,{...r})}),t(hu,{}),t(gu,{})]})}),t(tu,{type:"submit",disabled:!P,className:i,children:N?T.submittingText:T.submitText})]}),w&&E&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"โ—"}),E]}),t("div",{className:"mt-4 flex justify-center",children:t(tu,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&y&&_&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&t(jf,{screen:C?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function jf({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function $f({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Vf({slug:n,children:a,loadingFallback:o,errorFallback:i}){const{items:s,plans:c,notes:l,loading:d,error:u,refetch:f}=xr(n);return d?void 0!==o?t(r,{children:o}):e("div",{className:"space-y-4",children:[t(yu,{className:"h-8 w-48"}),t("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(e=>t(yu,{className:"h-64 rounded-lg"},e))})]}):u?i?t(r,{children:i(u)}):t("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:u}):t(r,{children:a({loading:d,error:u,items:s,plans:c,notes:l,refetch:f})})}const Wf=e=>{const{children:t}=e,{status:r}=yo();return r!==st.authenticated?null:t},Bf=e=>{const{children:t}=e,{status:r}=yo();return r===st.authenticated?null:t};Wf.displayName="WhenAuthenticated",Bf.displayName="WhenUnauthenticated";const Gf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=yo();return n.includes(a?.role??"")?t:r||null},Kf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=yo(),{currentWorkspace:o}=gr(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function Hf(){const e=p(No);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function Zf(){const e=p(No);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])}}Gf.displayName="WhenRoles",Kf.displayName="WhenWorkspaceRoles";const qf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=gr(),a=n?.features?.[r];return a?t:null},Jf=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=gr(),a=n?.features?.[r];return a?null:t},Yf=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Zf();return n(r)?t:null},Xf=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Zf();return n(r)?null:t};qf.displayName="WhenWorkspaceFeatureEnabled",Jf.displayName="WhenWorkspaceFeatureDisabled",Yf.displayName="WhenUserFeatureEnabled",Xf.displayName="WhenUserFeatureDisabled";const Qf=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Lr();return o?r??null:a?.subscription?t:n??null},ep=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Lr();return o?r??null:a?.subscription?n??null:t},tp=e=>{const{children:t,plans:r,loadingComponent:n,fallbackComponent:a}=e,{response:o,loading:i}=Lr();if(i)return n??null;if(!o?.subscription)return a??null;const s=o.plan??o.subscription?.plan;if(!s)return a??null;const c=r.map(e=>e.trim().toLowerCase()),l=(s.slug??"").toLowerCase();return c.includes(l)?t:a??null};Qf.displayName="WhenSubscription",ep.displayName="WhenNoSubscription",tp.displayName="WhenSubscriptionToPlans";const rp=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Br();if(i)return n??null;const s=o?.[t];return s?s.available<=0?a??null:r:a??null},np=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Br();if(i)return n??null;const s=o?.[t];return s?s.available>0?a??null:r:a??null},ap=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Br();if(i)return n??null;const s=o?.[t];return s&&s.hasOverage?r:a??null},op=e=>{const{slug:t,threshold:r,children:n,loadingComponent:a,fallbackComponent:o}=e,{quotas:i,loading:s}=Br();if(s)return a??null;const c=i?.[t];if(!c)return o??null;return(c.included>0?c.consumed/c.included*100:c.consumed>0?100:0)<r?o??null:n};function ip(...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 a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function sp(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}rp.displayName="WhenQuotaAvailable",np.displayName="WhenQuotaExhausted",ap.displayName="WhenQuotaOverage",op.displayName="WhenQuotaThreshold";var cp,lp=globalThis?.document?n.useLayoutEffect:()=>{},dp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=gd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),up={exports:{}},fp={};function pp(){if(cp)return fp;cp=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(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 a=t(),c=r({inst:{value:a,getSnapshot:t}}),l=c[0].inst,d=c[1];return o(function(){l.value=a,l.getSnapshot=t,s(l)&&d({inst:l})},[e,a,t]),n(function(){return s(l)&&d({inst:l}),e(function(){s(l)&&d({inst:l})})},[e]),i(a),a};return fp.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,fp}var mp,hp,gp={};
20
+ */iu.displayName="Button";var su=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=xd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),lu=n.forwardRef((e,r)=>t(su.label,{...e,ref:r,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));lu.displayName="Label";var cu=lu;const du=_d("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),uu=n.forwardRef(({className:e,...r},n)=>t(cu,{ref:n,className:je(du(),e),...r}));uu.displayName=cu.displayName;const fu=Ni,pu=n.createContext({}),mu=({...e})=>t(pu.Provider,{value:{name:e.name},children:t(Si,{...e})}),hu=()=>{const e=n.useContext(pu),t=n.useContext(gu),{getFieldState:r,formState:o}=a.useContext(ki),i=r(e.name,o);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},gu=n.createContext({}),bu=n.forwardRef(({className:e,...r},a)=>{const o=n.useId();return t(gu.Provider,{value:{id:o},children:t("div",{ref:a,className:je("space-y-2",e),...r})})});bu.displayName="FormItem";const yu=n.forwardRef(({className:e,...r},n)=>{const{error:a,formItemId:o}=hu();return t(uu,{ref:n,className:je(a&&"text-destructive",e),htmlFor:o,...r})});yu.displayName="FormLabel";const vu=n.forwardRef(({...e},r)=>{const{error:n,formItemId:a,formDescriptionId:o,formMessageId:i}=hu();return t(Sd,{ref:r,id:a,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});vu.displayName="FormControl";const wu=n.forwardRef(({className:e,...r},n)=>{const{formDescriptionId:a}=hu();return t("p",{ref:n,id:a,className:je("text-sm text-muted-foreground",e),...r})});wu.displayName="FormDescription";const xu=n.forwardRef(({className:e,children:r,...n},a)=>{const{error:o,formMessageId:i}=hu(),s=o?String(o?.message):r;return s?t("p",{ref:a,id:i,className:je("text-sm font-medium text-destructive",e),...n,children:s}):null});xu.displayName="FormMessage";const Su=n.forwardRef(({className:e,type:r,...n},a)=>t("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",e),ref:a,...n}));function ku({className:e,...r}){return t("div",{className:je("animate-pulse rounded-md bg-primary/10",e),...r})}Su.displayName="Input";class Nu extends dr{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 Eu=class{constructor(e){this.api=new Nu(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),o=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:o}})}};const Cu=fs("ZodISODateTime",(e,t)=>{nc.init(e,t),Yu.init(e,t)});function Au(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Us(t)})}(Cu,e)}const _u=fs("ZodISODate",(e,t)=>{ac.init(e,t),Yu.init(e,t)});function Tu(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Us(t)})}(_u,e)}const Ru=fs("ZodISOTime",(e,t)=>{oc.init(e,t),Yu.init(e,t)});function Pu(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Us(t)})}(Ru,e)}const Ou=fs("ZodISODuration",(e,t)=>{ic.init(e,t),Yu.init(e,t)});function Iu(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Us(t)})}(Ou,e)}const Du=fs("ZodError",(e,t)=>{Ws.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,ys,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ys,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Uu=Gs(Du),Mu=Hs(Du),Fu=qs(Du),zu=Ys(Du),Lu=Qs(Du),ju=el(Du),$u=tl(Du),Vu=rl(Du),Wu=nl(Du),Bu=al(Du),Gu=ol(Du),Ku=il(Du),Hu=fs("ZodType",(e,t)=>(Wl.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ld(e,"input"),output:ld(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=nd({...r,processors:t});return ad(e,n),od(n,e),id(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Es(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)=>Ds(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>Uu(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Fu(e,t,r),e.parseAsync=async(t,r)=>Mu(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>zu(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Lu(e,t,r),e.decode=(t,r)=>ju(e,t,r),e.encodeAsync=async(t,r)=>$u(e,t,r),e.decodeAsync=async(t,r)=>Vu(e,t,r),e.safeEncode=(t,r)=>Wu(e,t,r),e.safeDecode=(t,r)=>Bu(e,t,r),e.safeEncodeAsync=async(t,r)=>Gu(e,t,r),e.safeDecodeAsync=async(t,r)=>Ku(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,...Us(r)})}($f,e,t)}(t,r)),e.superRefine=t=>e.check(rd(t)),e.overwrite=t=>e.check(td(t)),e.optional=()=>Rf(e),e.exactOptional=()=>new Pf({type:"optional",innerType:e}),e.nullable=()=>If(e),e.nullish=()=>Rf(If(e)),e.nonoptional=t=>function(e,t){return new Mf({type:"nonoptional",innerType:e,...Us(t)})}(e,t),e.array=()=>{return function(e,t,r){return new e({type:"array",element:t,...Us(r)})}(Sf,e,t);var t},e.or=t=>function(e,t){return new Ef({type:"union",options:e,...Us(t)})}([e,t]),e.and=t=>new Cf({type:"intersection",left:e,right:t}),e.transform=t=>Lf(e,new _f({type:"transform",transform:t})),e.default=t=>{return r=t,new Df({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():Ps(r)}});var r},e.prefault=t=>{return r=t,new Uf({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():Ps(r)}});var r},e.catch=t=>{return new Ff({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Lf(e,t),e.readonly=()=>new jf({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Jc.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Jc.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Jc.get(e);const r=e.clone();return Jc.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Zu=fs("_ZodString",(e,t)=>{Bl.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:a,maximum:o,format:i,patterns:s,contentEncoding:l}=e._zod.bag;if("number"==typeof a&&(n.minLength=a),"number"==typeof o&&(n.maxLength=o),i&&(n.format=cd[i]??i,""===n.format&&delete n.format,"time"===i&&delete n.format),l&&(n.contentEncoding=l),s&&s.size>0){const e=[...s];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 Dl({check:"string_format",format:"regex",...Us(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Fl({check:"string_format",format:"includes",...Us(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new zl({check:"string_format",format:"starts_with",...Us(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Ll({check:"string_format",format:"ends_with",...Us(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Qc(...t)),e.max=(...t)=>e.check(Xc(...t)),e.length=(...t)=>e.check(ed(...t)),e.nonempty=(...t)=>e.check(Qc(1,...t)),e.lowercase=t=>e.check(function(e){return new Ul({check:"string_format",format:"lowercase",...Us(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ml({check:"string_format",format:"uppercase",...Us(e)})}(t)),e.trim=()=>e.check(td(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return td(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(td(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(td(e=>e.toUpperCase())),e.slugify=()=>e.check(td(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),qu=fs("ZodString",(e,t)=>{Bl.init(e,t),Zu.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Us(t)})}(Xu,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Us(t)})}(tf,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Us(t)})}(bf,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Us(t)})}(rf,t)),e.guid=t=>e.check(Yc(Qu,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Us(t)})}(ef,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Us(t)})}(ef,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Us(t)})}(ef,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Us(t)})}(ef,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Us(t)})}(nf,t)),e.guid=t=>e.check(Yc(Qu,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Us(t)})}(af,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Us(t)})}(of,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Us(t)})}(sf,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Us(t)})}(mf,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Us(t)})}(hf,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Us(t)})}(lf,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Us(t)})}(cf,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Us(t)})}(df,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Us(t)})}(uf,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Us(t)})}(ff,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Us(t)})}(pf,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Us(t)})}(gf,t)),e.datetime=t=>e.check(Au(t)),e.date=t=>e.check(Tu(t)),e.time=t=>e.check(Pu(t)),e.duration=t=>e.check(Iu(t))});function Ju(e){return function(e,t){return new e({type:"string",...Us(t)})}(qu,e)}const Yu=fs("ZodStringFormat",(e,t)=>{Gl.init(e,t),Zu.init(e,t)}),Xu=fs("ZodEmail",(e,t)=>{Zl.init(e,t),Yu.init(e,t)}),Qu=fs("ZodGUID",(e,t)=>{Kl.init(e,t),Yu.init(e,t)}),ef=fs("ZodUUID",(e,t)=>{Hl.init(e,t),Yu.init(e,t)}),tf=fs("ZodURL",(e,t)=>{ql.init(e,t),Yu.init(e,t)}),rf=fs("ZodEmoji",(e,t)=>{Jl.init(e,t),Yu.init(e,t)}),nf=fs("ZodNanoID",(e,t)=>{Yl.init(e,t),Yu.init(e,t)}),af=fs("ZodCUID",(e,t)=>{Xl.init(e,t),Yu.init(e,t)}),of=fs("ZodCUID2",(e,t)=>{Ql.init(e,t),Yu.init(e,t)}),sf=fs("ZodULID",(e,t)=>{ec.init(e,t),Yu.init(e,t)}),lf=fs("ZodXID",(e,t)=>{tc.init(e,t),Yu.init(e,t)}),cf=fs("ZodKSUID",(e,t)=>{rc.init(e,t),Yu.init(e,t)}),df=fs("ZodIPv4",(e,t)=>{sc.init(e,t),Yu.init(e,t)}),uf=fs("ZodIPv6",(e,t)=>{lc.init(e,t),Yu.init(e,t)}),ff=fs("ZodCIDRv4",(e,t)=>{cc.init(e,t),Yu.init(e,t)}),pf=fs("ZodCIDRv6",(e,t)=>{dc.init(e,t),Yu.init(e,t)}),mf=fs("ZodBase64",(e,t)=>{fc.init(e,t),Yu.init(e,t)}),hf=fs("ZodBase64URL",(e,t)=>{pc.init(e,t),Yu.init(e,t)}),gf=fs("ZodE164",(e,t)=>{mc.init(e,t),Yu.init(e,t)}),bf=fs("ZodJWT",(e,t)=>{hc.init(e,t),Yu.init(e,t)}),yf=fs("ZodUnknown",(e,t)=>{gc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function vf(){return new yf({type:"unknown"})}const wf=fs("ZodNever",(e,t)=>{bc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function xf(e){return function(e,t){return new e({type:"never",...Us(t)})}(wf,e)}const Sf=fs("ZodArray",(e,t)=>{vc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=ad(o.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Qc(t,r)),e.nonempty=t=>e.check(Qc(1,t)),e.max=(t,r)=>e.check(Xc(t,r)),e.length=(t,r)=>e.check(ed(t,r)),e.unwrap=()=>e.element});const kf=fs("ZodObject",(e,t)=>{Nc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=r,o=e._zod.def;a.type="object",a.properties={};const i=o.shape;for(const e in i)a.properties[e]=ad(i[e],t,{...n,path:[...n.path,"properties",e]});const s=new Set(Object.keys(i)),l=new Set([...s].filter(e=>{const r=o.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(a.required=Array.from(l)),"never"===o.catchall?._zod.def.type?a.additionalProperties=!1:o.catchall?o.catchall&&(a.additionalProperties=ad(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)})(e,t,r,n),ks(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Af({type:"enum",entries:r,...Us(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:vf()}),e.loose=()=>e.clone({...e._zod.def,catchall:vf()}),e.strict=()=>e.clone({...e._zod.def,catchall:xf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Rs(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=Es(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ns(this,"shape",r),r}});return Ds(e,n)}(e,t),e.safeExtend=t=>function(e,t){if(!Rs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Es(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ns(this,"shape",r),r}});return Ds(e,r)}(e,t),e.merge=t=>function(e,t){const r=Es(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ns(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Ds(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 Ds(e,Es(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 Ns(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=Es(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 Ns(this,"shape",n),n},checks:[]});return Ds(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=Es(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 Ns(this,"shape",a),a},checks:[]});return Ds(t,a)}(Tf,e,t[0]),e.required=(...t)=>function(e,t,r){const n=Es(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 Ns(this,"shape",a),a}});return Ds(t,n)}(Mf,e,t[0])});function Nf(e,t){const r={type:"object",shape:e??{},...Us(t)};return new kf(r)}const Ef=fs("ZodUnion",(e,t)=>{Cc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=!1===a.inclusive,i=a.options.map((e,r)=>ad(e,t,{...n,path:[...n.path,o?"oneOf":"anyOf",r]}));o?r.oneOf=i:r.anyOf=i})(e,t,r,n),e.options=t.options});const Cf=fs("ZodIntersection",(e,t)=>{Ac.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=ad(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=ad(a.right,t,{...n,path:[...n.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,l=[...s(o)?o.allOf:[o],...s(i)?i.allOf:[i]];r.allOf=l})(e,t,r,n)});const Af=fs("ZodEnum",(e,t)=>{Rc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=bs(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 Af({...t,checks:[],...Us(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 Af({...t,checks:[],...Us(n),entries:a})}});const _f=fs("ZodTransform",(e,t)=>{Pc.init(e,t),Hu.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 ms(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push($s(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($s(t))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(e=>(r.value=e,r)):(r.value=a,r)}});const Tf=fs("ZodOptional",(e,t)=>{Ic.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>dd(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Rf(e){return new Tf({type:"optional",innerType:e})}const Pf=fs("ZodExactOptional",(e,t)=>{Dc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>dd(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Of=fs("ZodNullable",(e,t)=>{Uc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o=ad(a.innerType,t,n),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function If(e){return new Of({type:"nullable",innerType:e})}const Df=fs("ZodDefault",(e,t)=>{Mc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;ad(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 Uf=fs("ZodPrefault",(e,t)=>{zc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;ad(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 Mf=fs("ZodNonOptional",(e,t)=>{Lc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;ad(a.innerType,t,n),t.seen.get(e).ref=a.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Ff=fs("ZodCatch",(e,t)=>{$c.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;let o;ad(a.innerType,t,n),t.seen.get(e).ref=a.innerType;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const zf=fs("ZodPipe",(e,t)=>{Vc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def,o="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;ad(o,t,n),t.seen.get(e).ref=o})(e,t,0,n),e.in=t.in,e.out=t.out});function Lf(e,t){return new zf({type:"pipe",in:e,out:t})}const jf=fs("ZodReadonly",(e,t)=>{Bc.init(e,t),Hu.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const a=e._zod.def;ad(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 $f=fs("ZodCustom",(e,t)=>{Kc.init(e,t),Hu.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 Vf=Nf({name:Ju().min(1,"Please enter your name").max(50,"Name must be less than 50 characters").regex(/^[\p{L}\p{M}\s'-]*$/u,"Name can only contain letters and spaces"),email:Ju().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)")}),Wf={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:"์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"}},Bf=({onSuccess:n,onError:a,className:o="w-full",fieldClassName:i="flex flex-col gap-1.5 w-full",language:s,customTexts:l={},autoFocus:c=!0,showSuccessMessage:p=!0,hideLogo:m=!1,hideTitles:h=!1})=>{const[g,b]=f("en"),[y,v]=f(!1),[w,x]=f(!1),{submitBetaForm:S,isLoading:k,isSubmitting:N,error:E,config:C,success:A,message:_}=(()=>{const e=fr(),[t,r]=f(null),[n,a]=f(!0),[o,i]=f(!1),[s,l]=f(null),[c,p]=f(!1),[m,h]=f(null);return d(()=>{let t=!1;return(async()=>{a(!0),l(null);try{const n=new Eu(e),a=await n.fetchConfig();t||r(a)}catch(e){t||l(e instanceof Error?e.message:"Failed to load beta form config")}finally{t||a(!1)}})(),()=>{t=!0}},[e]),{isLoading:n,isSubmitting:o,config:t,error:s,success:c,message:m,submitBetaForm:u(async t=>{if(!e){const e="SaaS OS context is not initialized";return l(e),{success:!1,message:e}}try{i(!0),l(null),p(!1),h(null);const r=new Eu(e),n=await r.submitBetaUser({name:t.name||"",email:t.email}),a="success"===n.status;return p(a),h(n.message),{success:a,message:n.message}}catch(e){const t=e instanceof Error?e.message:"Failed to submit beta form";return l(t),p(!1),h(t),{success:!1,message:t}}finally{i(!1)}},[e])}})();d(()=>{b((()=>{if("undefined"==typeof window)return"en";const e=window.navigator.language.split("-")[0];return-1!==Object.keys(Wf).indexOf(e)?e:"en"})())},[]),d(()=>{A&&p&&(v(!0),x(!0)),E&&x(!0)},[A,p,E]);const T={...Wf[s||g],...l},R=is({resolver:md(Vf),defaultValues:{email:"",name:""},mode:"onChange",reValidateMode:"onChange"});d(()=>{c&&R.setFocus("name")},[c,R]);const P=R.formState.isValid&&!N;return t("div",{className:"saas-os-ui",style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:e("div",k?{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",o),children:[t(ku,{className:"h-24 w-24 rounded-lg"}),t(ku,{className:"h-6 w-32"}),e("div",{className:"w-full space-y-4",children:[e("div",{className:"space-y-2",children:[t(ku,{className:"h-4 w-16"}),t(ku,{className:"h-10 w-full"})]}),e("div",{className:"space-y-2",children:[t(ku,{className:"h-4 w-16"}),t(ku,{className:"h-10 w-full"})]}),t(ku,{className:"h-10 w-full"})]})]}:{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:[!m&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[C?.logo&&t(Kf,{logo:C?.logo}),C?.name&&t("div",{children:C?.name})]}),t(Ni,{...R,children:e("form",{onSubmit:R.handleSubmit(async e=>{try{const t=await S(e);t.success?(n?.(),R.reset(),p&&v(!0),x(!0)):(a?.(t.message),x(!0))}catch(e){a?.(e instanceof Error?e.message:T.errorMessage),x(!0)}}),className:o,noValidate:!0,"aria-busy":N,children:[!w&&e(r,{children:[!h&&C?.screen?.register&&t(Gf,{screen:C?.screen?.register}),t(mu,{control:R.control,name:"name",render:({field:r})=>e(bu,{className:i,children:[t(yu,{children:T.nameLabel}),t(vu,{children:t(Su,{...r})}),t(wu,{}),t(xu,{})]})}),t(mu,{control:R.control,name:"email",render:({field:r})=>e(bu,{className:i,children:[t(yu,{children:T.emailLabel}),t(vu,{children:t(Su,{...r})}),t(wu,{}),t(xu,{})]})}),t(iu,{type:"submit",disabled:!P,className:i,children:N?T.submittingText:T.submitText})]}),w&&E&&e("div",{className:"flex flex-col items-center justify-center w-full",children:[e("div",{className:"border-red-300 text-red-700",role:"alert","aria-live":"assertive","aria-atomic":!0,children:[t("span",{className:"text-4xl mb-2",role:"img","aria-label":"Error",children:"โ—"}),E]}),t("div",{className:"mt-4 flex justify-center",children:t(iu,{type:"button",onClick:()=>{x(!1),R.reset()},className:i,children:"Try Again"})})]}),w&&y&&_&&t("div",{className:"flex flex-col items-center justify-center w-full text-green-700 border-green-300 text-center",children:C?.screen?.thankYou&&t(Gf,{screen:C?.screen?.thankYou})})]})}),!w&&t("div",{children:e("div",{children:["By submitting this form, you consent to our"," ",t("a",{href:C?.privacyPolicy,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Privacy Policy"})," ","and"," ",t("a",{href:C?.termsOfService,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700",children:"Terms of Service"}),"."]})})]})})};function Gf({screen:r}){return e("div",{className:"flex flex-col items-center justify-center w-full",children:[t("p",{className:"text-2xl font-bold",children:r?.title}),t("p",{className:"text-sm text-muted-foreground",children:r?.description})]})}function Kf({logo:e}){return t("img","string"==typeof e?{src:e,alt:"Logo",className:"max-h-24"}:{src:e.bucket?.url,alt:"Logo",className:"max-h-24"})}function Hf({slug:n,children:a,loadingFallback:o,errorFallback:i}){const{items:s,plans:l,notes:c,loading:d,error:u,refetch:f}=Er(n);return d?void 0!==o?t(r,{children:o}):e("div",{className:"space-y-4",children:[t(ku,{className:"h-8 w-48"}),t("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(e=>t(ku,{className:"h-64 rounded-lg"},e))})]}):u?i?t(r,{children:i(u)}):t("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:u}):t(r,{children:a({loading:d,error:u,items:s,plans:l,notes:c,refetch:f})})}const Zf=e=>{const{children:t}=e,{status:r}=So();return r!==st.authenticated?null:t},qf=e=>{const{children:t}=e,{status:r}=So();return r!==st.unauthenticated?null:t};Zf.displayName="WhenAuthenticated",qf.displayName="WhenUnauthenticated";const Jf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=So();return n.includes(a?.role??"")?t:r||null},Yf=e=>{const{children:t,fallback:r,roles:n}=e,{user:a}=So(),{currentWorkspace:o}=Sr(),i=o?.users.find(e=>e._id===a?.id);return i&&n.includes(i?.role??"")?t:r||null};function Xf(){const e=p(_o);if(void 0===e)throw new Error("useUserAttributes must be used within a UserProvider");return e}function Qf(){const e=p(_o);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])}}Jf.displayName="WhenRoles",Yf.displayName="WhenWorkspaceRoles";const ep=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Sr(),a=n?.features?.[r];return a?t:null},tp=e=>{const{children:t,slug:r}=e,{currentWorkspace:n}=Sr(),a=n?.features?.[r];return a?null:t},rp=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Qf();return n(r)?t:null},np=e=>{const{children:t,slug:r}=e,{isFeatureEnabled:n}=Qf();return n(r)?null:t};ep.displayName="WhenWorkspaceFeatureEnabled",tp.displayName="WhenWorkspaceFeatureDisabled",rp.displayName="WhenUserFeatureEnabled",np.displayName="WhenUserFeatureDisabled";const ap=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Wr();return o?r??null:a?.subscription?t:n??null},op=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Wr();return o?r??null:a?.subscription?n??null:t},ip=e=>{const{children:t,plans:r,loadingComponent:n,fallbackComponent:a}=e,{response:o,loading:i}=Wr();if(i)return n??null;if(!o?.subscription)return a??null;const s=o.plan??o.subscription?.plan;if(!s)return a??null;const l=r.map(e=>e.trim().toLowerCase()),c=(s.slug??"").toLowerCase();return l.includes(c)?t:a??null},sp=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Wr();return o?r??null:"trialing"!==a?.subscription?.subscriptionStatus?n??null:t},lp=e=>{const{children:t,loadingComponent:r,fallbackComponent:n}=e,{response:a,loading:o}=Wr();return o?r??null:"trialing"===a?.subscription?.subscriptionStatus?n??null:t},cp=e=>{const{children:t,loadingComponent:r,fallbackComponent:n,daysThreshold:a=3}=e,{response:o,loading:i}=Wr();if(i)return r??null;const s=o?.subscription;if(!s||"trialing"!==s.subscriptionStatus)return n??null;const l=s.trialEnd||s.stripeCurrentPeriodEnd;if(!l)return n??null;const c=new Date(l);if(isNaN(c.getTime()))return n??null;return Math.max(0,Math.ceil((c.getTime()-Date.now())/864e5))>a?n??null:t};ap.displayName="WhenSubscription",op.displayName="WhenNoSubscription",ip.displayName="WhenSubscriptionToPlans",sp.displayName="WhenTrialing",lp.displayName="WhenNotTrialing",cp.displayName="WhenTrialEnding";const dp=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Zr();if(i)return n??null;const s=o?.[t];return s?s.available<=0?a??null:r:a??null},up=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Zr();if(i)return n??null;const s=o?.[t];return s?s.available>0?a??null:r:a??null},fp=e=>{const{slug:t,children:r,loadingComponent:n,fallbackComponent:a}=e,{quotas:o,loading:i}=Zr();if(i)return n??null;const s=o?.[t];return s&&s.hasOverage?r:a??null},pp=e=>{const{slug:t,threshold:r,children:n,loadingComponent:a,fallbackComponent:o}=e,{quotas:i,loading:s}=Zr();if(s)return a??null;const l=i?.[t];if(!l)return o??null;return(l.included>0?l.consumed/l.included*100:l.consumed>0?100:0)<r?o??null:n};function mp(...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 a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function hp(e){const t=n.useRef(e);return n.useEffect(()=>{t.current=e}),n.useMemo(()=>(...e)=>t.current?.(...e),[])}dp.displayName="WhenQuotaAvailable",up.displayName="WhenQuotaExhausted",fp.displayName="WhenQuotaOverage",pp.displayName="WhenQuotaThreshold";var gp,bp=globalThis?.document?n.useLayoutEffect:()=>{},yp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=xd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),vp={exports:{}},wp={};function xp(){if(gp)return wp;gp=1;var e=a;var t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function s(e){var r=e.getSnapshot;e=e.value;try{var n=r();return!t(e,n)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var a=t(),l=r({inst:{value:a,getSnapshot:t}}),c=l[0].inst,d=l[1];return o(function(){c.value=a,c.getSnapshot=t,s(c)&&d({inst:c})},[e,a,t]),n(function(){return s(c)&&d({inst:c}),e(function(){s(c)&&d({inst:c})})},[e]),i(a),a};return wp.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,wp}var Sp,kp,Np={};
21
21
  /**
22
22
  * @license React
23
23
  * use-sync-external-store-shim.development.js
@@ -26,5 +26,5 @@ var _d={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 bp(){return mp||(mp=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,c=!1,l=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){c||void 0===t.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();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};gp.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),gp}function yp(){return hp||(hp=1,"production"===process.env.NODE_ENV?up.exports=pp():up.exports=bp()),up.exports}var vp=yp();function wp(){return()=>{}}var xp="Avatar",[Sp]=function(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o);i.displayName=r+"Context";const s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},ip(o,...r)]}(xp),[kp,Np]=Sp(xp),Ep=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(kp,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(dp.span,{...o,ref:r})})});Ep.displayName=xp;var Cp="AvatarImage",Ap=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,c=Np(Cp,a),l=function(e,{referrerPolicy:t,crossOrigin:r}){const a=vp.useSyncExternalStore(wp,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,c]=n.useState(()=>Rp(i,e));return lp(()=>{c(Rp(i,e))},[i,e]),lp(()=>{const e=e=>()=>{c(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=sp(e=>{i(e),c.onImageLoadingStatusChange(e)});return lp(()=>{"idle"!==l&&d(l)},[l,d]),"loaded"===l?t(dp.img,{...s,ref:r,src:o}):null});Ap.displayName=Cp;var _p="AvatarFallback",Tp=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=Np(_p,a),[c,l]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>l(!0),o);return()=>window.clearTimeout(e)}},[o]),c&&"loaded"!==s.imageLoadingStatus?t(dp.span,{...i,ref:r}):null});function Rp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}Tp.displayName=_p;var Pp=Ep,Op=Ap,Ip=Tp;const Dp=n.forwardRef(({className:e,...r},n)=>t(Pp,{ref:n,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Dp.displayName=Pp.displayName;const Up=n.forwardRef(({className:e,...r},n)=>t(Op,{ref:n,className:je("aspect-square h-full w-full",e),...r}));Up.displayName=Op.displayName;const Fp=n.forwardRef(({className:e,...r},n)=>t(Ip,{ref:n,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));function zp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Mp(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const c=r=>{const{scope:a,children:o,...c}=r,l=a?.[e]?.[s]||i,d=n.useMemo(()=>c,Object.values(c));return t(l.Provider,{value:d,children:o})};return c.displayName=r+"Provider",[c,function(t,a){const c=a?.[e]?.[s]||i,l=n.useContext(c);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},Lp(o,...r)]}function Lp(...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 a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}Fp.displayName=Ip.displayName;var jp=n[" useId ".trim().toString()]||(()=>{}),$p=0;function Vp(e){const[t,r]=n.useState(jp());return lp(()=>{r(e=>e??String($p++))},[e]),e||(t?`radix-${t}`:"")}var Wp=n[" useInsertionEffect ".trim().toString()]||lp;function Bp({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Wp(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),c=void 0!==e,l=c?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==c){const t=e?"controlled":"uncontrolled",r=c?"controlled":"uncontrolled";console.warn(`${a} 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,a])}const d=n.useCallback(t=>{if(c){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[c,e,i,s]);return[l,d]}function Gp(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Kp=Symbol("radix.slottable");function Hp(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Kp}var Zp=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=function(e){const r=Gp(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Hp);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var qp,Jp="dismissableLayer.update",Yp="dismissableLayer.pointerDownOutside",Xp="dismissableLayer.focusOutside",Qp=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),em=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...d}=e,u=n.useContext(Qp),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=fd(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),w=f?b.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=v,k=function(e,t=globalThis?.document){const r=sp(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){rm(Yp,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),c?.(e),e.defaultPrevented||l?.())},m),N=function(e,t=globalThis?.document){const r=sp(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){rm(Xp,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m);return function(e,t=globalThis?.document){const r=sp(e);n.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=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(qp=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),tm(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=qp)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),tm())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(Jp,e),()=>document.removeEventListener(Jp,e)},[]),t(Zp.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:zp(e.onFocusCapture,N.onFocusCapture),onBlurCapture:zp(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:zp(e.onPointerDownCapture,k.onPointerDownCapture)})});em.displayName="DismissableLayer";function tm(){const e=new CustomEvent(Jp);document.dispatchEvent(e)}function rm(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&&v.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(Qp),o=n.useRef(null),i=fd(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(Zp.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var nm="focusScope.autoFocusOnMount",am="focusScope.autoFocusOnUnmount",om={bubbles:!1,cancelable:!0},im=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...c}=e,[l,d]=n.useState(null),u=sp(i),f=sp(s),p=n.useRef(null),m=fd(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!l)return;const t=e.target;l.contains(t)?p.current=t:dm(p.current,{select:!0})},t=function(e){if(h.paused||!l)return;const t=e.relatedTarget;null!==t&&(l.contains(t)||dm(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&dm(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()}}},[o,l,h.paused]),n.useEffect(()=>{if(l){um.add(h);const t=document.activeElement;if(!l.contains(t)){const r=new CustomEvent(nm,om);l.addEventListener(nm,u),l.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(dm(n,{select:t}),document.activeElement!==r)return}((e=sm(l),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&dm(l))}return()=>{l.removeEventListener(nm,u),setTimeout(()=>{const e=new CustomEvent(am,om);l.addEventListener(am,f),l.dispatchEvent(e),e.defaultPrevented||dm(t??document.body,{select:!0}),l.removeEventListener(am,f),um.remove(h)},0)}}var e},[l,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)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,[n,o]=function(e){const t=sm(e),r=cm(t,e),n=cm(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&dm(o,{select:!0})):(e.preventDefault(),a&&dm(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(Zp.div,{tabIndex:-1,...c,ref:m,onKeyDown:g})});function sm(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 cm(e,t){for(const r of e)if(!lm(r,{upTo:t}))return r}function lm(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 dm(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()}}im.displayName="FocusScope";var um=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=fm(e,t),e.unshift(t)},remove(t){e=fm(e,t),e[0]?.resume()}}}();function fm(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var pm=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);lp(()=>s(!0),[]);const c=a||i&&globalThis?.document?.body;return c?w.createPortal(t(Zp.div,{...o,ref:r}),c):null});pm.displayName="Portal";var mm=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[c,l]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=hm(a.current);i.current="mounted"===c?e:"none"},[c]),lp(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=hm(t);if(e)l("MOUNT");else if("none"===a||"none"===t?.display)l("UNMOUNT");else{l(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,l]),lp(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=hm(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(l("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=hm(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=fd(a.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}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function hm(e){return e?.animationName||"none"}mm.displayName="Presence";var gm=0;function bm(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ym()),document.body.insertAdjacentElement("beforeend",e[1]??ym()),gm++,()=>{1===gm&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gm--}},[])}function ym(){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 vm=function(){return vm=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},vm.apply(this,arguments)};function wm(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 xm="right-scroll-bar-position",Sm="width-before-scroll-bar";function km(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Nm="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,Em=new WeakMap;function Cm(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return km(e,t)})},(a=f(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return Nm(function(){var t=Em.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||km(e,null)}),n.forEach(function(e){r.has(e)||km(e,a)})}Em.set(o,e)},[e]),o}function Am(e){return e}var _m=function(e){var t=e.sideCar,r=wm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,vm({},r))};_m.isSideCarExport=!0;var Tm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Am);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 o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=vm({async:!0,ssr:!1},e),t}(),Rm=function(){},Pm=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:Rm,onWheelCapture:Rm,onTouchMoveCapture:Rm}),o=a[0],i=a[1],s=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,w=e.gapMode,x=wm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Cm([r,t]),N=vm(vm({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:Tm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!b,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(c),vm(vm({},N),{ref:k})):n.createElement(v,vm({},N,{className:l,ref:k}),c))});Pm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Pm.classNames={fullWidth:Sm,zeroRight:xm};function Om(){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 Im=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=Om())&&(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)}}},Dm=function(){var e,t=(e=Im(),function(t,r){n.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}},Um={left:0,top:0,right:0,gap:0},Fm=function(e){return parseInt(e||"",10)||0},zm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Um;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[Fm(r),Fm(n),Fm(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])}},Mm=Dm(),Lm="data-scroll-locked",jm=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(Lm,"] {\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(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(xm," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Sm," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(xm," .").concat(xm," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Sm," .").concat(Sm," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Lm,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},$m=function(){var e=parseInt(document.body.getAttribute(Lm)||"0",10);return isFinite(e)?e:0},Vm=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(Lm,($m()+1).toString()),function(){var e=$m()-1;e<=0?document.body.removeAttribute(Lm):document.body.setAttribute(Lm,e.toString())}},[]);var i=n.useMemo(function(){return zm(o)},[o]);return n.createElement(Mm,{styles:jm(i,!t,o,r?"":"!important")})},Wm=!1;if("undefined"!=typeof window)try{var Bm=Object.defineProperty({},"passive",{get:function(){return Wm=!0,!0}});window.addEventListener("test",Bm,Bm),window.removeEventListener("test",Bm,Bm)}catch(e){Wm=!1}var Gm=!!Wm&&{passive:!1},Km=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])},Hm=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),Zm(e,n)){var a=qm(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Zm=function(e,t){return"v"===e?function(e){return Km(e,"overflowY")}(t):function(e){return Km(e,"overflowX")}(t)},qm=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)},Jm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ym=function(e){return[e.deltaX,e.deltaY]},Xm=function(e){return e&&"current"in e?e.current:e},Qm=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},eh=0,th=[];function rh(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var nh,ah=(nh=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(eh++)[0],i=n.useState(Dm)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;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(Xm),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=Jm(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],l="deltaY"in e?e.deltaY:i[1]-o[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=Hm(u,d);if(!m)return!0;if(m?n=u:(n="v"===u?"h":"v",m=Hm(u,d)),!m)return!1;if(!a.current&&"changedTouches"in e&&(c||l)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),c=!1,l=o>0,d=0,u=0;do{if(!i)break;var f=qm(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&Zm(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(l&&Math.abs(d)<1||!l&&Math.abs(u)<1)&&(c=!0),c}(h,t,e,"h"===h?c:l)},[]),l=n.useCallback(function(e){var r=e;if(th.length&&th[th.length-1]===i){var n="deltaY"in r?Ym(r):Jm(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 o=(s.current.shards||[]).map(Xm).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?c(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:rh(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=Jm(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,Ym(t),t.target,c(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,Jm(t),t.target,c(t,e.lockRef.current))},[]);n.useEffect(function(){return th.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Gm),document.addEventListener("touchmove",l,Gm),document.addEventListener("touchstart",u,Gm),function(){th=th.filter(function(e){return e!==i}),document.removeEventListener("wheel",l,Gm),document.removeEventListener("touchmove",l,Gm),document.removeEventListener("touchstart",u,Gm)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:Qm(o)}):null,m?n.createElement(Vm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Tm.useMedium(nh),_m),oh=n.forwardRef(function(e,t){return n.createElement(Pm,vm({},e,{ref:t,sideCar:ah}))});oh.classNames=Pm.classNames;var ih=new WeakMap,sh=new WeakMap,ch={},lh=0,dh=function(e){return e&&(e.host||dh(e.parentNode))},uh=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=dh(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]);ch[r]||(ch[r]=new WeakMap);var o=ch[r],i=[],s=new Set,c=new Set(a),l=function(e){e&&!s.has(e)&&(s.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(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,c=(ih.get(e)||0)+1,l=(o.get(e)||0)+1;ih.set(e,c),o.set(e,l),i.push(e),1===c&&a&&sh.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),s.clear(),lh++,function(){i.forEach(function(e){var t=ih.get(e)-1,a=o.get(e)-1;ih.set(e,t),o.set(e,a),t||(sh.has(e)||e.removeAttribute(n),sh.delete(e)),a||e.removeAttribute(r)}),--lh||(ih=new WeakMap,ih=new WeakMap,sh=new WeakMap,ch={})}},fh=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"))),uh(n,a,r,"aria-hidden")):function(){return null}};function ph(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mh=Symbol("radix.slottable");function hh(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mh}var gh="Dialog",[bh,yh]=Mp(gh),[vh,wh]=bh(gh),xh=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,l=n.useRef(null),d=n.useRef(null),[u,f]=Bp({prop:o,defaultProp:i??!1,onChange:s,caller:gh});return t(vh,{scope:r,triggerRef:l,contentRef:d,contentId:Vp(),titleId:Vp(),descriptionId:Vp(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:c,children:a})};xh.displayName=gh;var Sh="DialogTrigger",kh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=wh(Sh,n),i=fd(r,o.triggerRef);return t(Zp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Wh(o.open),...a,ref:i,onClick:zp(e.onClick,o.onOpenToggle)})});kh.displayName=Sh;var Nh="DialogPortal",[Eh,Ch]=bh(Nh,{forceMount:void 0}),Ah=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=wh(Nh,r);return t(Eh,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(mm,{present:a||s.open,children:t(pm,{asChild:!0,container:i,children:e})}))})};Ah.displayName=Nh;var _h="DialogOverlay",Th=n.forwardRef((e,r)=>{const n=Ch(_h,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=wh(_h,e.__scopeDialog);return i.modal?t(mm,{present:a||i.open,children:t(Ph,{...o,ref:r})}):null});Th.displayName=_h;var Rh=function(e){const r=ph(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(hh);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("DialogOverlay.RemoveScroll"),Ph=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=wh(_h,n);return t(oh,{as:Rh,allowPinchZoom:!0,shards:[o.contentRef],children:t(Zp.div,{"data-state":Wh(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),Oh="DialogContent",Ih=n.forwardRef((e,r)=>{const n=Ch(Oh,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=wh(Oh,e.__scopeDialog);return t(mm,{present:a||i.open,children:i.modal?t(Dh,{...o,ref:r}):t(Uh,{...o,ref:r})})});Ih.displayName=Oh;var Dh=n.forwardRef((e,r)=>{const a=wh(Oh,e.__scopeDialog),o=n.useRef(null),i=fd(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return fh(e)},[]),t(Fh,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zp(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:zp(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:zp(e.onFocusOutside,e=>e.preventDefault())})}),Uh=n.forwardRef((e,r)=>{const a=wh(Oh,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(Fh,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Fh=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:c,onCloseAutoFocus:l,...d}=a,u=wh(Oh,i),f=n.useRef(null),p=fd(o,f);return bm(),e(r,{children:[t(im,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:c,onUnmountAutoFocus:l,children:t(em,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Wh(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(Hh,{titleId:u.titleId}),t(Zh,{contentRef:f,descriptionId:u.descriptionId})]})]})}),zh="DialogTitle",Mh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=wh(zh,n);return t(Zp.h2,{id:o.titleId,...a,ref:r})});Mh.displayName=zh;var Lh="DialogDescription",jh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=wh(Lh,n);return t(Zp.p,{id:o.descriptionId,...a,ref:r})});jh.displayName=Lh;var $h="DialogClose",Vh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=wh($h,n);return t(Zp.button,{type:"button",...a,ref:r,onClick:zp(e.onClick,()=>o.onOpenChange(!1))})});function Wh(e){return e?"open":"closed"}Vh.displayName=$h;var Bh="DialogTitleWarning",[Gh,Kh]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Bh,{contentName:Oh,titleName:zh,docsSlug:"dialog"}),Hh=({titleId:e})=>{const t=Kh(Bh),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 n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},Zh=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Kh("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},qh=xh,Jh=kh,Yh=Ah,Xh=Th,Qh=Ih,eg=Mh,tg=jh,rg=Vh;function ng(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var ag=["color"],og=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ng(e,ag);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),ig=["color"],sg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ng(e,ig);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),cg=["color"],lg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ng(e,cg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),dg=["color"],ug=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ng(e,dg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))});const fg=qh,pg=Jh,mg=Yh,hg=n.forwardRef(({className:e,...r},n)=>t(Xh,{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",e),...r}));hg.displayName=Xh.displayName;const gg=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(xo);return e(mg,{container:s,children:[t(hg,{}),e(Qh,{ref:i,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",r),...o,children:[a,e(rg,{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:[t(lg,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});gg.displayName=Qh.displayName;const bg=({className:e,...r})=>t("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});bg.displayName="DialogHeader";const yg=n.forwardRef(({className:e,...r},n)=>t(eg,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",e),...r}));yg.displayName=eg.displayName;const vg=n.forwardRef(({className:e,...r},n)=>t(tg,{ref:n,className:je("text-sm text-muted-foreground",e),...r}));function wg(e){const r=xg(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(kg);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}function xg(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}vg.displayName=tg.displayName;var Sg=Symbol("radix.slottable");function kg(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Sg}function Ng(e){const r=e+"CollectionProvider",[n,o]=Mp(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),c=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};c.displayName=r;const l=e+"CollectionSlot",d=wg(l),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=fd(r,s(l,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=wg(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,c=a.useRef(null),l=fd(r,c),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(c,{ref:c,...i}),()=>{d.itemMap.delete(c)})),t(m,{[p]:"",ref:l,children:o})});return h.displayName=f,[{Provider:c,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}var Eg=n.createContext(void 0);function Cg(e){const t=n.useContext(Eg);return e||t||"ltr"}var Ag="rovingFocusGroup.onEntryFocus",_g={bubbles:!1,cancelable:!0},Tg="RovingFocusGroup",[Rg,Pg,Og]=Ng(Tg),[Ig,Dg]=Mp(Tg,[Og]),[Ug,Fg]=Ig(Tg),zg=n.forwardRef((e,r)=>t(Rg.Provider,{scope:e.__scopeRovingFocusGroup,children:t(Rg.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Mg,{...e,ref:r})})}));zg.displayName=Tg;var Mg=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=fd(r,m),g=Cg(s),[b,y]=Bp({prop:c,defaultProp:l??null,onChange:d,caller:Tg}),[v,w]=n.useState(!1),x=sp(u),S=Pg(a),k=n.useRef(!1),[N,E]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Ag,x),()=>e.removeEventListener(Ag,x)},[x]),t(Ug,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:b,onItemFocus:n.useCallback(e=>y(e),[y]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>E(e=>e-1),[]),children:t(Zp.div,{tabIndex:v||0===N?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:zp(e.onMouseDown,()=>{k.current=!0}),onFocus:zp(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(Ag,_g);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Vg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:zp(e.onBlur,()=>w(!1))})})}),Lg="RovingFocusGroupItem",jg=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:c,...l}=e,d=Vp(),u=s||d,f=Fg(Lg,a),p=f.currentTabStopId===u,m=Pg(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(Rg.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(Zp.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:r,onMouseDown:zp(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:zp(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:zp(e.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:$g[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(()=>Vg(r))}}),children:"function"==typeof c?c({isCurrentTabStop:p,hasTabStop:null!=b}):c})})});jg.displayName=Lg;var $g={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vg(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 Wg=zg,Bg=jg;function Gg(e){const[t,r]=n.useState(void 0);return lp(()=>{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,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function Kg(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hg="Radio",[Zg,qg]=Mp(Hg),[Jg,Yg]=Zg(Hg),Xg=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:c,disabled:l,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=fd(a,e=>h(e)),b=n.useRef(!1),y=!m||(f||!!m.closest("form"));return e(Jg,{scope:o,checked:s,disabled:l,children:[t(Zp.button,{type:"button",role:"radio","aria-checked":s,"data-state":rb(s),"data-disabled":l?"":void 0,disabled:l,value:d,...p,ref:g,onClick:zp(r.onClick,e=>{s||u?.(),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&t(tb,{control:m,bubbles:!b.current,name:i,value:d,checked:s,required:c,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});Xg.displayName=Hg;var Qg="RadioIndicator",eb=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=Yg(Qg,n);return t(mm,{present:a||i.checked,children:t(Zp.span,{"data-state":rb(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});eb.displayName=Qg;var tb=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=fd(c,s),d=Kg(a),u=Gg(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(Zp.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function rb(e){return e?"checked":"unchecked"}tb.displayName="RadioBubbleInput";var nb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ab="RadioGroup",[ob]=Mp(ab,[Dg,qg]),ib=Dg(),sb=qg(),[cb,lb]=ob(ab),db=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:c=!1,orientation:l,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=ib(n),h=Cg(d),[g,b]=Bp({prop:i,defaultProp:o??null,onChange:f,caller:ab});return t(cb,{scope:n,name:a,required:s,disabled:c,value:g,onValueChange:b,children:t(Wg,{asChild:!0,...m,orientation:l,dir:h,loop:u,children:t(Zp.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:h,...p,ref:r})})})});db.displayName=ab;var ub="RadioGroupItem",fb=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=lb(ub,a),c=s.disabled||o,l=ib(a),d=sb(a),u=n.useRef(null),f=fd(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{nb.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)}},[]),t(Bg,{asChild:!0,...l,focusable:!c,active:p,children:t(Xg,{disabled:c,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:zp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:zp(i.onFocus,()=>{m.current&&u.current?.click()})})})});fb.displayName=ub;var pb=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=sb(n);return t(eb,{...o,...a,ref:r})});pb.displayName="RadioGroupIndicator";var mb=db,hb=fb,gb=pb;const bb=n.forwardRef(({className:e,...r},n)=>t(mb,{className:je("grid gap-2",e),...r,ref:n}));bb.displayName=mb.displayName;const yb=n.forwardRef(({className:e,...r},n)=>t(hb,{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",e),...r,children:t(gb,{className:"flex items-center justify-center",children:t(sg,{className:"h-3.5 w-3.5 fill-primary"})})}));function vb(e,[t,r]){return Math.min(r,Math.max(t,e))}yb.displayName=hb.displayName;var wb="ScrollArea",[xb]=Mp(wb),[Sb,kb]=xb(wb),Nb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...c}=e,[l,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[b,y]=n.useState(null),[v,w]=n.useState(0),[x,S]=n.useState(0),[k,N]=n.useState(!1),[E,C]=n.useState(!1),A=fd(r,e=>d(e)),_=Cg(i);return t(Sb,{scope:a,type:o,dir:_,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:N,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:S,children:t(Zp.div,{dir:_,...c,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});Nb.displayName=wb;var Eb="ScrollAreaViewport",Cb=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:c,...l}=a,d=kb(Eb,i),u=fd(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("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:c}),t(Zp.div,{"data-radix-scroll-area-viewport":"",...l,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Cb.displayName=Eb;var Ab="ScrollAreaScrollbar",_b=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=kb(Ab,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=i,l="horizontal"===e.orientation;return n.useEffect(()=>(l?s(!0):c(!0),()=>{l?s(!1):c(!1)}),[l,s,c]),"hover"===i.type?t(Tb,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(Rb,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Pb,{...o,ref:r,forceMount:a}):"always"===i.type?t(Ob,{...o,ref:r}):null});_b.displayName=Ab;var Tb=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=kb(Ab,e.__scopeScrollArea),[s,c]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),c(!0)},n=()=>{t=window.setTimeout(()=>c(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(mm,{present:a||s,children:t(Pb,{"data-state":s?"visible":"hidden",...o,ref:r})})}),Rb=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=kb(Ab,e.__scopeScrollArea),s="horizontal"===e.orientation,c=Yb(()=>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"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===l){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"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)}},[i.viewport,s,d,c]),t(mm,{present:a||"hidden"!==l,children:t(Ob,{"data-state":"hidden"===l?"hidden":"visible",...o,ref:r,onPointerEnter:zp(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:zp(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Pb=n.forwardRef((e,r)=>{const a=kb(Ab,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,c]=n.useState(!1),l="horizontal"===e.orientation,d=Yb(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;c(l?e:t)}},10);return Xb(a.viewport,d),Xb(a.content,d),t(mm,{present:o||s,children:t(Ob,{"data-state":s?"visible":"hidden",...i,ref:r})})}),Ob=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=kb(Ab,e.__scopeScrollArea),s=n.useRef(null),c=n.useRef(0),[l,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Gb(l.viewport,l.content),f={...o,sizes:l,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:e=>c.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=Kb(r),o=a/2,i=t||o,s=a-i,c=r.scrollbar.paddingStart+i,l=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return Zb([c,l],u)(e)}(e,c.current,l,t)}return"horizontal"===a?t(Ib,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Hb(i.viewport.scrollLeft,l,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Db,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=Hb(i.viewport.scrollTop,l);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),Ib=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=kb(Ab,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=fd(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(zb,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Kb(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),qb(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Bb(c.paddingLeft),paddingEnd:Bb(c.paddingRight)}})}})}),Db=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=kb(Ab,e.__scopeScrollArea),[c,l]=n.useState(),d=n.useRef(null),u=fd(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&l(getComputedStyle(d.current))},[d]),t(zb,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Kb(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),qb(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&c&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Bb(c.paddingTop),paddingEnd:Bb(c.paddingBottom)}})}})}),[Ub,Fb]=xb(Ab),zb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:c,onThumbPointerDown:l,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=kb(Ab,a),[g,b]=n.useState(null),y=fd(r,e=>b(e)),v=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=sp(f),N=sp(d),E=Yb(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 n.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})},[x,g,S,k]),n.useEffect(N,[o,N]),Xb(g,E),Xb(h.content,E),t(Ub,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:sp(s),onThumbPointerUp:sp(c),onThumbPositionChange:N,onThumbPointerDown:sp(l),children:t(Zp.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:zp(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:zp(e.onPointerMove,C),onPointerUp:zp(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),Mb="ScrollAreaThumb",Lb=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=Fb(Mb,e.__scopeScrollArea);return t(mm,{present:n||o.hasThumb,children:t(jb,{ref:r,...a})})}),jb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=kb(Mb,a),c=Fb(Mb,a),{onThumbPositionChange:l}=c,d=fd(r,e=>c.onThumbChange(e)),u=n.useRef(void 0),f=Yb(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=Jb(e,l);u.current=t,l()}};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,l]),t(Zp.div,{"data-state":c.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:zp(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;c.onThumbPointerDown({x:r,y:n})}),onPointerUp:zp(e.onPointerUp,c.onThumbPointerUp)})});Lb.displayName=Mb;var $b="ScrollAreaCorner",Vb=n.forwardRef((e,r)=>{const n=kb($b,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Wb,{...e,ref:r}):null});Vb.displayName=$b;var Wb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=kb($b,a),[s,c]=n.useState(0),[l,d]=n.useState(0),u=Boolean(s&&l);return Xb(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),Xb(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),c(e)}),u?t(Zp.div,{...o,ref:r,style:{width:s,height:l,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Bb(e){return e?parseInt(e,10):0}function Gb(e,t){const r=e/t;return isNaN(r)?0:r}function Kb(e){const t=Gb(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Hb(e,t,r="ltr"){const n=Kb(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,c=vb(e,"ltr"===r?[0,i]:[-1*i,0]);return Zb([0,i],[0,s])(c)}function Zb(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 qb(e,t){return e>0&&e<t}var Jb=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Yb(e,t){const r=sp(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function Xb(e,t){const r=sp(t);lp(()=>{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 Qb=Nb,ey=Cb,ty=Vb;const ry=n.forwardRef(({className:r,children:n,...a},o)=>e(Qb,{ref:o,className:je("relative overflow-hidden",r),...a,children:[t(ey,{className:"h-full w-full rounded-[inherit]",children:n}),t(ny,{}),t(ty,{})]}));ry.displayName=Qb.displayName;const ny=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(_b,{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]",e),...n,children:t(Lb,{className:je("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));ny.displayName=_b.displayName;var ay=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=gd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),oy="horizontal",iy=["horizontal","vertical"],sy=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=oy,...o}=e,i=function(e){return iy.includes(e)}(a)?a:oy,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(ay.div,{"data-orientation":i,...s,...o,ref:r})});sy.displayName="Separator";var cy=sy;const ly=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(cy,{ref:o,decorative:n,orientation:r,className:je("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));ly.displayName=cy.displayName;var dy=Symbol("radix.slottable");var uy="AlertDialog",[fy]=Mp(uy,[yh]),py=yh(),my=e=>{const{__scopeAlertDialog:r,...n}=e,a=py(r);return t(qh,{...a,...n,modal:!0})};my.displayName=uy;var hy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=py(n);return t(Jh,{...o,...a,ref:r})});hy.displayName="AlertDialogTrigger";var gy=e=>{const{__scopeAlertDialog:r,...n}=e,a=py(r);return t(Yh,{...a,...n})};gy.displayName="AlertDialogPortal";var by=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=py(n);return t(Xh,{...o,...a,ref:r})});by.displayName="AlertDialogOverlay";var yy="AlertDialogContent",[vy,wy]=fy(yy),xy=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=dy,n}("AlertDialogContent"),Sy=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,c=py(o),l=n.useRef(null),d=fd(a,l),u=n.useRef(null);return t(Gh,{contentName:yy,titleName:ky,docsSlug:"alert-dialog",children:t(vy,{scope:o,cancelRef:u,children:e(Qh,{role:"alertdialog",...c,...s,ref:d,onOpenAutoFocus:zp(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(xy,{children:i}),t(Ry,{contentRef:l})]})})})});Sy.displayName=yy;var ky="AlertDialogTitle",Ny=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=py(n);return t(eg,{...o,...a,ref:r})});Ny.displayName=ky;var Ey="AlertDialogDescription",Cy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=py(n);return t(tg,{...o,...a,ref:r})});Cy.displayName=Ey;var Ay=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=py(n);return t(rg,{...o,...a,ref:r})});Ay.displayName="AlertDialogAction";var _y="AlertDialogCancel",Ty=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=wy(_y,n),i=py(n),s=fd(r,o);return t(rg,{...i,...a,ref:s})});Ty.displayName=_y;var Ry=({contentRef:e})=>{const t=`\`${yy}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${yy}\` by passing a \`${Ey}\` 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 \`${yy}\`. 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 n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Py=by,Oy=Sy,Iy=Ay,Dy=Ty,Uy=Ny,Fy=Cy;const zy=my,My=hy,Ly=gy,jy=n.forwardRef(({className:e,...r},n)=>t(Py,{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",e),...r,ref:n}));jy.displayName=Py.displayName;const $y=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(xo);return e(Ly,{container:i,children:[t(jy,{}),t(Oy,{ref:o,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",r),...a})]})});$y.displayName=Oy.displayName;const Vy=({className:e,...r})=>t("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",e),...r});Vy.displayName="AlertDialogHeader";const Wy=({className:e,...r})=>t("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Wy.displayName="AlertDialogFooter";const By=n.forwardRef(({className:e,...r},n)=>t(Uy,{ref:n,className:je("text-lg font-semibold",e),...r}));By.displayName=Uy.displayName;const Gy=n.forwardRef(({className:e,...r},n)=>t(Fy,{ref:n,className:je("text-sm text-muted-foreground",e),...r}));Gy.displayName=Fy.displayName;const Ky=n.forwardRef(({className:e,...r},n)=>t(Iy,{ref:n,className:je(eu(),e),...r}));Ky.displayName=Iy.displayName;const Hy=n.forwardRef(({className:e,...r},n)=>t(Dy,{ref:n,className:je(eu({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));function Zy(){return e("div",{className:"space-y-3.5",children:[t(yu,{className:"h-10 w-full"}),t(yu,{className:"h-10 w-full"}),t(yu,{className:"h-10 w-full"})]})}Hy.displayName=Dy.displayName;const qy=({workspace:n})=>{const[a,o]=f(!1),{deleteWorkspace:i}=gr(),{user:s}=yo();if(!n)return t(Zy,{});const c=Qt(n,s?.id??null);return"admin"===c?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("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 ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e(zy,{children:[t(My,{asChild:!0,children:e(tu,{variant:"destructive",disabled:a,progress:a,children:[t(qd,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e($y,{children:[e(Vy,{children:[t(By,{children:"Are you absolutely sure?"}),e(Gy,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Wy,{children:[t(Hy,{disabled:a,children:"Cancel"}),t(Ky,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){Ye(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t($d,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var Jy="Switch",[Yy]=Mp(Jy),[Xy,Qy]=Yy(Jy),ev=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:c,required:l,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),b=fd(a,e=>g(e)),y=n.useRef(!1),v=!h||(p||!!h.closest("form")),[w,x]=Bp({prop:s,defaultProp:c??!1,onChange:f,caller:Jy});return e(Xy,{scope:o,checked:w,disabled:d,children:[t(Zp.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":av(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:b,onClick:zp(r.onClick,e=>{x(e=>!e),v&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),v&&t(nv,{control:h,bubbles:!y.current,name:i,value:u,checked:w,required:l,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});ev.displayName=Jy;var tv="SwitchThumb",rv=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=Qy(tv,n);return t(Zp.span,{"data-state":av(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});rv.displayName=tv;var nv=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const c=n.useRef(null),l=fd(c,s),d=Kg(a),u=Gg(r);return n.useEffect(()=>{const e=c.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function av(e){return e?"checked":"unchecked"}nv.displayName="SwitchBubbleInput";var ov=ev,iv=rv;const sv=n.forwardRef(({className:e,...r},n)=>t(ov,{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",e),...r,ref:n,children:t(iv,{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")})}));sv.displayName=ov.displayName;const cv=({workspaceId:r})=>{const[n,a]=f({}),[o,i]=f(null),{allFeatures:s,updateFeature:c,getWorkspace:l}=gr(),[u,p]=f(null),{user:m}=yo();if(d(()=>{l(r).then(p)},[r]),!u)return t(Zy,{});const h=Xt(u,m?.id??null);return e("div",{children:[o&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:o})]}),e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!s.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),s.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:s.map(r=>{const o=u?.features?.[r.slug],l=null!==n[r.slug]&&void 0!==n[r.slug],d=n[r.slug],f=!0===d?"Enabling":!1===d?"Disabling":"";return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),l?e("div",{className:"flex items-center gap-x-1",children:[t($d,{className:"h-4 w-4 animate-spin text-gray-500"}),e("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):t(sv,{disabled:!h,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(u){a(r=>({...r,[e]:t})),i(null);try{const r=await c(u._id,e,t);p(r);const n=s.find(t=>t.slug===e);i(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),setTimeout(()=>{i(null)},5e3)}catch(t){Ye(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:u._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(r.slug,e)})]},r._id)})})]})]})},lv={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:"เธฟ"},dv={usd:"๐Ÿ‡บ๐Ÿ‡ธ",eur:"๐Ÿ‡ช๐Ÿ‡บ",gbp:"๐Ÿ‡ฌ๐Ÿ‡ง",jpy:"๐Ÿ‡ฏ๐Ÿ‡ต",cad:"๐Ÿ‡จ๐Ÿ‡ฆ",aud:"๐Ÿ‡ฆ๐Ÿ‡บ",chf:"๐Ÿ‡จ๐Ÿ‡ญ",cny:"๐Ÿ‡จ๐Ÿ‡ณ",hkd:"๐Ÿ‡ญ๐Ÿ‡ฐ",sgd:"๐Ÿ‡ธ๐Ÿ‡ฌ",inr:"๐Ÿ‡ฎ๐Ÿ‡ณ",mxn:"๐Ÿ‡ฒ๐Ÿ‡ฝ",brl:"๐Ÿ‡ง๐Ÿ‡ท",nzd:"๐Ÿ‡ณ๐Ÿ‡ฟ",sek:"๐Ÿ‡ธ๐Ÿ‡ช",nok:"๐Ÿ‡ณ๐Ÿ‡ด",dkk:"๐Ÿ‡ฉ๐Ÿ‡ฐ",pln:"๐Ÿ‡ต๐Ÿ‡ฑ",thb:"๐Ÿ‡น๐Ÿ‡ญ"};function uv(e){return e&&e.trim()?dv[e.trim().toLowerCase()]??"":""}function fv(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return lv[t]??t.toUpperCase()}const pv=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],mv=pv.map(e=>({value:e,label:`${e.toUpperCase()} (${fv(e)})`}));function hv(e,t){return fv(t)+(e/100).toFixed(2)}function gv(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=fv(r),o=(e/100).toFixed(2);return 1===n?`${a}${o}/unit`:`${a}${o}/${n.toLocaleString()} units`}function bv(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,o=fv(n),i=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${o}${i}/${a.toLocaleString()} ${e}`:`${o}${i}/${r}`}return 1===a?`${o}${i}/unit`:`${o}${i}/${a.toLocaleString()} units`}function yv(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"}function vv(e,t,r,n,a){const o=null!=a&&a>=2?`${a.toLocaleString()} ${r}s`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${hv(t,n)}/${o}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${hv(t,n)}/${o}`:"โ€”"}function wv(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 xv=["๐Ÿข","๐Ÿฌ","๐Ÿฃ","๐Ÿค","๐Ÿฆ","๐Ÿ›๏ธ","๐Ÿ ","๐Ÿก","๐Ÿญ","๐Ÿ—๏ธ","๐Ÿช","๐Ÿจ","๐Ÿซ","๐Ÿฅ","๐Ÿ’ผ","๐Ÿ“Š","๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“‹","๐Ÿ“","๐Ÿ“‚","๐Ÿ—‚๏ธ","๐Ÿ—ƒ๏ธ","๐Ÿ—„๏ธ","๐Ÿ“…","๐Ÿ—“๏ธ","๐Ÿ“","๐Ÿ–‹๏ธ","โœ๏ธ","๐Ÿ–Š๏ธ","๐Ÿ–Œ๏ธ","๐Ÿ–๏ธ","๐Ÿ“‡","๐Ÿ“Œ","๐Ÿ“","๐Ÿ“Ž","๐Ÿ–‡๏ธ","๐Ÿ’ป","๐Ÿ–ฅ๏ธ","๐Ÿ–จ๏ธ","๐Ÿ–ฑ๏ธ","โŒจ๏ธ","๐Ÿ“ฑ","๐Ÿ“ฒ","๐Ÿ“ก","๐ŸŒ","๐Ÿ”—","๐Ÿ”’","๐Ÿ”“","โš™๏ธ","๐Ÿ”ง","๐Ÿ› ๏ธ","๐Ÿง‘โ€๐Ÿ’ป","๐Ÿ‘จโ€๐Ÿ’ป","๐Ÿ‘ฉโ€๐Ÿ’ป","๐Ÿ•น๏ธ","๐Ÿ’พ","๐Ÿ“Ÿ","๐Ÿ–ฅ๏ธ","๐Ÿ–ฒ๏ธ","๐Ÿš€","๐Ÿ’ก","๐ŸŽจ","๐Ÿ–ผ๏ธ","๐Ÿงช","๐Ÿ”ฌ","๐Ÿงฌ","๐ŸŽฏ","โšก","๐ŸŽฒ","๐ŸŽฎ","๐Ÿงฉ","๐Ÿ“ท","๐ŸŽฅ","โœ‰๏ธ","๐Ÿ“จ","๐Ÿ“ฉ","๐Ÿ“ง","๐Ÿ“ž","โ˜Ž๏ธ","๐Ÿ“ ","๐Ÿ—ฃ๏ธ","๐Ÿ’ฌ","๐Ÿ—จ๏ธ","๐Ÿ“ข","๐Ÿ“ฃ","๐Ÿ””","๐Ÿ›Ž๏ธ","๐Ÿ’ฐ","๐Ÿ’ธ","๐Ÿ’ณ","๐Ÿฆ","๐Ÿ“ˆ","๐Ÿ“‰","โš–๏ธ","๐Ÿงพ","๐Ÿช™","๐Ÿ›๏ธ","โš—๏ธ","๐Ÿงช","๐Ÿ”ญ","๐Ÿ”ฌ","๐Ÿฉบ","๐Ÿงฌ","๐Ÿฉป","๐Ÿฅ","๐ŸŒฑ","๐ŸŒ","๐ŸŒ","๐ŸŒŽ","๐ŸŒก๏ธ","๐Ÿ‘จโ€๐Ÿ’ผ","๐Ÿ‘ฉโ€๐Ÿ’ผ","๐Ÿ‘จโ€๐Ÿซ","๐Ÿ‘ฉโ€๐Ÿซ","๐Ÿ‘จโ€๐Ÿ”ฌ","๐Ÿ‘ฉโ€๐Ÿ”ฌ","๐Ÿ‘จโ€๐ŸŽจ","๐Ÿ‘ฉโ€๐ŸŽจ","๐Ÿ‘จโ€๐Ÿ”ง","๐Ÿ‘ฉโ€๐Ÿ”ง","๐Ÿ‘จโ€๐Ÿš€","๐Ÿ‘ฉโ€๐Ÿš€","๐Ÿ‘จโ€โš–๏ธ","๐Ÿ‘ฉโ€โš–๏ธ","๐Ÿ…","๐ŸŽ–๏ธ","๐Ÿฅ‡","๐Ÿฅˆ","๐Ÿฅ‰","๐Ÿ†","๐ŸŽ—๏ธ","๐Ÿ”‘","๐Ÿ—๏ธ","๐Ÿงญ","๐Ÿ›ก๏ธ","๐Ÿšฉ","๐Ÿณ๏ธโ€๐ŸŒˆ","๐ŸŽŸ๏ธ","๐ŸŽซ"],Sv=({workspace:r})=>{const[n,a]=f(!1),[o,i]=f("emoji"),[s,c]=f(),[l,d]=f(null),{updateWorkspace:u}=gr(),{user:p}=yo(),m=ts({resolver:ld(vf({name:Gu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Gu().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(Zy,{});const h=Xt(r,p?.id??null);return e("div",{children:[l&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:l})]}),!h&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(su,{...m,children:e("form",{onSubmit:m.handleSubmit(async function(e){a(!0),d(null);try{await u(r,e),d("Workspace settings saved successfully"),setTimeout(()=>{d(null)},5e3)}catch(e){Ye(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[t(lu,{control:m.control,name:"name",render:({field:r})=>e(fu,{children:[t(pu,{children:"Name"}),t(mu,{children:t(bu,{placeholder:"My Awesome Workspace",...r,disabled:!h})}),t(gu,{})]})}),r.billingCurrency?.trim()&&e("div",{className:"space-y-1.5",children:[t(iu,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e("div",{className:"flex items-center gap-2 text-sm",children:[uv(r.billingCurrency)&&t("span",{className:"text-base",children:uv(r.billingCurrency)}),t("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e("div",{className:"space-y-4",children:[e("div",{children:[t(iu,{className:"text-sm font-medium",children:"Icon"}),t(hu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(bb,{value:o,disabled:!h,onValueChange:e=>i(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(yb,{value:"emoji",id:"emoji"}),e(iu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Hd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(yb,{value:"url",id:"url"}),e(iu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[s&&t("span",{className:"text-2xl",children:s}),!s&&m.watch("image")?.trim()&&t("img",{src:m.watch("image")||void 0,alt:"Workspace preview"})]})]}),h&&t(ry,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:xv.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),m.setValue("image",wv(e))})(e),disabled:!h,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(s===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(lu,{control:m.control,name:"image",render:({field:r})=>e(fu,{children:[t(pu,{children:"Image URL"}),t(mu,{children:t(bu,{placeholder:"https://example.com/image.png",...r,disabled:!h})}),t(hu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(gu,{})]})}),m.watch("image")&&m.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:m.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:h&&t(tu,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var kv=.999,Nv=/[\\\/_+.#"@\[\(\{&]/,Ev=/[\\\/_+.#"@\[\(\{&]/g,Cv=/[\s-]/,Av=/[\s-]/g;function _v(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var c,l,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(c=_v(e,t,r,n,p+1,o+1,i))>m&&(p===a?c*=1:Nv.test(e.charAt(p-1))?(c*=.8,(d=e.slice(a,p-1).match(Ev))&&a>0&&(c*=Math.pow(kv,d.length))):Cv.test(e.charAt(p-1))?(c*=.9,(u=e.slice(a,p-1).match(Av))&&a>0&&(c*=Math.pow(kv,u.length))):(c*=.17,a>0&&(c*=Math.pow(kv,p-a))),e.charAt(p)!==t.charAt(o)&&(c*=.9999)),(c<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(l=_v(e,t,r,n,p+1,o+2,i))>c&&(c=.1*l)),c>m&&(m=c),p=r.indexOf(f,p+1);return i[s]=m,m}function Tv(e){return e.toLowerCase().replace(Av," ")}function Rv(e,t,r){return _v(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Tv(e),Tv(t),0,0,{})}var Pv='[cmdk-group=""]',Ov='[cmdk-group-items=""]',Iv='[cmdk-item=""]',Dv=`${Iv}:not([aria-disabled="true"])`,Uv="cmdk-item-select",Fv="data-value",zv=(e,t,r)=>Rv(e,t,r),Mv=n.createContext(void 0),Lv=()=>n.useContext(Mv),jv=n.createContext(void 0),$v=()=>n.useContext(jv),Vv=n.createContext(void 0),Wv=n.forwardRef((e,t)=>{let r=nw(()=>{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}}}),a=nw(()=>new Set),o=nw(()=>new Map),i=nw(()=>new Map),s=nw(()=>new Set),c=tw(e),{label:l,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,v=Vp(),w=Vp(),x=Vp(),S=n.useRef(null),k=iw();rw(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,N.emit()}},[u]),rw(()=>{k(6,R)},[]);let N=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),A(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(v))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,N.emit()}),n||k(5,R),void 0!==(null==(o=c.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=c.current).onValueChange)||s.call(i,e))}}N.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{A(),N.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{T(),A(),r.current.value||_(),N.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),N.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>c.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>c.current.disablePointerSelection,listId:v,inputId:x,labelId:w,listInnerRef:S}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=c.current)?void 0:n.filter)?a:zv;return e?o(e,r.current.search,t):0}function A(){if(!r.current.search||!1===c.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.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;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(Ov);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ov} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${Ov} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Pv}[${Fv}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Fv);N.setState("value",t||void 0)}function T(){var e,t,n,s;if(!r.current.search||!1===c.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let l=0;for(let o of a.current){let a=C(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&l++}for(let[e,t]of o.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 R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Pv))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${Iv}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Dv))||[])}function I(e){let t=O()[e];t&&N.setState("value",t.getAttribute(Fv))}function D(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=c.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&N.setState("value",o.getAttribute(Fv))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Pv);for(;n&&!t;)n=e>0?Qv(n,Pv):ew(n,Pv),t=null==n?void 0:n.querySelector(Dv);t?N.setState("value",t.getAttribute(Fv)):D(e)}let F=()=>I(O().length-1),z=e=>{e.preventDefault(),e.metaKey?F():e.altKey?U(1):D(1)},M=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?U(-1):D(-1)};return n.createElement(Zp.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&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":b&&e.ctrlKey&&M(e);break;case"ArrowUp":M(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),F();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Uv);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:cw},l),sw(e,e=>n.createElement(jv.Provider,{value:N},n.createElement(Mv.Provider,{value:E},e))))}),Bv=n.forwardRef((e,t)=>{var r,a;let o=Vp(),i=n.useRef(null),s=n.useContext(Vv),c=Lv(),l=tw(e),d=null!=(a=null==(r=l.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;rw(()=>{if(!d)return c.item(o,null==s?void 0:s.id)},[d]);let u=ow(o,i,[e.value,e.children,i],e.keywords),f=$v(),p=aw(e=>e.value&&e.value===u.current),m=aw(e=>!(!d&&!1!==c.filter())||(!e.search||e.filtered.items.get(o)>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(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Uv,h),()=>t.removeEventListener(Uv,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:v,forceMount:w,keywords:x,...S}=e;return n.createElement(Zp.div,{ref:ud(i,t),...S,id:o,"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)}),Gv=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=Vp(),c=n.useRef(null),l=n.useRef(null),d=Vp(),u=Lv(),f=aw(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));rw(()=>u.group(s),[]),ow(s,c,[e.value,e.heading,l]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(Zp.div,{ref:ud(c,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),sw(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement(Vv.Provider,{value:p},e))))}),Kv=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=aw(e=>!e.search);return r||i?n.createElement(Zp.div,{ref:ud(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),Hv=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=$v(),s=aw(e=>e.search),c=aw(e=>e.selectedItemId),l=Lv();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(Zp.input,{ref:t,...a,"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:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),Zv=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),c=aw(e=>e.selectedItemId),l=Lv();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.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)}}},[]),n.createElement(Zp.div,{ref:ud(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":c,"aria-label":a,id:l.listId},sw(e,e=>n.createElement("div",{ref:ud(s,l.listInnerRef),"cmdk-list-sizer":""},e)))}),qv=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...c}=e;return n.createElement(qh,{open:r,onOpenChange:a},n.createElement(Yh,{container:s},n.createElement(Xh,{"cmdk-overlay":"",className:o}),n.createElement(Qh,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Wv,{ref:t,...c}))))}),Jv=n.forwardRef((e,t)=>aw(e=>0===e.filtered.count)?n.createElement(Zp.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Yv=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(Zp.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},sw(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),Xv=Object.assign(Wv,{List:Zv,Item:Bv,Input:Hv,Group:Gv,Separator:Kv,Dialog:qv,Empty:Jv,Loading:Yv});function Qv(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function ew(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function tw(e){let t=n.useRef(e);return rw(()=>{t.current=e}),t}var rw="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function nw(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function aw(e){let t=$v(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function ow(e,t,r,a=[]){let o=n.useRef(),i=Lv();return rw(()=>{var n;let s=(()=>{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():o.current}})(),c=a.map(e=>e.trim());i.value(e,s,c),null==(n=t.current)||n.setAttribute(Fv,s),o.current=s}),o}var iw=()=>{let[e,t]=n.useState(),r=nw(()=>new Map);return rw(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function sw({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.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 cw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const lw=n.forwardRef(({className:e,...r},n)=>t(Xv,{ref:n,className:je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));lw.displayName=Xv.displayName;const dw=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(ug,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(Xv.Input,{ref:a,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",r),...n})]}));dw.displayName=Xv.Input.displayName;const uw=n.forwardRef(({className:e,...r},n)=>t(Xv.List,{ref:n,className:je("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));uw.displayName=Xv.List.displayName;n.forwardRef((e,r)=>t(Xv.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=Xv.Empty.displayName;const fw=n.forwardRef(({className:e,...r},n)=>t(Xv.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",e),...r}));fw.displayName=Xv.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(Xv.Separator,{ref:n,className:je("-mx-1 h-px bg-border",e),...r})).displayName=Xv.Separator.displayName;const pw=n.forwardRef(({className:e,...r},n)=>t(Xv.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",e),...r}));pw.displayName=Xv.Item.displayName;const mw=["top","right","bottom","left"],hw=Math.min,gw=Math.max,bw=Math.round,yw=Math.floor,vw=e=>({x:e,y:e}),ww={left:"right",right:"left",bottom:"top",top:"bottom"},xw={start:"end",end:"start"};function Sw(e,t,r){return gw(e,hw(t,r))}function kw(e,t){return"function"==typeof e?e(t):e}function Nw(e){return e.split("-")[0]}function Ew(e){return e.split("-")[1]}function Cw(e){return"x"===e?"y":"x"}function Aw(e){return"y"===e?"height":"width"}const _w=new Set(["top","bottom"]);function Tw(e){return _w.has(Nw(e))?"y":"x"}function Rw(e){return Cw(Tw(e))}function Pw(e){return e.replace(/start|end/g,e=>xw[e])}const Ow=["left","right"],Iw=["right","left"],Dw=["top","bottom"],Uw=["bottom","top"];function Fw(e,t,r,n){const a=Ew(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?Iw:Ow:t?Ow:Iw;case"left":case"right":return t?Dw:Uw;default:return[]}}(Nw(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Pw)))),o}function zw(e){return e.replace(/left|right|bottom|top/g,e=>ww[e])}function Mw(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 Lw(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 jw(e,t,r){let{reference:n,floating:a}=e;const o=Tw(t),i=Rw(t),s=Aw(i),c=Nw(t),l="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/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(Ew(t)){case"start":p[i]-=f*(r&&l?-1:1);break;case"end":p[i]+=f*(r&&l?-1:1)}return p}async function $w(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=kw(t,e),m=Mw(p),h=s[f?"floating"===u?"reference":"floating":u],g=Lw(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:l,rootBoundary:d,strategy:c})),b="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),v=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=Lw(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:y,strategy:c}):b);return{top:(g.top-w.top+m.top)/v.y,bottom:(w.bottom-g.bottom+m.bottom)/v.y,left:(g.left-w.left+m.left)/v.x,right:(w.right-g.right+m.right)/v.x}}function Vw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ww(e){return mw.some(t=>e[t]>=0)}const Bw=new Set(["left","top"]);function Gw(){return"undefined"!=typeof window}function Kw(e){return qw(e)?(e.nodeName||"").toLowerCase():"#document"}function Hw(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Zw(e){var t;return null==(t=(qw(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function qw(e){return!!Gw()&&(e instanceof Node||e instanceof Hw(e).Node)}function Jw(e){return!!Gw()&&(e instanceof Element||e instanceof Hw(e).Element)}function Yw(e){return!!Gw()&&(e instanceof HTMLElement||e instanceof Hw(e).HTMLElement)}function Xw(e){return!(!Gw()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Hw(e).ShadowRoot)}const Qw=new Set(["inline","contents"]);function ex(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=fx(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!Qw.has(a)}const tx=new Set(["table","td","th"]);function rx(e){return tx.has(Kw(e))}const nx=[":popover-open",":modal"];function ax(e){return nx.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"],sx=["paint","layout","strict","content"];function cx(e){const t=lx(),r=Jw(e)?fx(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))||sx.some(e=>(r.contain||"").includes(e))}function lx(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const dx=new Set(["html","body","#document"]);function ux(e){return dx.has(Kw(e))}function fx(e){return Hw(e).getComputedStyle(e)}function px(e){return Jw(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mx(e){if("html"===Kw(e))return e;const t=e.assignedSlot||e.parentNode||Xw(e)&&e.host||Zw(e);return Xw(t)?t.host:t}function hx(e){const t=mx(e);return ux(t)?e.ownerDocument?e.ownerDocument.body:e.body:Yw(t)&&ex(t)?t:hx(t)}function gx(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=hx(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=Hw(a);if(o){const e=bx(i);return t.concat(i,i.visualViewport||[],ex(a)?a:[],e&&r?gx(e):[])}return t.concat(a,gx(a,[],r))}function bx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yx(e){const t=fx(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Yw(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=bw(r)!==o||bw(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function vx(e){return Jw(e)?e:e.contextElement}function wx(e){const t=vx(e);if(!Yw(t))return vw(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=yx(t);let i=(o?bw(r.width):r.width)/n,s=(o?bw(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const xx=vw(0);function Sx(e){const t=Hw(e);return lx()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:xx}function kx(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=vx(e);let i=vw(1);t&&(n?Jw(n)&&(i=wx(n)):i=wx(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Hw(e))&&t}(o,r,n)?Sx(o):vw(0);let c=(a.left+s.x)/i.x,l=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=Hw(o),t=n&&Jw(n)?Hw(n):n;let r=e,a=bx(r);for(;a&&n&&t!==r;){const e=wx(a),t=a.getBoundingClientRect(),n=fx(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,l*=e.y,d*=e.x,u*=e.y,c+=o,l+=i,r=Hw(a),a=bx(r)}}return Lw({width:d,height:u,x:c,y:l})}function Nx(e,t){const r=px(e).scrollLeft;return t?t.left+r:kx(Zw(e)).left+r}function Ex(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Nx(e,r),y:r.top+t.scrollTop}}const Cx=new Set(["absolute","fixed"]);function Ax(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Hw(e),n=Zw(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,c=0;if(a){o=a.width,i=a.height;const e=lx();(!e||e&&"fixed"===t)&&(s=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,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else l<=25&&(o+=l);return{width:o,height:i,x:s,y:c}}(e,r);else if("document"===t)n=function(e){const t=Zw(e),r=px(e),n=e.ownerDocument.body,a=gw(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=gw(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Nx(e);const s=-r.scrollTop;return"rtl"===fx(n).direction&&(i+=gw(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(Zw(e));else if(Jw(t))n=function(e,t){const r=kx(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=Yw(e)?wx(e):vw(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=Sx(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Lw(n)}function _x(e,t){const r=mx(e);return!(r===t||!Jw(r)||ux(r))&&("fixed"===fx(r).position||_x(r,t))}function Tx(e,t,r){const n=Yw(t),a=Zw(t),o="fixed"===r,i=kx(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const c=vw(0);function l(){c.x=Nx(a)}if(n||!n&&!o)if(("body"!==Kw(t)||ex(a))&&(s=px(t)),n){const e=kx(t,!0,o,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else a&&l();o&&!n&&a&&l();const d=!a||n||o?vw(0):Ex(a,s);return{x:i.left+s.scrollLeft-c.x-d.x,y:i.top+s.scrollTop-c.y-d.y,width:i.width,height:i.height}}function Rx(e){return"static"===fx(e).position}function Px(e,t){if(!Yw(e)||"fixed"===fx(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Zw(e)===r&&(r=r.ownerDocument.body),r}function Ox(e,t){const r=Hw(e);if(ax(e))return r;if(!Yw(e)){let t=mx(e);for(;t&&!ux(t);){if(Jw(t)&&!Rx(t))return t;t=mx(t)}return r}let n=Px(e,t);for(;n&&rx(n)&&Rx(n);)n=Px(n,t);return n&&ux(n)&&Rx(n)&&!cx(n)?r:n||function(e){let t=mx(e);for(;Yw(t)&&!ux(t);){if(cx(t))return t;if(ax(t))return null;t=mx(t)}return null}(e)||r}const Ix={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=Zw(n),s=!!t&&ax(t.floating);if(n===i||s&&o)return r;let c={scrollLeft:0,scrollTop:0},l=vw(1);const d=vw(0),u=Yw(n);if((u||!u&&!o)&&(("body"!==Kw(n)||ex(i))&&(c=px(n)),Yw(n))){const e=kx(n);l=wx(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?vw(0):Ex(i,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:Zw,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o="clippingAncestors"===r?ax(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=gx(e,[],!1).filter(e=>Jw(e)&&"body"!==Kw(e)),a=null;const o="fixed"===fx(e).position;let i=o?mx(e):e;for(;Jw(i)&&!ux(i);){const t=fx(i),r=cx(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Cx.has(a.position)||ex(i)&&!r&&_x(e,i))?n=n.filter(e=>e!==i):a=t,i=mx(i)}return t.set(e,n),n}(t,this._c):[].concat(r),i=[...o,n],s=i[0],c=i.reduce((e,r)=>{const n=Ax(t,r,a);return e.top=gw(n.top,e.top),e.right=hw(n.right,e.right),e.bottom=hw(n.bottom,e.bottom),e.left=gw(n.left,e.left),e},Ax(t,s,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}=yx(e);return{width:t,height:r}},getScale:wx,isElement:Jw,isRTL:function(e){return"rtl"===fx(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:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=n,l=vx(e),d=a||o?[...l?gx(l):[],...gx(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=l&&s?function(e,t){let r,n=null;const a=Zw(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,c){void 0===s&&(s=!1),void 0===c&&(c=1),o();const l=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=l;if(s||t(),!f||!p)return;const m={rootMargin:-yw(u)+"px "+-yw(a.clientWidth-(d+f))+"px "+-yw(a.clientHeight-(u+p))+"px "+-yw(d)+"px",threshold:gw(0,hw(1,c))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==c){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||Dx(l,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(l,r):null;let f,p=-1,m=null;i&&(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?kx(e):null;return c&&function t(){const n=kx(e);h&&!Dx(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&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:o,placement:i,middlewareData:s}=t,c=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=Nw(r),s=Ew(r),c="y"===Tw(r),l=Bw.has(i)?-1:1,d=o&&c?-1:1,u=kw(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 s&&"number"==typeof m&&(p="end"===s?-1*m:m),c?{x:p*d,y:f*l}:{x:f*l,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},zx=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=kw(e,t),d={x:r,y:n},u=await o.detectOverflow(t,l),f=Tw(Nw(a)),p=Cw(f);let m=d[p],h=d[f];if(i){const e="y"===p?"bottom":"right";m=Sw(m+u["y"===p?"top":"left"],m,m-u[e])}if(s){const e="y"===f?"bottom":"right";h=Sw(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]:i,[f]:s}}}}}},Mx=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=kw(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const b=Nw(a),y=Tw(s),v=Nw(s)===s,w=await(null==c.isRTL?void 0:c.isRTL(l.floating)),x=f||(v||!h?[zw(s)]:function(e){const t=zw(e);return[Pw(e),t,Pw(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Fw(s,h,m,w));const k=[s,...x],N=await c.detectOverflow(t,g),E=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(N[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Ew(e),a=Rw(e),o=Aw(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=zw(i)),[i,zw(i)]}(a,i,w);E.push(N[e[0]],N[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var A,_;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==Tw(t))||C.every(e=>Tw(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(_=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!r)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(S){const t=Tw(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:T[0];e&&(r=e);break}case"initialPlacement":r=s}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:o,platform:i,elements:s}=t,{apply:c=()=>{},...l}=kw(e,t),d=await i.detectOverflow(t,l),u=Nw(a),f=Ew(a),p="y"===Tw(a),{width:m,height:h}=o.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==i.isRTL?void 0:i.isRTL(s.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,w=hw(h-d[g],y),x=hw(m-d[b],v),S=!t.middlewareData.shift;let k=w,N=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(N=v),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=gw(d.left,0),t=gw(d.right,0),r=gw(d.top,0),n=gw(d.bottom,0);p?N=m-2*(0!==e||0!==t?e+t:gw(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:gw(d.top,d.bottom))}await c({...t,availableWidth:N,availableHeight:k});const E=await i.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},jx=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=kw(e,t);switch(a){case"referenceHidden":{const e=Vw(await n.detectOverflow(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ww(e)}}}case"escaped":{const e=Vw(await n.detectOverflow(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Ww(e)}}}default:return{}}}}},$x=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:d=0}=kw(e,t)||{};if(null==l)return{};const u=Mw(d),f={x:r,y:n},p=Rw(a),m=Aw(p),h=await i.getDimensions(l),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let k=S?S[v]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[v]||o.floating[m]);const N=w/2-x/2,E=k/2-h[m]/2-1,C=hw(u[b],E),A=hw(u[y],E),_=C,T=k-h[m]-A,R=k/2-h[m]/2+N,P=Sw(_,R,T),O=!c.arrow&&null!=Ew(a)&&R!==P&&o.reference[m]/2-(R<_?C:A)-h[m]/2<0,I=O?R<_?R-_:R-T:0;return{[p]:f[p]+I,data:{[p]:P,centerOffset:R-P-I,...O&&{alignmentOffset:I}},reset:O}}}),Vx=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kw(e,t),d={x:r,y:n},u=Tw(a),f=Cw(u);let p=d[f],m=d[u];const h=kw(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(l){var b,y;const e="y"===f?"width":"height",t=Bw.has(Nw(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(b=i.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Wx=(e,t,r)=>{const n=new Map,a={platform:Ix,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),c=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=jw(l,n,c),f=n,p={},m=0;for(let r=0;r<s.length;r++){var h;const{name:o,fn:g}=s[r],{x:b,y:y,data:v,reset:w}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:l,platform:{...i,detectOverflow:null!=(h=i.detectOverflow)?h:$w},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p={...p,[o]:{...p[o],...v}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(l=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),({x:d,y:u}=jw(l,f,c))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Bx="undefined"!=typeof document?y:function(){};function Gx(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(!Gx(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)&&!Gx(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function Kx(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hx(e,t){const r=Kx(e);return Math.round(t*r)/r}function Zx(e){const t=n.useRef(e);return Bx(()=>{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}}),Jx=(e,t)=>({...Fx(e),options:[e,t]}),Yx=(e,t)=>({...zx(e),options:[e,t]}),Xx=(e,t)=>({...Vx(e),options:[e,t]}),Qx=(e,t)=>({...Mx(e),options:[e,t]}),eS=(e,t)=>({...Lx(e),options:[e,t]}),tS=(e,t)=>({...jx(e),options:[e,t]}),rS=(e,t)=>({...qx(e),options:[e,t]});var nS=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(Zp.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});nS.displayName="Arrow";var aS=nS,oS="Popper",[iS,sS]=Mp(oS),[cS,lS]=iS(oS),dS=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(cS,{scope:r,anchor:o,onAnchorChange:i,children:a})};dS.displayName=oS;var uS="PopperAnchor",fS=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=lS(uS,a),c=n.useRef(null),l=fd(r,c),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||c.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(Zp.div,{...i,ref:l})});fS.displayName=uS;var pS="PopperContent",[mS,hS]=iS(pS),gS=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=lS(pS,a),[w,x]=n.useState(null),S=fd(r,e=>x(e)),[k,N]=n.useState(null),E=Gg(k),C=E?.width??0,A=E?.height??0,_=o+("center"!==s?"-"+s:""),T="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:T,boundary:R.filter(wS),altBoundary:P},{refs:I,floatingStyles:D,placement:U,isPositioned:F,middlewareData:z}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Gx(p,a)||m(a);const[h,g]=n.useState(null),[b,y]=n.useState(null),w=n.useCallback(e=>{e!==N.current&&(N.current=e,g(e))},[]),x=n.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||h,k=s||b,N=n.useRef(null),E=n.useRef(null),C=n.useRef(u),A=null!=l,_=Zx(l),T=Zx(o),R=Zx(d),P=n.useCallback(()=>{if(!N.current||!E.current)return;const e={placement:t,strategy:r,middleware:p};T.current&&(e.platform=T.current),Wx(N.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Gx(C.current,t)&&(C.current=t,v.flushSync(()=>{f(t)}))})},[p,t,r,T,R]);Bx(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Bx(()=>(O.current=!0,()=>{O.current=!1}),[]),Bx(()=>{if(S&&(N.current=S),k&&(E.current=k),S&&k){if(_.current)return _.current(S,k,P);P()}},[S,k,P,_,A]);const I=n.useMemo(()=>({reference:N,floating:E,setReference:w,setFloating:x}),[w,x]),D=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=Hx(D.floating,u.x),n=Hx(D.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...Kx(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,c,D.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:I,elements:D,floatingStyles:U}),[u,P,I,D,U])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Ux(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[Jx({mainAxis:i+A,alignmentAxis:c}),d&&Yx({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?Xx():void 0,...O}),d&&Qx({...O}),eS({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&rS({element:k,padding:l}),xS({arrowWidth:C,arrowHeight:A}),m&&tS({strategy:"referenceHidden",...O})]}),[M,L]=SS(U),j=sp(g);lp(()=>{F&&j?.()},[F,j]);const $=z.arrow?.x,V=z.arrow?.y,W=0!==z.arrow?.centerOffset,[B,G]=n.useState();return lp(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:F?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:B,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t(mS,{scope:a,placedSide:M,onArrowChange:N,arrowX:$,arrowY:V,shouldHideArrow:W,children:t(Zp.div,{"data-side":M,"data-align":L,...b,ref:S,style:{...b.style,animation:F?void 0:"none"}})})})});gS.displayName=pS;var bS="PopperArrow",yS={top:"bottom",right:"left",bottom:"top",left:"right"},vS=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=hS(bS,n),i=yS[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(aS,{...a,ref:r,style:{...a.style,display:"block"}})})});function wS(e){return null!==e}vS.displayName=bS;var xS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[c,l]=SS(r),d={start:"0%",center:"50%",end:"100%"}[l],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===c?(p=o?d:`${u}px`,m=-s+"px"):"top"===c?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===c?(p=-s+"px",m=o?d:`${f}px`):"left"===c&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function SS(e){const[t,r="center"]=e.split("-");return[t,r]}var kS=dS,NS=fS,ES=gS,CS=vS;function AS(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _S=Symbol("radix.slottable");function TS(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===_S}var RS="Popover",[PS]=Mp(RS,[sS]),OS=sS(),[IS,DS]=PS(RS),US=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:c=!1}=e,l=OS(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=Bp({prop:o,defaultProp:i??!1,onChange:s,caller:RS});return t(kS,{...l,children:t(IS,{scope:r,contentId:Vp(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:c,children:a})})};US.displayName=RS;var FS="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=DS(FS,a),s=OS(a),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=i;return n.useEffect(()=>(c(),()=>l()),[c,l]),t(NS,{...s,...o,ref:r})}).displayName=FS;var zS="PopoverTrigger",MS=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=DS(zS,n),i=OS(n),s=fd(r,o.triggerRef),c=t(Zp.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":JS(o.open),...a,ref:s,onClick:zp(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?c:t(NS,{asChild:!0,...i,children:c})});MS.displayName=zS;var LS="PopoverPortal",[jS,$S]=PS(LS,{forceMount:void 0}),VS=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=DS(LS,r);return t(jS,{scope:r,forceMount:n,children:t(mm,{present:n||i.open,children:t(pm,{asChild:!0,container:o,children:a})})})};VS.displayName=LS;var WS="PopoverContent",BS=n.forwardRef((e,r)=>{const n=$S(WS,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=DS(WS,e.__scopePopover);return t(mm,{present:a||i.open,children:i.modal?t(KS,{...o,ref:r}):t(HS,{...o,ref:r})})});BS.displayName=WS;var GS=function(e){const r=AS(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(TS);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("PopoverContent.RemoveScroll"),KS=n.forwardRef((e,r)=>{const a=DS(WS,e.__scopePopover),o=n.useRef(null),i=fd(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return fh(e)},[]),t(oh,{as:GS,allowPinchZoom:!0,children:t(ZS,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:zp(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:zp(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:zp(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),HS=n.forwardRef((e,r)=>{const a=DS(WS,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(ZS,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),ZS=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onInteractOutside:u,...f}=e,p=DS(WS,n),m=OS(n);return bm(),t(im,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(em,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(ES,{"data-state":JS(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)"}})})})}),qS="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=DS(qS,n);return t(Zp.button,{type:"button",...a,ref:r,onClick:zp(e.onClick,()=>o.onOpenChange(!1))})}).displayName=qS;function JS(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=OS(n);return t(CS,{...o,...a,ref:r})}).displayName="PopoverArrow";var YS=VS,XS=BS;const QS=US,ek=MS,tk=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(xo);return t(YS,{container:s,children:t(XS,{ref:i,align:r,sideOffset:a,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",e),...o})})});function rk({options:r,value:n,onChange:a,placeholder:o="Search...",emptyLabel:i="Choose option"}){const[s,c]=f(n??""),[l,u]=f(!1);d(()=>{void 0!==n&&c(n)},[n]);const p=r.find(e=>e.value===s);return e(QS,{open:l,onOpenChange:u,children:[t(ek,{asChild:!0,children:e(tu,{variant:"outline",role:"combobox","aria-expanded":l,className:"justify-between overflow-hidden text-ellipsis",children:[p?e("div",{children:[String(p.label).trim(),p.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:p.icon})]}):t("span",{className:"text-muted-foreground",children:i}),t(Ud,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(tk,{className:"p-0 overflow-hidden text-ellipsis",children:e(lw,{children:[t(dw,{placeholder:o}),t(uw,{children:t(fw,{children:r.map(r=>e(pw,{className:je("whitespace-nowrap text-left",{"text-green-500":s===r.value}),value:r.value,defaultValue:r.value,onSelect:()=>{return e=r.value,c(e),a?.(e),void u(!1);var e},children:[s===r.value&&t(Dd,{className:je("mr-2 h-4 w-4 text-green-400",s===r.value?"opacity-100":"opacity-0")}),String(r.label).trim(),r.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:r.icon})]},r.value))})})]})})]})}tk.displayName=XS.displayName;const nk={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"},ak={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"},ok=[{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=ak[e.code]||"USD",r=nk[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 ik({value:e,onChange:r}){const n=ok.map(e=>({value:e.value,label:e.text,icon:e.flag}));return t(rk,{options:n,value:e,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const sk=ok.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),ck=Array.from(new Set(sk.map(e=>e.value))).map(e=>sk.find(t=>t.value===e)).filter(e=>void 0!==e);function lk({value:e,onChange:r}){const n=ck.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return t(rk,{options:n,value:e,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let dk=[{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:"๐Ÿ‡ฎ๐Ÿ‡ฑ"}];dk=dk.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),dk.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const uk=dk.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 fk({value:e,onChange:r}){const n=uk.map(e=>({value:e.value,label:e.label,icon:e.flag}));return t(rk,{options:n,value:e,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const pk=[{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],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${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 mk({value:e,onChange:r}){const n=pk.map(e=>({value:e.value,label:e.text}));return t(rk,{options:n,value:e,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const hk=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=gr(),[o,i]=f(!1),[s,c]=f(),[l,u]=f(0),[p,m]=f(null),h=ts({resolver:ld(vf({name:Gu().min(2,{message:"Name must be at least 2 characters."}),country:Gu().optional(),timezone:Gu().optional(),language:Gu().optional(),currency:Gu().optional()})),defaultValues:{name:s?.name||"",country:s?.country||"",timezone:s?.timezone||"",language:s?.language||"",currency:s?.currency||""}});return d(()=>{a().then(e=>{c(e),h.setValue("name",e.name),h.setValue("country",e.country),h.setValue("timezone",e.timezone),h.setValue("language",e.language),h.setValue("currency",e.currency)})},[l]),s?e("div",{children:[p&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:p})]}),t("div",{className:"space-y-4",children:t(su,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){i(!0),m(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),m("Profile saved successfully"),setTimeout(()=>{m(null)},5e3)}catch(e){Ye(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{i(!1)}}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(bu,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:s?.email})]}),t(lu,{disabled:o,control:h.control,name:"name",render:({field:r})=>e(fu,{children:[t(pu,{children:"Name"}),t(mu,{children:t(bu,{...r})}),t(gu,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(fk,{value:h.getValues("language"),onChange:e=>{h.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(ik,{value:h.getValues("country"),onChange:e=>{h.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(lk,{value:h.getValues("currency"),onChange:e=>{h.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(mk,{value:h.getValues("timezone"),onChange:e=>{h.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(tu,{type:"submit",progress:o,disabled:o,children:"Save"}),t(tu,{type:"button",variant:"outline",onClick:()=>{u(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),s?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:s.image,alt:s.name,className:"w-full h-full object-cover"})})]})]}):t(Zy,{})};function gk(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 bk(e,t,r){const n=gk(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function yk(e,t,r){const n=gk(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",o="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(o?n.stripePrices[o]:void 0)??null}function vk(e,t,r,n){const a=gk(e,t),o=a?.quotaOverages?.[r];if(o)return o[n]}function wk(e,t){const r=gk(e,t);return r?r.currency:e.plan?.currency??""}function xk(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 Sk(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const o=a[n];if(!o)return null;const i=vk(e,t,r,n);return{included:o.included,...void 0!==o.unitSize&&{unitSize:o.unitSize},...void 0!==i&&{overage:i}}}function kk(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 Nk(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 Ek(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,o=r.currencySymbol??fv(a??"");if(null==e)return"โ€”";const{included:i,overage:s}=e,c=`${i} included`;if(null==s)return c;const l=n?s/100:s;return`${c}, then ${o}${"number"==typeof l&&Number.isFinite(l)?l.toFixed(2):String(s)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const Ck=(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)},Ak=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",_k=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"}},Tk=({workspaceId:n,hasActiveSubscription:a=!1,onViewPricingPlans:o,limit:i=20})=>{const{invoices:s,loading:c,error:l,refetch:d}=Tr(n,i),u=s.length>0;return e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Billing History"}),t("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),t(tu,{variant:"ghost",size:"sm",progress:c,onClick:d,disabled:c,children:c?"Refreshing...":"Refresh"})]}),l&&e("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("div",{children:[t("p",{className:"font-medium",children:"Error loading invoices"}),t("p",{className:"text-sm mt-1",children:l})]}),t(tu,{variant:"outline",size:"sm",onClick:d,disabled:c,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:c?"Retrying...":"Retry"})]}),c&&!u?t("div",{className:"border rounded-lg p-6",children:t(Zy,{})}):u?t("div",{className:"space-y-2",children:s.map(n=>{const a=(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"}}})(n);return t("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e("div",{className:"flex items-center justify-between gap-4",children:[e("div",{className:"flex-1 min-w-0",children:[e("div",{className:"flex items-center gap-2 mb-1.5",children:[t("span",{className:"text-sm font-medium text-gray-900",children:n.description||n.number||`Invoice ${n.id.slice(-8)}`}),t("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${_k(n.status)}`,children:n.status.charAt(0).toUpperCase()+n.status.slice(1)})]}),e("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("span",{className:"font-medium text-gray-900",children:Ck(n.amount_due,n.currency)}),n.created&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{children:["Created: ",Ak(n.created)]})]}),n.due_date&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{children:["Due: ",Ak(n.due_date)]})]}),n.amount_paid>0&&n.amount_due>0&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{className:"text-xs text-gray-500",children:["Paid: ",Ck(n.amount_paid,n.currency)]})]})]})]}),e("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e(tu,{size:"sm",onClick:()=>window.open(n.hosted_invoice_url,"_blank","noopener,noreferrer"),className:a.color,children:[a.text,t(Md,{className:"h-3 w-3 ml-1.5"})]}),n.invoice_pdf&&e(tu,{size:"sm",variant:"outline",onClick:()=>window.open(n.invoice_pdf,"_blank","noopener,noreferrer"),children:[t(zd,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},n.id)})}):e("div",{className:"border rounded-lg p-6 text-center",children:[t(Ld,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-sm text-gray-500",children:a?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!a&&o&&t(tu,{size:"sm",className:"mt-4",onClick:o,children:"View Pricing Plans"})]})]})},Rk=h(()=>Promise.resolve().then(function(){return gE}).then(e=>({default:e.default}))),Pk=e=>{switch(e){case"monthly":return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly";default:return"Unknown"}},Ok=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""}},Ik=({workspace:n})=>{const a=n._id?.toString(),{subscription:o,loading:i,error:c,updateSubscription:l,refetch:d}=_r(a),{createCheckoutSession:u}=Cr(a),{cancelSubscription:p,loading:h}=Pr(a),{resumeSubscription:g,loading:b}=Or(a),{versions:y,loading:v,error:w,refetch:x}=Er(a),S=i||v,k=c||w,{currentVersion:N,latestVersion:E,isDeprecated:C,whatsNew:A,plansToShow:_}=s(()=>{const e=y?.currentVersion,t=y?.availableVersions||[],r=null!==o?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const a=!!(r&&n&&e)&&n.version>e.version,i=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:a,isDeprecated:a&&r,whatsNew:n?.whatsNew,plansToShow:i}},[y,o?.subscription]),[T,R]=f(!1),[P,O]=f(null),[I,D]=f(null),[U,F]=f(!1),[z,M]=f(!1),[L,j]=f(!1),[$,V]=f("subscription"),W=async()=>{await Promise.all([d(),x()])},B=s(()=>kk(o?.subscription?.stripePriceId,_??[]),[o?.subscription?.stripePriceId,_]);if(S&&!o&&!y)return t(Zy,{});const G=o?.planVersion?._id||null;return a?e("div",{className:"space-y-6",children:[k&&e("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("div",{children:[t("p",{className:"font-medium",children:"Error loading subscription data"}),t("p",{className:"text-sm mt-1",children:k}),t("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),t(tu,{variant:"outline",size:"sm",onClick:W,disabled:S,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:S?"Retrying...":"Retry"})]}),P&&e("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("div",{children:[t("p",{className:"font-medium",children:"Update failed"}),t("p",{className:"text-sm mt-1",children:P})]}),t(tu,{variant:"outline",size:"sm",onClick:()=>O(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),I&&e("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("div",{children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm mt-1",children:I})]}),t(tu,{variant:"outline",size:"sm",onClick:()=>D(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),t("div",{className:"border-b border-gray-200",children:e("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[t("button",{type:"button",onClick:()=>V("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===$?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),t("button",{type:"button",onClick:()=>V("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===$?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===$&&e(r,{children:[S&&e("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:[t($d,{className:"h-4 w-4 animate-spin flex-shrink-0"}),t("span",{children:"Loading subscription and pricing plans..."})]}),C&&o?.subscription&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex-shrink-0",children:t(Yd,{className:"h-5 w-5 text-amber-600"})}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),t("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("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e("span",{children:["Current: Version ",N?.version||"N/A"]}),t("span",{children:"โ€ข"}),e("span",{children:["Latest: Version ",E?.version||"N/A"]})]}),A&&(A.newPlans.length>0||A.updatedPlans.length>0)&&e("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",E?.version,":"]}),e("div",{className:"space-y-1.5 text-xs text-amber-700",children:[A.newPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"New Plans: "}),t("span",{children:A.newPlans.map(e=>e.plan.name).join(", ")})]}),A.updatedPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"Updated Plans: "}),t("span",{children:A.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[t("div",{children:t("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e("div",{className:"flex items-center gap-2",children:[o?.subscription?.cancelAtPeriodEnd||h?null:o?.subscription?t(tu,{variant:"outline",size:"sm",onClick:()=>F(!0),children:"Change Plan"}):!o?.subscription&&_&&_.length>0?t(tu,{size:"sm",onClick:()=>F(!0),children:"View Pricing Plans"}):null,t(tu,{variant:"ghost",size:"sm",progress:S,onClick:W,disabled:S||T,children:S?"Refreshing...":"Refresh"})]})]}),o?.subscription?(()=>{const a=kk(o.subscription.stripePriceId,_??[]),i=a?.interval??null,s=a?.currency??o.plan?.currency??n?.billingCurrency??"",c=i&&o.planVersion?bk(o.planVersion,s,i):null,l=null!=c?0===c?"Free":hv(c,s):null,d="monthly"===i?"/month":"quarterly"===i?"/quarter":"yearly"===i?"/year":"";return e("div",{className:"border rounded-lg overflow-hidden "+(C?"border-amber-300":"border-gray-200"),children:[e("div",{className:"p-5 "+(C?"bg-amber-50/50":"bg-gray-50/50"),children:[e("div",{className:"flex items-start justify-between",children:[e("div",{className:"flex-1",children:[e("div",{className:"flex items-center gap-2 mb-2",children:[t("h3",{className:"text-lg font-semibold text-gray-900",children:o.plan?.name||"No plan assigned"}),e("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===o.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===o.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===o.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===o.subscription.subscriptionStatus&&"Active","trialing"===o.subscription.subscriptionStatus&&"Trial","canceled"===o.subscription.subscriptionStatus&&"Canceled","past_due"===o.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===o.subscription.subscriptionStatus&&Ok(o.subscription.stripeCurrentPeriodEnd)&&e("span",{className:"text-xs text-gray-500",children:["(ends"," ",Ok(o.subscription.stripeCurrentPeriodEnd),")"]}),C&&e("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:[t(Yd,{className:"h-3 w-3"}),"Deprecated"]})]}),o.plan?.description&&t("p",{className:"text-sm text-gray-600",children:o.plan.description})]}),e("div",{className:"text-right ml-4",children:[e("div",{className:"flex items-baseline justify-end gap-1",children:[t("span",{className:"text-2xl font-bold text-gray-900",children:l||"N/A"}),l&&"Free"!==l&&d&&t("span",{className:"text-sm text-gray-500",children:d})]}),i&&e("span",{className:"text-xs text-gray-500 mt-1 inline-block",children:["Billed ",Pk(i).toLowerCase()]}),("active"===o.subscription.subscriptionStatus||"trialing"===o.subscription.subscriptionStatus)&&!o.subscription.cancelAtPeriodEnd&&Ok(o.subscription.stripeCurrentPeriodEnd)&&e("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[t(Od,{className:"h-3.5 w-3.5 flex-shrink-0"}),e("span",{children:["Next billing:"," ",t("span",{className:"font-medium text-gray-700",children:Ok(o.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),C&&e("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",N?.version||"N/A"," - A newer version is available"]}),"active"===o.subscription.subscriptionStatus&&t("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:o.subscription.cancelAtPeriodEnd?t(tu,{variant:"outline",size:"sm",onClick:()=>j(!0),disabled:T||h||b,progress:b,children:"Resume Subscription"}):t(tu,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>M(!0),disabled:T||h||b,progress:h||T,children:h||T?"Canceling...":"Cancel Subscription"})})]}),"past_due"===o.subscription.subscriptionStatus&&t("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e("div",{className:"flex items-start gap-3",children:[t(Yd,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),t("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."}),t(tu,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>V("invoices"),children:"View Invoices"})]})]})}),o.subscription.cancelAtPeriodEnd&&t("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e("div",{className:"flex items-start gap-3",children:[t(Od,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),t("p",{className:"text-sm text-amber-700 mt-0.5",children:Ok(o.subscription.stripeCurrentPeriodEnd)?e(r,{children:["Your subscription will end on"," ",t("span",{className:"font-medium",children:Ok(o.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."})]})]})}),o.planVersion&&(()=>{const r=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],o=[];return e.subscriptionItems.forEach(i=>{const s=i.slug;if("feature"===i.type){const t=e.features?.[s]??!1;n.push({item:i,enabled:t})}else if("limit"===i.type){const t=e.limits?.[s]??0;a.push({item:i,value:t})}else if("quota"===i.type){const n=t&&e.pricingVariants?.length?Sk(e,t,s,r):Nk(e.quotas?.[s],r);null!=n&&o.push({item:i,value:n})}}),{features:n,limits:a,quotas:o}})(o.planVersion,s,i??"monthly");return r.features.length>0||r.limits.length>0||r.quotas.length>0?t("div",{className:"p-5 border-t border-gray-100",children:e("div",{className:"space-y-6",children:[r.features.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),t("ul",{className:"space-y-2",children:r.features.sort(e=>e.enabled?-1:1).map(({item:r,enabled:n})=>e("li",{className:"flex items-start gap-2 text-sm",children:[t("span",{className:"mt-0.5 flex-shrink-0 "+(n?"text-green-500":"text-gray-300"),children:n?"โœ“":"โ€”"}),t("span",{className:n?"text-gray-700":"text-gray-400",children:r.name})]},r._id))})]}),r.limits.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),t("ul",{className:"space-y-2",children:r.limits.map(({item:r,value:n})=>t("li",{className:"text-sm",children:e("div",{className:"flex items-center justify-between",children:[t("span",{className:"text-gray-600",children:r.name}),t("span",{className:"font-medium text-gray-900",children:n})]})},r._id))})]}),r.quotas.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),t("ul",{className:"space-y-2",children:r.quotas.map(({item:r,value:n})=>{const a=Ek(n,r.name.toLowerCase(),{currency:s});return t("li",{className:"text-sm",children:e("div",{className:"flex items-center justify-between",children:[t("span",{className:"text-gray-600",children:r.name}),t("span",{className:"font-medium text-gray-900",children:a})]})},r._id)})})]})]})}):null})()]})})():e("div",{className:"border rounded-lg p-6 text-center",children:[e("div",{className:"mb-4",children:[t(Fd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),t("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),_&&_.length>0&&t(tu,{size:"sm",onClick:()=>F(!0),children:"View Pricing Plans"})]})]}),!y&&!S&&e("div",{className:"border rounded-lg p-4 text-center",children:[e("div",{className:"text-gray-500 mb-2",children:[t("p",{className:"font-medium",children:"Unable to load plan information"}),k&&e("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",k]}),!k&&t("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."})]}),t(tu,{variant:"outline",size:"sm",progress:S,onClick:W,disabled:S,className:"mt-4",children:S?"Refreshing...":"Refresh"})]})]}),"invoices"===$&&e(r,{children:[S&&e("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:[t($d,{className:"h-4 w-4 animate-spin flex-shrink-0"}),t("span",{children:"Loading invoices..."})]}),t(Tk,{workspaceId:a,hasActiveSubscription:null!==o?.subscription,onViewPricingPlans:()=>V("subscription"),limit:20})]}),_&&_.length>0&&t(m,{fallback:U?t("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t($d,{className:"h-5 w-5 animate-spin"}),t("span",{children:"Loading plans..."})]})}):null,children:t(Rk,{open:U,onOpenChange:F,planVersions:_,currentPlanVersionId:G||null,currentStripePriceId:o?.subscription?.stripePriceId,billingCurrency:n.billingCurrency,onSelectPlan:async(e,t="monthly",r)=>{if(!a)return;const i=_?.find(t=>t._id===e),s=i?yk(i,r??B?.currency??o?.plan?.currency??n?.billingCurrency??"",t):null,c=o?.subscription?.stripePriceId;if(!s||!c||s!==c){R(!0),O(null),D(null);try{let r,n,a;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(a=o?.subscription?await l(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await u({planVersionId:e,billingInterval:t,successUrl:r,cancelUrl:n}),a&&"checkoutUrl"in a&&a.checkoutUrl)return void(window.location.href=a.checkoutUrl);D("Subscription updated successfully!"),await W()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";O(t)}finally{R(!1),setTimeout(()=>{O(null),D(null)},5e3)}}},loading:T||S})}),t(zy,{open:L,onOpenChange:j,children:e($y,{children:[e(Vy,{children:[t(By,{children:"Resume Subscription"}),t(Gy,{asChild:!0,children:e("div",{className:"space-y-3",children:[t("p",{children:"Are you sure you want to resume your subscription?"}),e("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e("div",{className:"flex items-start gap-2",children:[t(Yd,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e("span",{children:["You will be charged again on"," ",o?.subscription?.stripeCurrentPeriodEnd&&Ok(o.subscription.stripeCurrentPeriodEnd)?t("span",{className:"font-medium",children:Ok(o.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-amber-600 mt-0.5",children:"โ€ข"}),t("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),t("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e(Wy,{children:[t(Hy,{disabled:b,children:"Keep Canceled"}),t(Ky,{onClick:async()=>{if(a){j(!1),R(!0),O(null),D(null);try{await g(),D("Subscription has been resumed."),await W()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";O(t)}finally{R(!1),setTimeout(()=>{O(null),D(null)},5e3)}}},disabled:b,children:b?"Resuming...":"Yes, Resume Subscription"})]})]})}),t(zy,{open:z,onOpenChange:M,children:e($y,{children:[e(Vy,{children:[t(By,{children:"Cancel Subscription"}),t(Gy,{asChild:!0,children:e("div",{className:"space-y-3",children:[t("p",{children:"Are you sure you want to cancel your subscription?"}),e("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e("span",{children:["You'll retain full access to this plan until"," ",o?.subscription?.stripeCurrentPeriodEnd&&Ok(o.subscription.stripeCurrentPeriodEnd)?t("span",{className:"font-medium",children:Ok(o.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),t("span",{children:"You won't be charged again after cancellation"})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),t("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e(Wy,{children:[t(Hy,{disabled:h,children:"Keep Subscription"}),t(Ky,{onClick:async()=>{if(a){M(!1),R(!0),O(null),D(null);try{await p(),D("Subscription will be canceled at the end of the billing period."),await W()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";O(t)}finally{R(!1),setTimeout(()=>{O(null),D(null)},5e3)}}},disabled:h,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:h?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):t("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:t("p",{children:"Invalid workspace ID"})})};function Dk(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function Uk(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Fk(e,t){return t+e.toFixed(2)}function zk(e){try{const t=new Date(e);if(isNaN(t.getTime()))return null;const r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}catch{return null}}const Mk=()=>{const{quotas:r,loading:n,error:a,refetch:o}=Br(),{response:i}=Lr(),[c,l]=f(!1),d=s(()=>{const e={};if(!i?.planVersion||!i?.subscription)return e;const t=i.planVersion,n=i.subscription,a=n.billingInterval??"monthly",o=n.plan?.currency??"usd",s=fv(o);if(!r)return e;for(const n of Object.keys(r)){const i=vk(t,o,n,a);if(null==i||i<=0)continue;const c=t.quotas?.[n],l=c?.[a],d=l?.unitSize??1,u=r[n].overage,f=(d>1?Math.ceil(u/d):u)*i/100;e[n]={overageCents:i,unitSize:d,currency:o,currencySymbol:s,estimatedCost:f}}return e},[i,r]),u=s(()=>{const e=i?.subscription?.stripeCurrentPeriodEnd;if(!e)return null;const t=function(e){try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}catch{return""}}(e);return t?{endDate:t,daysRemaining:zk(e)}:null},[i]),p=async()=>{l(!0);try{await o()}finally{l(!1)}};if(n&&!r)return t(Zy,{});if(a)return e("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("div",{children:[t("p",{className:"font-medium",children:"Failed to load usage data"}),t("p",{className:"text-sm mt-1",children:a})]}),t(tu,{variant:"outline",size:"sm",onClick:p,disabled:c,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:c?"Retrying...":"Retry"})]});const m=function(e){return[...e].sort(([,e],[,t])=>{if(e.hasOverage&&!t.hasOverage)return-1;if(!e.hasOverage&&t.hasOverage)return 1;const r=e.included>0?e.consumed/e.included:e.consumed>0?1:0;return(t.included>0?t.consumed/t.included:t.consumed>0?1:0)-r})}(r?Object.entries(r):[]);if(0===m.length)return e("div",{className:"border rounded-lg p-8 text-center",children:[t(Id,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),t("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),t("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const h=m.filter(([,e])=>e.hasOverage).length,g=m.reduce((e,[,t])=>e+t.consumed,0),b=m.reduce((e,[,t])=>e+t.included,0),y=Object.values(d).reduce((e,t)=>e+t.estimatedCost,0),v=Object.values(d)[0]?.currencySymbol??"$";return e("div",{className:"space-y-6",children:[e("div",{className:"flex items-center justify-between",children:[t("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e(tu,{variant:"ghost",size:"sm",onClick:p,disabled:c,children:[t(Bd,{className:je("h-3.5 w-3.5 mr-1.5",c&&"animate-spin")}),c?"Refreshing...":"Refresh"]})]}),u&&e("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 px-4 py-3 text-sm text-gray-600",children:[t(Od,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e("span",{children:["Usage resets on ",t("span",{className:"font-medium text-gray-900",children:u.endDate}),null!==u.daysRemaining&&u.daysRemaining>0&&e("span",{className:"text-gray-500",children:[" (",u.daysRemaining," ",1===u.daysRemaining?"day":"days"," remaining)"]}),null!==u.daysRemaining&&u.daysRemaining<=0&&t("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),t("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m.length})]}),e("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),t("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:b>0?Math.round(g/b*100)+"%":"0%"})]}),e("div",{className:je("border rounded-lg p-3 sm:p-4",h>0?"border-red-200 bg-red-50":"border-gray-200"),children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),t("p",{className:je("text-lg sm:text-xl font-semibold mt-1",h>0?"text-red-600":"text-gray-900"),children:h})]}),h>0&&y>0&&e("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),t("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:Fk(y,v)})]})]}),h>0&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t(Yd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e("p",{className:"text-sm text-amber-700",children:[h," ",1===h?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),y>0&&e("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",Fk(y,v)]})]})]})}),t("div",{className:"space-y-3",children:m.map(([e,r])=>{const n=(a=r.consumed,(o=r.included)<=0?a>0?100:0:Math.min(a/o*100,100));var a,o;const i=function(e,t){return t?{bar:"bg-red-500",bg:"bg-red-100",badge:"bg-red-100",badgeText:"text-red-800"}:e>=90?{bar:"bg-amber-500",bg:"bg-amber-100",badge:"bg-amber-100",badgeText:"text-amber-800"}:e>=75?{bar:"bg-yellow-500",bg:"bg-yellow-100",badge:"bg-yellow-100",badgeText:"text-yellow-800"}:{bar:"bg-blue-500",bg:"bg-blue-100",badge:"bg-blue-100",badgeText:"text-blue-800"}}(n,r.hasOverage),s=d[e];return t(Lk,{slug:e,quota:r,percent:n,colors:i,pricing:s},e)})})]})};function Lk({slug:r,quota:n,percent:a,colors:o,pricing:i}){return e("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e("div",{className:"flex items-center gap-2 min-w-0",children:[t("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:Uk(r)}),n.hasOverage&&t("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o.badge,o.badgeText),children:"Overage"}),!n.hasOverage&&a>=90&&t("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o.badge,o.badgeText),children:"Almost full"})]}),e("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[Dk(n.consumed)," / ",Dk(n.included)]})]}),t("div",{className:je("h-2 rounded-full w-full",o.bg),children:t("div",{className:je("h-2 rounded-full transition-all duration-500",o.bar),style:{width:`${a}%`}})}),e("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e("span",{children:[Math.round(a),"% used"]}),t("span",{children:n.available>0?`${Dk(n.available)} remaining`:n.hasOverage?`${Dk(n.overage)} over limit`:"Fully used"})]}),n.hasOverage&&i&&e("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Overage units"}),t("span",{className:"font-medium text-gray-900",children:Dk(n.overage)})]}),e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Rate"}),e("span",{className:"font-medium text-gray-900",children:[i.currencySymbol,(i.overageCents/100).toFixed(2),i.unitSize>1?` / ${i.unitSize.toLocaleString()} units`:" / unit"]})]}),i.unitSize>1&&e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Billable blocks"}),t("span",{className:"font-medium text-gray-900",children:Math.ceil(n.overage/i.unitSize).toLocaleString()})]}),e("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[t("span",{className:"font-medium text-red-600",children:"Estimated charge"}),t("span",{className:"font-semibold text-red-600",children:Fk(i.estimatedCost,i.currencySymbol)})]})]}),!n.hasOverage&&i&&e("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",i.currencySymbol,(i.overageCents/100).toFixed(2),i.unitSize>1?` / ${i.unitSize.toLocaleString()} units`:" / unit"]})]})}function jk(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?ud(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $k=Symbol("radix.slottable");function Vk(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===$k}var Wk=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"});n.forwardRef((e,r)=>t(Zp.span,{...e,ref:r,style:{...Wk,...e.style}})).displayName="VisuallyHidden";var Bk=[" ","Enter","ArrowUp","ArrowDown"],Gk=[" ","Enter"],Kk="Select",[Hk,Zk,qk]=Ng(Kk),[Jk]=Mp(Kk,[qk,sS]),Yk=sS(),[Xk,Qk]=Jk(Kk),[eN,tN]=Jk(Kk),rN=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:c,value:l,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:b}=r,y=Yk(a),[v,w]=n.useState(null),[x,S]=n.useState(null),[k,N]=n.useState(!1),E=Cg(f),[C,A]=Bp({prop:i,defaultProp:s??!1,onChange:c,caller:Kk}),[_,T]=Bp({prop:l,defaultProp:d,onChange:u,caller:Kk}),R=n.useRef(null),P=!v||(b||!!v.closest("form")),[O,I]=n.useState(new Set),D=Array.from(O).map(e=>e.props.value).join(";");return t(kS,{...y,children:e(Xk,{required:g,scope:a,trigger:v,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:N,contentId:Vp(),value:_,onValueChange:T,open:C,onOpenChange:A,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t(Hk.Provider,{scope:a,children:t(eN,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{I(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{I(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(jN,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:_,onChange:e=>T(e.target.value),disabled:h,form:b,children:[void 0===_?t("option",{value:""}):null,Array.from(O)]},D):null]})})};rN.displayName=Kk;var nN="SelectTrigger",aN=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=Yk(a),c=Qk(nN,a),l=c.disabled||o,d=fd(r,c.onTriggerChange),u=Zk(a),f=n.useRef("touch"),[p,m,h]=VN(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===c.value),n=WN(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 t(NS,{asChild:!0,...s,children:t(Zp.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":$N(c.value)?"":void 0,...i,ref:d,onClick:zp(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:zp(i.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:zp(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||Bk.includes(e.key)&&(g(),e.preventDefault())})})})});aN.displayName=nN;var oN="SelectValue",iN=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:c="",...l}=e,d=Qk(oN,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=fd(n,d.onValueNodeChange);return lp(()=>{u(f)},[u,f]),t(Zp.span,{...l,ref:p,style:{pointerEvents:"none"},children:$N(d.value)?t(r,{children:c}):s})});iN.displayName=oN;var sN=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(Zp.span,{"aria-hidden":!0,...o,ref:r,children:a||"โ–ผ"})});sN.displayName="SelectIcon";var cN=e=>t(pm,{asChild:!0,...e});cN.displayName="SelectPortal";var lN="SelectContent",dN=n.forwardRef((e,r)=>{const a=Qk(lN,e.__scopeSelect),[o,i]=n.useState();if(lp(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?v.createPortal(t(fN,{scope:e.__scopeSelect,children:t(Hk.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(hN,{...e,ref:r})});dN.displayName=lN;var uN=10,[fN,pN]=Jk(lN),mN=function(e){const r=jk(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),c=s.find(Vk);if(c){const e=c.props.children,o=s.map(t=>t===c?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("SelectContent.RemoveScroll"),hN=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...v}=e,w=Qk(lN,a),[x,S]=n.useState(null),[k,N]=n.useState(null),E=fd(r,e=>S(e)),[C,A]=n.useState(null),[_,T]=n.useState(null),R=Zk(a),[P,O]=n.useState(!1),I=n.useRef(!1);n.useEffect(()=>{if(x)return fh(x)},[x]),bm();const D=n.useCallback(e=>{const[t,...r]=R().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}},[R,k]),U=n.useCallback(()=>D([C,x]),[D,C,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:F,triggerPointerDownPosRef:z}=w;n.useEffect(()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():x.contains(r.target)||F(!1),document.removeEventListener("pointermove",t),z.current=null};return null!==z.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[x,F,z]),n.useEffect(()=>{const e=()=>F(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[F]);const[M,L]=VN(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=WN(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&(A(e),n&&(I.current=!0))},[w.value]),$=n.useCallback(()=>x?.focus(),[x]),V=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&T(e)},[w.value]),W="popper"===o?bN:gN,B=W===bN?{side:l,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return t(fN,{scope:a,content:x,viewport:k,onViewportChange:N,itemRefCallback:j,selectedItem:C,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:U,selectedItemText:_,position:o,isPositioned:P,searchRef:M,children:t(oh,{as:mN,allowPinchZoom:!0,children:t(im,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:zp(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(em,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>O(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:zp(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||L(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().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(()=>D(t)),e.preventDefault()}})})})})})})});hN.displayName="SelectContentImpl";var gN=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=Qk(lN,a),c=pN(lN,a),[l,d]=n.useState(null),[u,f]=n.useState(null),p=fd(r,e=>f(e)),m=Zk(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:v,focusSelectedItem:w}=c,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&b&&y&&v){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=v.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-uN,u=vb(o,[uN,Math.max(uN,d-c)]);l.style.minWidth=s+"px",l.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,c=Math.max(s,t.width),d=window.innerWidth-uN,u=vb(o,[uN,Math.max(uN,d-c)]);l.style.minWidth=s+"px",l.style.right=u+"px"}const a=m(),i=window.innerHeight-2*uN,c=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+c+parseInt(d.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),N=parseInt(S.paddingBottom,10),E=e.top+e.height/2-uN,C=i-E,A=y.offsetHeight/2,_=f+p+(y.offsetTop+A),T=w-_;if(_<=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=_+Math.max(C,A+(e?N: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)+A)+T;l.style.height=t+"px",b.scrollTop=_-E+b.offsetTop}l.style.margin=`${uN}px 0`,l.style.minHeight=x+"px",l.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,b,y,v,s.dir,o]);lp(()=>x(),[x]);const[S,k]=n.useState();lp(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const N=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(yN,{scope:a,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(Zp.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});gN.displayName="SelectItemAlignedPosition";var bN=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=uN,...i}=e,s=Yk(n);return t(ES,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}})});bN.displayName="SelectPopperPosition";var[yN,vN]=Jk(lN,{}),wN="SelectViewport",xN=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...c}=a,l=pN(wN,i),d=vN(wN,i),u=fd(o,l.onViewportChange),f=n.useRef(0);return e(r,{children:[t("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}),t(Hk.Slot,{scope:i,children:t(Zp.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:zp(c.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*uN,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});xN.displayName=wN;var SN="SelectGroup",[kN,NN]=Jk(SN);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Vp();return t(kN,{scope:n,id:o,children:t(Zp.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=SN;var EN="SelectLabel",CN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=NN(EN,n);return t(Zp.div,{id:o.id,...a,ref:r})});CN.displayName=EN;var AN="SelectItem",[_N,TN]=Jk(AN),RN=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...c}=e,l=Qk(AN,a),d=pN(AN,a),u=l.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=fd(r,e=>d.itemRefCallback?.(e,o,i)),b=Vp(),y=n.useRef("touch"),v=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(""===o)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 t(_N,{scope:a,value:o,disabled:i,textId:b,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(Hk.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(Zp.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...c,ref:g,onFocus:zp(c.onFocus,()=>h(!0)),onBlur:zp(c.onBlur,()=>h(!1)),onClick:zp(c.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:zp(c.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:zp(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:zp(c.onPointerMove,e=>{y.current=e.pointerType,i?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:zp(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:zp(c.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(Gk.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});RN.displayName=AN;var PN="SelectItemText",ON=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:c,...l}=a,d=Qk(PN,i),u=pN(PN,i),f=TN(PN,i),p=tN(PN,i),[m,h]=n.useState(null),g=fd(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),b=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:b},f.value),[f.disabled,f.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return lp(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(Zp.span,{id:f.textId,...l,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?v.createPortal(l.children,d.valueNode):null]})});ON.displayName=PN;var IN="SelectItemIndicator",DN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return TN(IN,n).isSelected?t(Zp.span,{"aria-hidden":!0,...a,ref:r}):null});DN.displayName=IN;var UN="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=pN(UN,e.__scopeSelect),o=vN(UN,e.__scopeSelect),[i,s]=n.useState(!1),c=fd(r,o.onScrollButtonChange);return lp(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(zN,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=UN;var FN="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=pN(FN,e.__scopeSelect),o=vN(FN,e.__scopeSelect),[i,s]=n.useState(!1),c=fd(r,o.onScrollButtonChange);return lp(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(zN,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=FN;var zN=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=pN("SelectScrollButton",a),c=n.useRef(null),l=Zk(a),d=n.useCallback(()=>{null!==c.current&&(window.clearInterval(c.current),c.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),lp(()=>{const e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),t(Zp.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:zp(i.onPointerDown,()=>{null===c.current&&(c.current=window.setInterval(o,50))}),onPointerMove:zp(i.onPointerMove,()=>{s.onItemLeave?.(),null===c.current&&(c.current=window.setInterval(o,50))}),onPointerLeave:zp(i.onPointerLeave,()=>{d()})})}),MN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(Zp.div,{"aria-hidden":!0,...a,ref:r})});MN.displayName="SelectSeparator";var LN="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Yk(n),i=Qk(LN,n),s=pN(LN,n);return i.open&&"popper"===s.position?t(CS,{...o,...a,ref:r}):null}).displayName=LN;var jN=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=fd(o,i),c=Kg(r);return n.useEffect(()=>{const e=i.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]),t(Zp.select,{...a,style:{...Wk,...a.style},ref:s,defaultValue:r})});function $N(e){return""===e||void 0===e}function VN(e){const t=sp(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function WN(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 o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}jN.displayName="SelectBubbleInput";var BN=aN,GN=sN,KN=cN,HN=dN,ZN=xN,qN=CN,JN=RN,YN=ON,XN=DN,QN=MN;const eE=rN,tE=n.forwardRef(({className:r,children:n,...a},o)=>e(BN,{ref:o,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",r),...a,children:[n,t(GN,{asChild:!0,children:t(og,{className:"h-4 w-4 opacity-50"})})]}));tE.displayName=BN.displayName;const rE=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(xo);return t(KN,{container:s,children:t(HN,{ref:i,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"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...o,children:t(ZN,{className:je("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});rE.displayName=HN.displayName;n.forwardRef(({className:e,...r},n)=>t(qN,{ref:n,className:je("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=qN.displayName;const nE=n.forwardRef(({className:r,children:n,...a},o)=>e(JN,{ref:o,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",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(XN,{children:t(sg,{className:"h-4 w-4"})})}),t(YN,{children:n})]}));nE.displayName=JN.displayName;n.forwardRef(({className:e,...r},n)=>t(QN,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=QN.displayName;const aE=({workspace:r})=>{const{user:n}=yo(),[a,o]=f(0),[i,s]=f(!1),[c,l]=f([]),[u,p]=f(null),{getUsers:m,removeUser:h,updateUser:g}=gr(),{settings:b}=pr();d(()=>{r&&(s(!0),m(r._id).then(e=>{l(e)}).catch(e=>{Ye(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{s(!1)}))},[r,a]);const y=()=>{o(e=>e+1)};if(i||!r)return t(Zy,{});const v=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},w=c.map(e=>({...e,...v(e.user)})),x=c.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,S="admin"===x,k=(b?.workspace.maxWorkspaceUsers??Number.MAX_VALUE)>(c.length??0);return e("div",{children:[!S&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),S&&e("div",{className:"mb-4",children:[k&&t(oE,{onInvite:y,workspaceId:r._id}),!k&&t("div",{className:"text-red-500",children:"You have reached the maximum number of users for this workspace."})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600 mb-2",children:[c.length," member",1!==c.length?"s":""]})}),t("div",{children:t(tu,{variant:"ghost",size:"sm",onClick:y,progress:i,children:i?"Refreshing...":"Refresh"})})]}),t("ul",{className:"space-y-2",children:w.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[e("div",{className:"relative",children:[e(eE,{disabled:i||!S||s||u===a.id,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(Xt(r,n)?Ye(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):(p(n),g(t,n,{role:o}).then(()=>{y()}).catch(e=>{Ye(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}).finally(()=>{p(null)})));var t,n,o},children:[t(tE,{children:t(iN,{placeholder:"Select a role"})}),t(rE,{children:r?.roles.map(e=>t(nE,{value:e,children:e},e))})]}),u===a.id&&t("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:t($d,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&S&&t(tu,{variant:"destructive",size:"sm",startIcon:t(Jd,{}),onClick:()=>{var e;e=a.id,Xt(r,e)?Ye(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):h(r._id,e).then(()=>{y()}).catch(t=>{Ye(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===c.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function oE({onInvite:r,workspaceId:n}){const[a,o]=f(""),[i,s]=f("admin"),[c,l]=f(!1),[u,p]=f(null),[m,h]=f(null),{addUser:g,getWorkspace:b}=gr(),[y,v]=f(null),{settings:w}=pr(),x=w?.workspace.roles??y?.roles??[];d(()=>{n&&b(n).then(v)},[n]);const S=()=>{p(null),h(null),o(""),s("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[u&&t("div",{className:"text-red-500 capitalize",children:u}),m&&t("div",{className:"text-green-500 capitalize",children:m}),e("div",{children:[t(iu,{children:"Invite member by email"}),t(bu,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(iu,{children:"Role"}),e(eE,{value:i,onValueChange:s,children:[t(tE,{children:t(iN,{placeholder:"Select a role"})}),t(rE,{children:x.map(e=>t(nE,{value:e,children:e},e))})]})]}),t("div",{children:t(tu,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void p("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(l(!0),await g(n,e,i).then(()=>{h("User invited successfully"),r?.()}).catch(t=>{Ye(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:i}}),p(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{l(!1),setTimeout(()=>{S()},6e3)})):p("Invalid email address format")},disabled:c||!a||!i,children:c?"Inviting...":`Invite as ${i}`})})]})}const iE=({workspace:r,section:n,setSection:a})=>{const{user:o}=yo(),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id;return e("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("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:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:je("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(sE,{title:"Account",children:t(cE,{activeSection:n,icon:t(Xd,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(sE,{title:"Workspace",children:[t(cE,{activeSection:n,icon:t(Kd,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(cE,{activeSection:n,icon:t(Qd,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(cE,{activeSection:n,icon:t(Fd,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>a("subscription")}),t(cE,{activeSection:n,icon:t(Id,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>a("usage")}),t(cE,{activeSection:n,icon:t(Zd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),i&&t(cE,{activeSection:n,icon:t(Yd,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function sE({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function cE({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:je("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const lE=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:c,showTrigger:l=!0,trigger:d})=>{const[u,p]=f(!1),[m,h]=f(i),g=void 0!==a?a:u,b=o||p,y=void 0!==s?s:m,v=c||h;if(!r)return null;const w=t(tu,{variant:"outline",size:"icon",children:t(Kd,{className:"h-4 w-4"})});return e(fg,{open:g,onOpenChange:e=>{b(e),!e&&n&&n()},children:[l&&t(pg,{asChild:!0,children:d||w}),e(gg,{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:[t(vg,{className:"sr-only",children:"Workspace settings dialog"}),t(iE,{workspace:r,section:y,setSection:v}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(yg,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===y&&"Account","general"===y&&"Workspace Settings","users"===y&&"Workspace Members","subscription"===y&&"Plan & Billing","usage"===y&&"Usage","features"===y&&"Workspace Features","danger"===y&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===y&&t(hk,{workspace:r}),"general"===y&&t(Sv,{workspace:r}),"users"===y&&t(aE,{workspace:r}),"subscription"===y&&t(Ik,{workspace:r}),"usage"===y&&t(Mk,{}),"features"===y&&t(cv,{workspaceId:r._id?.toString()}),"danger"===y&&t(qy,{workspace:r})]})]})]})]})};var dE=Object.freeze({__proto__:null,WorkspaceSettingsDialog:lE,default:lE});function uE(n){const{isAuthenticated:a,user:o}=yo(),i=S(fr()),{workspaces:s,currentWorkspace:c,loading:l,refreshing:u,switchingToId:p,fetchWorkspaces:m,getFeatures:h,refreshWorkspaces:g,setCurrentWorkspace:b,switchToWorkspace:y}=gr(),{settings:v}=pr(),[w,x]=f(!1),[k,N]=f(0),[E,C]=f(""),A=l||u;d(()=>{a&&i&&(0===s.length?(m(),h()):h())},[a,i]),d(()=>{a&&i&&k>0&&g()},[k,a,i]);const _=s,T=_.filter(e=>e._id!==c?._id).filter(e=>e.name.toLowerCase().includes(E.toLowerCase())),R=v?.workspace.maxWorkspaces??Number.MAX_VALUE,P=_?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===o?.id?.toString()).length,O=R>(P??0);return e(fg,{open:w,onOpenChange:x,children:[t(pg,{children:n.trigger?.(A,c)}),e(gg,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(bg,{children:[e(yg,{className:"flex items-center gap-2",children:[t(Pd,{className:"h-5 w-5"}),"Switch Workspace"]}),t(vg,{children:"Select a workspace to switch to or create a new one."})]}),!o&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),o&&e("div",{className:"flex flex-col gap-4",children:[c&&t(fE,{workspace:c,isCurrentWorkspace:!0,switchToWorkspace:y,switchingToId:p,onClose:()=>x(!1),setCurrentWorkspace:b,setOpen:x,workspacesToUse:_}),t(ly,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",T.length,")"]}),t("div",{children:t(tu,{progress:u,disabled:u,variant:"ghost",onClick:function(){a&&i&&N(e=>e+1)},startIcon:t(Wd,{}),children:u?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(Gd,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(bu,{placeholder:"Search workspaces...",value:E,onChange:e=>C(e.target.value),className:"pl-10"})]}),l?e("div",{className:"flex items-center justify-center py-8",children:[t($d,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===T.length?e("div",{className:"text-center py-8",children:[t(Pd,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:E?"No workspaces found":"No workspaces available"})]}):t(ry,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:T.map(e=>{const r=e._id===c?._id;return t(fE,{workspace:e,isCurrentWorkspace:r,switchToWorkspace:y,switchingToId:p,onClose:()=>x(!1),setCurrentWorkspace:b,setOpen:x,workspacesToUse:_},e._id)})})})]}),O&&e(r,{children:[t(ly,{}),t(pE,{onCreated:()=>{m()}})]})]})]})]})}function fE(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i,switchingToId:s}=r,c=r.isCurrentWorkspace??!1,l=s===n._id,d=n.subscription??null,u=null!=d&&"object"==typeof d?d.plan??null:null,f=u?.name??"";return e("div",{className:je("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":c}),children:[e(Dp,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(Up,{src:n.image&&n.image.trim()?n.image:void 0})}),t(Fp,{children:(p=n.name,p.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(Qd,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]}),f&&t("div",{className:"max-w-fit",children:t("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:t("span",{className:"text-xs",children:f})})})]}),e("div",{className:"flex items-center gap-2",children:[c?null:t(tu,{size:"sm",disabled:null!==s||l,progress:l,onClick:()=>{r.switchToWorkspace(n).then(()=>o(!1)).catch(e=>{Ye(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:n._id}})})},children:"Switch to"}),t(lE,{workspace:n,onClose:()=>{if(c){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var p}function pE(n){const{switching:a}=gr(),[o,i]=f(!1),[s,c]=f("emoji"),[l,d]=f("๐Ÿข"),[u,p]=f(!1),{createWorkspace:m}=gr(),h=ts({resolver:ld(vf({name:Gu().min(2,{message:"Workspace name must be at least 2 characters."}),image:Gu().optional()})),defaultValues:{name:"",image:""}});return e(fg,{open:o,onOpenChange:i,children:[t(pg,{asChild:!0,children:e(tu,{className:"w-full rounded-none",disabled:a,children:[t(Vd,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(gg,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(bg,{children:[t(yg,{children:"Create New Workspace"}),t(vg,{children:"Create a new workspace to get started."})]}),t(su,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){let t="";if("emoji"===s)t=wv(l);else if("url"===s&&e.image)try{new URL(e.image),t=e.image}catch{return void h.setError("image",{message:"Please enter a valid URL"})}p(!0);try{await m(e.name,t),i(!1),h.reset(),d("๐Ÿข"),c("emoji"),n?.onCreated?.()}catch(t){Ye(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{p(!1)}}),children:[t(lu,{control:h.control,name:"name",render:({field:r})=>e(fu,{children:[t(pu,{children:"Workspace Name"}),t(mu,{children:t(bu,{placeholder:"My Awesome Workspace",...r})}),t(gu,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(iu,{className:"text-sm font-medium",children:"Workspace Icon"}),t(hu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(bb,{value:s,onValueChange:e=>c(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(yb,{value:"emoji",id:"emoji"}),e(iu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Hd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(yb,{value:"url",id:"url"}),e(iu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(jd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:l})]}),t(ry,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:xv.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{d(e),h.setValue("image",wv(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===s&&e("div",{className:"flex flex-col gap-y-2",children:[t(lu,{control:h.control,name:"image",render:({field:r})=>e(fu,{children:[t(pu,{children:"Image URL"}),t(mu,{children:t(bu,{placeholder:"https://example.com/image.png",...r})}),t(hu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(gu,{})]})}),h.watch("image")&&h.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:h.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(tu,{type:"button",variant:"outline",onClick:()=>{i(!1),h.reset(),d("๐Ÿข"),c("emoji")},disabled:u,children:"Cancel"}),t(tu,{type:"submit",disabled:u,children:u?e(r,{children:[t($d,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}const mE=(e,t)=>null==e||0===e?"Free":hv(e,t),hE=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var gE=Object.freeze({__proto__:null,default:({open:n,onOpenChange:a,planVersions:o,currentPlanVersionId:i,currentStripePriceId:c,billingCurrency:l,onSelectPlan:u,loading:p=!1})=>{const[m,h]=f(!1),[g,b]=f(null),y=s(()=>kk(c,o),[c,o]),v=y?.interval??null,w=y?.currency??null,x=s(()=>xk(o),[o]),S=s(()=>{const e=l?.trim().toLowerCase();return e?x.includes(e)?[e]:[]:x},[l,x]),[k,N]=f(v||"monthly"),[E,C]=f(()=>w&&S.includes(w)?w:S.length>0?S[0]:""),A=l?.trim()||E;d(()=>{n&&(N(v||"monthly"),w&&S.includes(w)?C(w):S.length>0&&!S.includes(E)&&C(S[0]))},[n,v,w,S]);const _=s(()=>[...o].sort((e,t)=>e.version-t.version),[o]),T=(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())})(_),R=T.filter(e=>"feature"===e.type),P=T.filter(e=>"limit"===e.type),O=T.filter(e=>"quota"===e.type),I=p||m,D=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},U=(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=Sk(e,A,t.slug,r);return n||Nk(e.quotas?.[t.slug],r)}return null},F=(e,t,r)=>{if("feature"===t.type)return!0===e?"โœ“":"โ€”";if("limit"===t.type)return null!=e?String(e):"โ€”";if("quota"===t.type){return Ek("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"โ€”"};return t(fg,{open:n,onOpenChange:a,children:e(gg,{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("div",{className:"flex-shrink-0 p-6 border-b space-y-4",children:[e("div",{children:[t(yg,{className:"text-2xl font-bold",children:"Choose Your Plan"}),t(vg,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e("div",{className:"flex items-center justify-between gap-4",children:[t("div",{className:"flex items-center gap-2",children:!l?.trim()&&S.length>1&&e(r,{children:[t("span",{className:"text-sm text-slate-600",children:"Currency"}),t("select",{"aria-label":"Select billing currency",value:E,onChange:e=>C(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:S.map(e=>{const r=uv(e);return t("option",{value:e,children:r?`${r} ${e.toUpperCase()}`:e.toUpperCase()},e)})})]})}),t("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(r=>{const n=v===r;return t("button",{onClick:()=>N(r),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(k===r?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e("span",{className:"flex items-center gap-1.5",children:["monthly"===r&&"Monthly","quarterly"===r&&"Quarterly","yearly"===r&&"Yearly","yearly"===r&&t("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),n&&i&&t("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},r)})})]})]}),t("div",{className:"flex-1 min-h-0 flex flex-col",children:l?.trim()&&0===S.length?e("div",{className:"text-center py-12 px-4",children:[t("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),t("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===_.length?t("div",{className:"text-center py-12 text-gray-500",children:t("p",{children:"No plans available"})}):t("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:t("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*_.length+"px",borderCollapse:"separate"},children:[e("colgroup",{children:[t("col",{style:{width:280,minWidth:280}}),_.map(e=>t("col",{style:{width:200,minWidth:200}},e._id))]}),t("thead",{children:e("tr",{className:"align-top",children:[t("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),_.map(r=>{const n=r._id===i,o=(e=>{const t=e._id===i,r=v===k;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${D(k)}`,variant:"default",disabled:!1};if(!i)return{label:"Subscribe",variant:"default",disabled:!1};const n=_.findIndex(e=>e._id===i),a=_.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}})(r),s=I&&r._id===g,c=(e=>bk(e,A,k))(r),l=bk(r,A,"monthly")??0,d="monthly"!==k&&null!==c?((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})(l,c,k):null,f=(e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===A.toLowerCase()))(r),y=r.pricingVariants?.length&&r.pricingVariants.some(e=>e.currency?.toLowerCase()===A.toLowerCase())?A:r.plan?.currency??A??"";return t("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)] "+(r._id===i?"bg-blue-50/80":"bg-white"),children:e("div",{className:"flex h-full flex-col gap-3",children:[e("div",{className:"flex items-start justify-between gap-2",children:[t("h3",{className:"text-lg font-bold text-slate-900 truncate",children:r.plan.name}),n&&t("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("div",{className:"flex flex-col items-start",children:[e("div",{className:"flex items-baseline gap-1",children:[t("span",{className:"text-2xl font-bold text-slate-900",children:f&&null!==c||f?mE(c,y):"โ€”"}),null!==c&&c>0&&f&&t("span",{className:"text-sm text-slate-500",children:hE(k)})]}),null!==d&&d>0&&f&&e("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",d,"% vs monthly"]})]}),r.plan.description&&t("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:r.plan.description}),t(tu,{className:"mt-auto w-full",variant:o.variant,disabled:o.disabled||I||!f,progress:s,onClick:()=>(async e=>{if(!(e===i&&v===k||p||m)){h(!0),b(e);try{await u(e,k,A),a(!1)}catch(e){}finally{h(!1),b(null)}}})(r._id),children:s?"Processing...":f?o.label:"Unavailable"})]})},r._id)})]})}),e("tbody",{children:[R.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:_.length,className:"border-t border-slate-200 bg-slate-100"})]}),R.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),_.map(e=>{const n=U(e,r,k),a=e.pricingVariants?.length?A:e.plan?.currency??A??"",o=F(n,r,a),s="feature"===r.type&&!0===n;return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===i?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+(s?"text-emerald-600":"โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]}),P.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:_.length,className:"border-t border-slate-200 bg-slate-100"})]}),P.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),_.map(e=>{const n=U(e,r,k),a=e.pricingVariants?.length?A:e.plan?.currency??A??"",o=F(n,r,a);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===i?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]}),O.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:_.length,className:"border-t border-slate-200 bg-slate-100"})]}),O.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),_.map(e=>{const n=U(e,r,k),a=e.pricingVariants?.length?A:e.plan?.currency??A??"",o=F(n,r,a);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===i?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]})]})]})})})})]})})}});export{x as ApiVersion,st as AuthStatus,dr as BaseApi,Lf as BetaForm,lv as CURRENCY_DISPLAY,dv as CURRENCY_FLAG,pv as PLAN_CURRENCY_CODES,mv as PLAN_CURRENCY_OPTIONS,Vf as PricingPage,Wr as QuotaUsageContextProvider,To as SaaSOSProvider,ur as SettingsApi,Mr as SubscriptionContextProvider,ko as UserApi,Wf as WhenAuthenticated,ep as WhenNoSubscription,rp as WhenQuotaAvailable,np as WhenQuotaExhausted,ap as WhenQuotaOverage,op as WhenQuotaThreshold,Gf as WhenRoles,Qf as WhenSubscription,tp as WhenSubscriptionToPlans,Bf as WhenUnauthenticated,Xf as WhenUserFeatureDisabled,Yf as WhenUserFeatureEnabled,Jf as WhenWorkspaceFeatureDisabled,qf as WhenWorkspaceFeatureEnabled,Kf as WhenWorkspaceRoles,mr as WorkspaceApi,uE as WorkspaceSwitcher,sr as eventEmitter,hv as formatCents,gv as formatOverageRate,bv as formatOverageRateWithLabel,vv as formatQuotaIncludedOverage,Ek as formatQuotaWithPrice,xk as getAvailableCurrenciesFromPlans,bk as getBasePriceCents,kk as getBillingIntervalAndCurrencyFromPriceId,uv as getCurrencyFlag,fv as getCurrencySymbol,wk as getDisplayCurrency,gk as getPricingVariant,Nk as getQuotaDisplayValue,Sk as getQuotaDisplayWithVariant,vk as getQuotaOverageCents,yv as getQuotaUnitLabelFromName,yk as getStripePriceIdForInterval,yr as invalidateQuotaUsage,wr as invalidateSubscription,Ur as useAllQuotaUsage,Pr as useCancelSubscription,Cr as useCreateCheckoutSession,Rr as useInvoice,Tr as useInvoices,Nr as usePlanGroup,Er as usePlanGroupVersions,Sr as usePublicPlanGroupVersion,xr as usePublicPlans,Br as useQuotaUsageContext,Dr as useQuotaUsageStatus,Ir as useRecordUsage,Or as useResumeSubscription,yo as useSaaSAuth,fr as useSaaSOs,pr as useSaaSSettings,gr as useSaaSWorkspaces,kr as useSubscription,Lr as useSubscriptionContext,_r as useSubscriptionManagement,Ar as useUpdateSubscription,Fr as useUsageLogs,Hf as useUserAttributes,Zf as useUserFeatures};
29
+ */function Ep(){return Sp||(Sp=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=a,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue,l=!1,c=!1,d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(a,d){l||void 0===t.startTransition||(l=!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(!c){var f=d();r(u,f)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),c=!0)}var p=(f=n({inst:{value:u,getSnapshot:d}}))[0].inst,m=f[1];return i(function(){p.value=u,p.getSnapshot=d,e(p)&&m({inst:p})},[a,u,d]),o(function(){return e(p)&&m({inst:p}),a(function(){e(p)&&m({inst:p})})},[a]),s(u),u};Np.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Np}function Cp(){return kp||(kp=1,"production"===process.env.NODE_ENV?vp.exports=xp():vp.exports=Ep()),vp.exports}var Ap=Cp();function _p(){return()=>{}}var Tp="Avatar",[Rp]=function(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o);i.displayName=r+"Context";const s=a.length;a=[...a,o];const l=r=>{const{scope:a,children:o,...l}=r,c=a?.[e]?.[s]||i,d=n.useMemo(()=>l,Object.values(l));return t(c.Provider,{value:d,children:o})};return l.displayName=r+"Provider",[l,function(t,a){const l=a?.[e]?.[s]||i,c=n.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},mp(o,...r)]}(Tp),[Pp,Op]=Rp(Tp),Ip=n.forwardRef((e,r)=>{const{__scopeAvatar:a,...o}=e,[i,s]=n.useState("idle");return t(Pp,{scope:a,imageLoadingStatus:i,onImageLoadingStatusChange:s,children:t(yp.span,{...o,ref:r})})});Ip.displayName=Tp;var Dp="AvatarImage",Up=n.forwardRef((e,r)=>{const{__scopeAvatar:a,src:o,onLoadingStatusChange:i=()=>{},...s}=e,l=Op(Dp,a),c=function(e,{referrerPolicy:t,crossOrigin:r}){const a=Ap.useSyncExternalStore(_p,()=>!0,()=>!1),o=n.useRef(null),i=a?(o.current||(o.current=new window.Image),o.current):null,[s,l]=n.useState(()=>zp(i,e));return bp(()=>{l(zp(i,e))},[i,e]),bp(()=>{const e=e=>()=>{l(e)};if(!i)return;const n=e("loaded"),a=e("error");return i.addEventListener("load",n),i.addEventListener("error",a),t&&(i.referrerPolicy=t),"string"==typeof r&&(i.crossOrigin=r),()=>{i.removeEventListener("load",n),i.removeEventListener("error",a)}},[i,r,t]),s}(o,s),d=hp(e=>{i(e),l.onImageLoadingStatusChange(e)});return bp(()=>{"idle"!==c&&d(c)},[c,d]),"loaded"===c?t(yp.img,{...s,ref:r,src:o}):null});Up.displayName=Dp;var Mp="AvatarFallback",Fp=n.forwardRef((e,r)=>{const{__scopeAvatar:a,delayMs:o,...i}=e,s=Op(Mp,a),[l,c]=n.useState(void 0===o);return n.useEffect(()=>{if(void 0!==o){const e=window.setTimeout(()=>c(!0),o);return()=>window.clearTimeout(e)}},[o]),l&&"loaded"!==s.imageLoadingStatus?t(yp.span,{...i,ref:r}):null});function zp(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}Fp.displayName=Mp;var Lp=Ip,jp=Up,$p=Fp;const Vp=n.forwardRef(({className:e,...r},n)=>t(Lp,{ref:n,className:je("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...r}));Vp.displayName=Lp.displayName;const Wp=n.forwardRef(({className:e,...r},n)=>t(jp,{ref:n,className:je("aspect-square h-full w-full",e),...r}));Wp.displayName=jp.displayName;const Bp=n.forwardRef(({className:e,...r},n)=>t($p,{ref:n,className:je("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...r}));function Gp(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Kp(e,r=[]){let a=[];const o=()=>{const t=a.map(e=>n.createContext(e));return function(r){const a=r?.[e]||t;return n.useMemo(()=>({[`__scope${e}`]:{...r,[e]:a}}),[r,a])}};return o.scopeName=e,[function(r,o){const i=n.createContext(o),s=a.length;a=[...a,o];const l=r=>{const{scope:a,children:o,...l}=r,c=a?.[e]?.[s]||i,d=n.useMemo(()=>l,Object.values(l));return t(c.Provider,{value:d,children:o})};return l.displayName=r+"Provider",[l,function(t,a){const l=a?.[e]?.[s]||i,c=n.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${r}\``)}]},Hp(o,...r)]}function Hp(...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 a=r.reduce((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]}),{});return n.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}Bp.displayName=$p.displayName;var Zp=n[" useId ".trim().toString()]||(()=>{}),qp=0;function Jp(e){const[t,r]=n.useState(Zp());return bp(()=>{r(e=>e??String(qp++))},[e]),e||(t?`radix-${t}`:"")}var Yp=n[" useInsertionEffect ".trim().toString()]||bp;function Xp({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[o,i,s]=function({defaultProp:e,onChange:t}){const[r,a]=n.useState(e),o=n.useRef(r),i=n.useRef(t);return Yp(()=>{i.current=t},[t]),n.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,a,i]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:o;{const t=n.useRef(void 0!==e);n.useEffect(()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${a} 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=l},[l,a])}const d=n.useCallback(t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else i(t)},[l,e,i,s]);return[c,d]}function Qp(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var em=Symbol("radix.slottable");function tm(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===em}var rm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=function(e){const r=Qp(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),l=s.find(tm);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{});var nm,am="dismissableLayer.update",om="dismissableLayer.pointerDownOutside",im="dismissableLayer.focusOutside",sm=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lm=n.forwardRef((e,r)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...d}=e,u=n.useContext(sm),[f,p]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=n.useState({}),g=bd(r,e=>p(e)),b=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),w=f?b.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=v,k=function(e,t=globalThis?.document){const r=hp(e),a=n.useRef(!1),o=n.useRef(()=>{});return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){let n=function(){dm(om,r,a,{discrete:!0})};const a={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=n,t.addEventListener("click",o.current,{once:!0})):n()}else t.removeEventListener("click",o.current);a.current=!1},n=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}(e=>{const t=e.target,r=[...u.branches].some(e=>e.contains(t));S&&!r&&(i?.(e),l?.(e),e.defaultPrevented||c?.())},m),N=function(e,t=globalThis?.document){const r=hp(e),a=n.useRef(!1);return n.useEffect(()=>{const e=e=>{if(e.target&&!a.current){dm(im,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}(e=>{const t=e.target;[...u.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||c?.())},m);return function(e,t=globalThis?.document){const r=hp(e);n.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=>{w===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))},m),n.useEffect(()=>{if(f)return a&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(nm=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),cm(),()=>{a&&1===u.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=nm)}},[f,m,a,u]),n.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),cm())},[f,u]),n.useEffect(()=>{const e=()=>h({});return document.addEventListener(am,e),()=>document.removeEventListener(am,e)},[]),t(rm.div,{...d,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:Gp(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Gp(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Gp(e.onPointerDownCapture,k.onPointerDownCapture)})});lm.displayName="DismissableLayer";function cm(){const e=new CustomEvent(am);document.dispatchEvent(e)}function dm(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&&v.flushSync(()=>e.dispatchEvent(t))}(a,o):a.dispatchEvent(o)}n.forwardRef((e,r)=>{const a=n.useContext(sm),o=n.useRef(null),i=bd(r,o);return n.useEffect(()=>{const e=o.current;if(e)return a.branches.add(e),()=>{a.branches.delete(e)}},[a.branches]),t(rm.div,{...e,ref:i})}).displayName="DismissableLayerBranch";var um="focusScope.autoFocusOnMount",fm="focusScope.autoFocusOnUnmount",pm={bubbles:!1,cancelable:!0},mm=n.forwardRef((e,r)=>{const{loop:a=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...l}=e,[c,d]=n.useState(null),u=hp(i),f=hp(s),p=n.useRef(null),m=bd(r,e=>d(e)),h=n.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;n.useEffect(()=>{if(o){let e=function(e){if(h.paused||!c)return;const t=e.target;c.contains(t)?p.current=t:ym(p.current,{select:!0})},t=function(e){if(h.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||ym(p.current,{select:!0}))},r=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&ym(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const n=new MutationObserver(r);return c&&n.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[o,c,h.paused]),n.useEffect(()=>{if(c){vm.add(h);const t=document.activeElement;if(!c.contains(t)){const r=new CustomEvent(um,pm);c.addEventListener(um,u),c.dispatchEvent(r),r.defaultPrevented||(!function(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(ym(n,{select:t}),document.activeElement!==r)return}((e=hm(c),e.filter(e=>"A"!==e.tagName)),{select:!0}),document.activeElement===t&&ym(c))}return()=>{c.removeEventListener(um,u),setTimeout(()=>{const e=new CustomEvent(fm,pm);c.addEventListener(fm,f),c.dispatchEvent(e),e.defaultPrevented||ym(t??document.body,{select:!0}),c.removeEventListener(fm,f),vm.remove(h)},0)}}var e},[c,u,f,h]);const g=n.useCallback(e=>{if(!a&&!o)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,[n,o]=function(e){const t=hm(e),r=gm(t,e),n=gm(t.reverse(),e);return[r,n]}(t);n&&o?e.shiftKey||r!==o?e.shiftKey&&r===n&&(e.preventDefault(),a&&ym(o,{select:!0})):(e.preventDefault(),a&&ym(n,{select:!0})):r===t&&e.preventDefault()}},[a,o,h.paused]);return t(rm.div,{tabIndex:-1,...l,ref:m,onKeyDown:g})});function hm(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 gm(e,t){for(const r of e)if(!bm(r,{upTo:t}))return r}function bm(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 ym(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()}}mm.displayName="FocusScope";var vm=function(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=wm(e,t),e.unshift(t)},remove(t){e=wm(e,t),e[0]?.resume()}}}();function wm(e,t){const r=[...e],n=r.indexOf(t);return-1!==n&&r.splice(n,1),r}var xm=n.forwardRef((e,r)=>{const{container:a,...o}=e,[i,s]=n.useState(!1);bp(()=>s(!0),[]);const l=a||i&&globalThis?.document?.body;return l?w.createPortal(t(rm.div,{...o,ref:r}),l):null});xm.displayName="Portal";var Sm=e=>{const{present:t,children:r}=e,a=function(e){const[t,r]=n.useState(),a=n.useRef(null),o=n.useRef(e),i=n.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return n.useReducer((e,r)=>t[e][r]??e,e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect(()=>{const e=km(a.current);i.current="mounted"===l?e:"none"},[l]),bp(()=>{const t=a.current,r=o.current;if(r!==e){const n=i.current,a=km(t);if(e)c("MOUNT");else if("none"===a||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}},[e,c]),bp(()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const i=km(a.current).includes(CSS.escape(n.animationName));if(n.target===t&&i&&(c("ANIMATION_END"),!o.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout(()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)})}},s=e=>{e.target===t&&(i.current=km(a.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:n.useCallback(e=>{a.current=e?getComputedStyle(e):null,r(e)},[])}}(t),o="function"==typeof r?r({present:a.isPresent}):n.Children.only(r),i=bd(a.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}(o));return"function"==typeof r||a.isPresent?n.cloneElement(o,{ref:i}):null};function km(e){return e?.animationName||"none"}Sm.displayName="Presence";var Nm=0;function Em(){n.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cm()),document.body.insertAdjacentElement("beforeend",e[1]??Cm()),Nm++,()=>{1===Nm&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Nm--}},[])}function Cm(){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 Am=function(){return Am=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},Am.apply(this,arguments)};function _m(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 Tm="right-scroll-bar-position",Rm="width-before-scroll-bar";function Pm(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Om="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,Im=new WeakMap;function Dm(e,t){var r,n,a,o=(r=null,n=function(t){return e.forEach(function(e){return Pm(e,t)})},(a=f(function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}})[0]).callback=n,a.facade);return Om(function(){var t=Im.get(o);if(t){var r=new Set(t),n=new Set(e),a=o.current;r.forEach(function(e){n.has(e)||Pm(e,null)}),n.forEach(function(e){r.has(e)||Pm(e,a)})}Im.set(o,e)},[e]),o}function Um(e){return e}var Mm=function(e){var t=e.sideCar,r=_m(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return n.createElement(a,Am({},r))};Mm.isSideCarExport=!0;var Fm=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=Um);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 o=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(o)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}(null);return t.options=Am({async:!0,ssr:!1},e),t}(),zm=function(){},Lm=n.forwardRef(function(e,t){var r=n.useRef(null),a=n.useState({onScrollCapture:zm,onWheelCapture:zm,onTouchMoveCapture:zm}),o=a[0],i=a[1],s=e.forwardProps,l=e.children,c=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,w=e.gapMode,x=_m(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=p,k=Dm([r,t]),N=Am(Am({},x),o);return n.createElement(n.Fragment,null,u&&n.createElement(S,{sideCar:Fm,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!b,lockRef:r,gapMode:w}),s?n.cloneElement(n.Children.only(l),Am(Am({},N),{ref:k})):n.createElement(v,Am({},N,{className:c,ref:k}),l))});Lm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Lm.classNames={fullWidth:Rm,zeroRight:Tm};function jm(){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 $m=function(){var e=0,t=null;return{add:function(r){var n,a;0==e&&(t=jm())&&(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)}}},Vm=function(){var e,t=(e=$m(),function(t,r){n.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}},Wm={left:0,top:0,right:0,gap:0},Bm=function(e){return parseInt(e||"",10)||0},Gm=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Wm;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[Bm(r),Bm(n),Bm(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])}},Km=Vm(),Hm="data-scroll-locked",Zm=function(e,t,r,n){var a=e.left,o=e.top,i=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(Hm,"] {\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(o,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(Tm," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Rm," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(Tm," .").concat(Tm," {\n right: 0 ").concat(n,";\n }\n \n .").concat(Rm," .").concat(Rm," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(Hm,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},qm=function(){var e=parseInt(document.body.getAttribute(Hm)||"0",10);return isFinite(e)?e:0},Jm=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,o=void 0===a?"margin":a;n.useEffect(function(){return document.body.setAttribute(Hm,(qm()+1).toString()),function(){var e=qm()-1;e<=0?document.body.removeAttribute(Hm):document.body.setAttribute(Hm,e.toString())}},[]);var i=n.useMemo(function(){return Gm(o)},[o]);return n.createElement(Km,{styles:Zm(i,!t,o,r?"":"!important")})},Ym=!1;if("undefined"!=typeof window)try{var Xm=Object.defineProperty({},"passive",{get:function(){return Ym=!0,!0}});window.addEventListener("test",Xm,Xm),window.removeEventListener("test",Xm,Xm)}catch(e){Ym=!1}var Qm=!!Ym&&{passive:!1},eh=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])},th=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),rh(e,n)){var a=nh(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},rh=function(e,t){return"v"===e?function(e){return eh(e,"overflowY")}(t):function(e){return eh(e,"overflowX")}(t)},nh=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)},ah=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oh=function(e){return[e.deltaX,e.deltaY]},ih=function(e){return e&&"current"in e?e.current:e},sh=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},lh=0,ch=[];function dh(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var uh,fh=(uh=function(e){var t=n.useRef([]),r=n.useRef([0,0]),a=n.useRef(),o=n.useState(lh++)[0],i=n.useState(Vm)[0],s=n.useRef(e);n.useEffect(function(){s.current=e},[e]),n.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;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(ih),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=n.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!s.current.allowPinchZoom;var n,o=ah(e),i=r.current,l="deltaX"in e?e.deltaX:i[0]-o[0],c="deltaY"in e?e.deltaY:i[1]-o[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"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=th(u,d);if(!m)return!0;if(m?n=u:(n="v"===u?"h":"v",m=th(u,d)),!m)return!1;if(!a.current&&"changedTouches"in e&&(l||c)&&(a.current=n),!n)return!0;var h=a.current||n;return function(e,t,r,n){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),o=a*n,i=r.target,s=t.contains(i),l=!1,c=o>0,d=0,u=0;do{if(!i)break;var f=nh(e,i),p=f[0],m=f[1]-f[2]-a*p;(p||m)&&rh(e,i)&&(d+=m,u+=p);var h=i.parentNode;i=h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE?h.host:h}while(!s&&i!==document.body||s&&(t.contains(i)||t===i));return(c&&Math.abs(d)<1||!c&&Math.abs(u)<1)&&(l=!0),l}(h,t,e,"h"===h?l:c)},[]),c=n.useCallback(function(e){var r=e;if(ch.length&&ch[ch.length-1]===i){var n="deltaY"in r?oh(r):ah(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 o=(s.current.shards||[]).map(ih).filter(Boolean).filter(function(e){return e.contains(r.target)});(o.length>0?l(r,o[0]):!s.current.noIsolation)&&r.cancelable&&r.preventDefault()}}},[]),d=n.useCallback(function(e,r,n,a){var o={name:e,delta:r,target:n,should:a,shadowParent:dh(n)};t.current.push(o),setTimeout(function(){t.current=t.current.filter(function(e){return e!==o})},1)},[]),u=n.useCallback(function(e){r.current=ah(e),a.current=void 0},[]),f=n.useCallback(function(t){d(t.type,oh(t),t.target,l(t,e.lockRef.current))},[]),p=n.useCallback(function(t){d(t.type,ah(t),t.target,l(t,e.lockRef.current))},[]);n.useEffect(function(){return ch.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Qm),document.addEventListener("touchmove",c,Qm),document.addEventListener("touchstart",u,Qm),function(){ch=ch.filter(function(e){return e!==i}),document.removeEventListener("wheel",c,Qm),document.removeEventListener("touchmove",c,Qm),document.removeEventListener("touchstart",u,Qm)}},[]);var m=e.removeScrollBar,h=e.inert;return n.createElement(n.Fragment,null,h?n.createElement(i,{styles:sh(o)}):null,m?n.createElement(Jm,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},Fm.useMedium(uh),Mm),ph=n.forwardRef(function(e,t){return n.createElement(Lm,Am({},e,{ref:t,sideCar:fh}))});ph.classNames=Lm.classNames;var mh=new WeakMap,hh=new WeakMap,gh={},bh=0,yh=function(e){return e&&(e.host||yh(e.parentNode))},vh=function(e,t,r,n){var a=function(e,t){return t.map(function(t){if(e.contains(t))return t;var r=yh(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]);gh[r]||(gh[r]=new WeakMap);var o=gh[r],i=[],s=new Set,l=new Set(a),c=function(e){e&&!s.has(e)&&(s.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))d(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(mh.get(e)||0)+1,c=(o.get(e)||0)+1;mh.set(e,l),o.set(e,c),i.push(e),1===l&&a&&hh.set(e,!0),1===c&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),s.clear(),bh++,function(){i.forEach(function(e){var t=mh.get(e)-1,a=o.get(e)-1;mh.set(e,t),o.set(e,a),t||(hh.has(e)||e.removeAttribute(n),hh.delete(e)),a||e.removeAttribute(r)}),--bh||(mh=new WeakMap,mh=new WeakMap,hh=new WeakMap,gh={})}},wh=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"))),vh(n,a,r,"aria-hidden")):function(){return null}};function xh(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sh=Symbol("radix.slottable");function kh(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Sh}var Nh="Dialog",[Eh,Ch]=Kp(Nh),[Ah,_h]=Eh(Nh),Th=e=>{const{__scopeDialog:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,c=n.useRef(null),d=n.useRef(null),[u,f]=Xp({prop:o,defaultProp:i??!1,onChange:s,caller:Nh});return t(Ah,{scope:r,triggerRef:c,contentRef:d,contentId:Jp(),titleId:Jp(),descriptionId:Jp(),open:u,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:l,children:a})};Th.displayName=Nh;var Rh="DialogTrigger",Ph=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=_h(Rh,n),i=bd(r,o.triggerRef);return t(rm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Yh(o.open),...a,ref:i,onClick:Gp(e.onClick,o.onOpenToggle)})});Ph.displayName=Rh;var Oh="DialogPortal",[Ih,Dh]=Eh(Oh,{forceMount:void 0}),Uh=e=>{const{__scopeDialog:r,forceMount:a,children:o,container:i}=e,s=_h(Oh,r);return t(Ih,{scope:r,forceMount:a,children:n.Children.map(o,e=>t(Sm,{present:a||s.open,children:t(xm,{asChild:!0,container:i,children:e})}))})};Uh.displayName=Oh;var Mh="DialogOverlay",Fh=n.forwardRef((e,r)=>{const n=Dh(Mh,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=_h(Mh,e.__scopeDialog);return i.modal?t(Sm,{present:a||i.open,children:t(Lh,{...o,ref:r})}):null});Fh.displayName=Mh;var zh=function(e){const r=xh(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),l=s.find(kh);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("DialogOverlay.RemoveScroll"),Lh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=_h(Mh,n);return t(ph,{as:zh,allowPinchZoom:!0,shards:[o.contentRef],children:t(rm.div,{"data-state":Yh(o.open),...a,ref:r,style:{pointerEvents:"auto",...a.style}})})}),jh="DialogContent",$h=n.forwardRef((e,r)=>{const n=Dh(jh,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,i=_h(jh,e.__scopeDialog);return t(Sm,{present:a||i.open,children:i.modal?t(Vh,{...o,ref:r}):t(Wh,{...o,ref:r})})});$h.displayName=jh;var Vh=n.forwardRef((e,r)=>{const a=_h(jh,e.__scopeDialog),o=n.useRef(null),i=bd(r,a.contentRef,o);return n.useEffect(()=>{const e=o.current;if(e)return wh(e)},[]),t(Bh,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gp(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:Gp(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:Gp(e.onFocusOutside,e=>e.preventDefault())})}),Wh=n.forwardRef((e,r)=>{const a=_h(jh,e.__scopeDialog),o=n.useRef(!1),i=n.useRef(!1);return t(Bh,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),Bh=n.forwardRef((a,o)=>{const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:c,...d}=a,u=_h(jh,i),f=n.useRef(null),p=bd(o,f);return Em(),e(r,{children:[t(mm,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:l,onUnmountAutoFocus:c,children:t(lm,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Yh(u.open),...d,ref:p,onDismiss:()=>u.onOpenChange(!1)})}),e(r,{children:[t(tg,{titleId:u.titleId}),t(rg,{contentRef:f,descriptionId:u.descriptionId})]})]})}),Gh="DialogTitle",Kh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=_h(Gh,n);return t(rm.h2,{id:o.titleId,...a,ref:r})});Kh.displayName=Gh;var Hh="DialogDescription",Zh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=_h(Hh,n);return t(rm.p,{id:o.descriptionId,...a,ref:r})});Zh.displayName=Hh;var qh="DialogClose",Jh=n.forwardRef((e,r)=>{const{__scopeDialog:n,...a}=e,o=_h(qh,n);return t(rm.button,{type:"button",...a,ref:r,onClick:Gp(e.onClick,()=>o.onOpenChange(!1))})});function Yh(e){return e?"open":"closed"}Jh.displayName=qh;var Xh="DialogTitleWarning",[Qh,eg]=function(e,r){const a=n.createContext(r),o=e=>{const{children:r,...o}=e,i=n.useMemo(()=>o,Object.values(o));return t(a.Provider,{value:i,children:r})};return o.displayName=e+"Provider",[o,function(t){const o=n.useContext(a);if(o)return o;if(void 0!==r)return r;throw new Error(`\`${t}\` must be used within \`${e}\``)}]}(Xh,{contentName:jh,titleName:Gh,docsSlug:"dialog"}),tg=({titleId:e})=>{const t=eg(Xh),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 n.useEffect(()=>{if(e){document.getElementById(e)||console.error(r)}},[r,e]),null},rg=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${eg("DialogDescriptionWarning").contentName}}.`;return n.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");if(t&&n){document.getElementById(t)||console.warn(r)}},[r,e,t]),null},ng=Th,ag=Ph,og=Uh,ig=Fh,sg=$h,lg=Kh,cg=Zh,dg=Jh;function ug(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}var fg=["color"],pg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ug(e,fg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),mg=["color"],hg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ug(e,mg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),gg=["color"],bg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ug(e,gg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))}),yg=["color"],vg=g(function(e,t){var r=e.color,n=void 0===r?"currentColor":r,a=ug(e,yg);return b("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a,{ref:t}),b("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:n,fillRule:"evenodd",clipRule:"evenodd"}))});const wg=ng,xg=ag,Sg=og,kg=n.forwardRef(({className:e,...r},n)=>t(ig,{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",e),...r}));kg.displayName=ig.displayName;const Ng=n.forwardRef(({className:r,children:a,...o},i)=>{const{container:s}=n.useContext(Eo);return e(Sg,{container:s,children:[t(kg,{}),e(sg,{ref:i,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",r),...o,children:[a,e(dg,{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:[t(bg,{className:"h-4 w-4"}),t("span",{className:"sr-only",children:"Close"})]})]})]})});Ng.displayName=sg.displayName;const Eg=({className:e,...r})=>t("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",e),...r});Eg.displayName="DialogHeader";const Cg=n.forwardRef(({className:e,...r},n)=>t(lg,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",e),...r}));Cg.displayName=lg.displayName;const Ag=n.forwardRef(({className:e,...r},n)=>t(cg,{ref:n,className:je("text-sm text-muted-foreground",e),...r}));function _g(e){const r=Tg(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),l=s.find(Pg);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}function Tg(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Ag.displayName=cg.displayName;var Rg=Symbol("radix.slottable");function Pg(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Rg}function Og(e){const r=e+"CollectionProvider",[n,o]=Kp(r),[i,s]=n(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:n}=e,o=a.useRef(null),s=a.useRef(new Map).current;return t(i,{scope:r,itemMap:s,collectionRef:o,children:n})};l.displayName=r;const c=e+"CollectionSlot",d=_g(c),u=a.forwardRef((e,r)=>{const{scope:n,children:a}=e,o=bd(r,s(c,n).collectionRef);return t(d,{ref:o,children:a})});u.displayName=c;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=_g(f),h=a.forwardRef((e,r)=>{const{scope:n,children:o,...i}=e,l=a.useRef(null),c=bd(r,l),d=s(f,n);return a.useEffect(()=>(d.itemMap.set(l,{ref:l,...i}),()=>{d.itemMap.delete(l)})),t(m,{[p]:"",ref:c,children:o})});return h.displayName=f,[{Provider:l,Slot:u,ItemSlot:h},function(t){const r=s(e+"CollectionConsumer",t),n=a.useCallback(()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`)),n=Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current));return n},[r.collectionRef,r.itemMap]);return n},o]}var Ig=n.createContext(void 0);function Dg(e){const t=n.useContext(Ig);return e||t||"ltr"}var Ug="rovingFocusGroup.onEntryFocus",Mg={bubbles:!1,cancelable:!0},Fg="RovingFocusGroup",[zg,Lg,jg]=Og(Fg),[$g,Vg]=Kp(Fg,[jg]),[Wg,Bg]=$g(Fg),Gg=n.forwardRef((e,r)=>t(zg.Provider,{scope:e.__scopeRovingFocusGroup,children:t(zg.Slot,{scope:e.__scopeRovingFocusGroup,children:t(Kg,{...e,ref:r})})}));Gg.displayName=Fg;var Kg=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=n.useRef(null),h=bd(r,m),g=Dg(s),[b,y]=Xp({prop:l,defaultProp:c??null,onChange:d,caller:Fg}),[v,w]=n.useState(!1),x=hp(u),S=Lg(a),k=n.useRef(!1),[N,E]=n.useState(0);return n.useEffect(()=>{const e=m.current;if(e)return e.addEventListener(Ug,x),()=>e.removeEventListener(Ug,x)},[x]),t(Wg,{scope:a,orientation:o,dir:g,loop:i,currentTabStopId:b,onItemFocus:n.useCallback(e=>y(e),[y]),onItemShiftTab:n.useCallback(()=>w(!0),[]),onFocusableItemAdd:n.useCallback(()=>E(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>E(e=>e-1),[]),children:t(rm.div,{tabIndex:v||0===N?-1:0,"data-orientation":o,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:Gp(e.onMouseDown,()=>{k.current=!0}),onFocus:Gp(e.onFocus,e=>{const t=!k.current;if(e.target===e.currentTarget&&t&&!v){const t=new CustomEvent(Ug,Mg);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=S().filter(e=>e.focusable);Jg([e.find(e=>e.active),e.find(e=>e.id===b),...e].filter(Boolean).map(e=>e.ref.current),f)}}k.current=!1}),onBlur:Gp(e.onBlur,()=>w(!1))})})}),Hg="RovingFocusGroupItem",Zg=n.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:a,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...c}=e,d=Jp(),u=s||d,f=Bg(Hg,a),p=f.currentTabStopId===u,m=Lg(a),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=f;return n.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),t(zg.ItemSlot,{scope:a,id:u,focusable:o,active:i,children:t(rm.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...c,ref:r,onMouseDown:Gp(e.onMouseDown,e=>{o?f.onItemFocus(u):e.preventDefault()}),onFocus:Gp(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:Gp(e.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:qg[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(()=>Jg(r))}}),children:"function"==typeof l?l({isCurrentTabStop:p,hasTabStop:null!=b}):l})})});Zg.displayName=Hg;var qg={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jg(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 Yg=Gg,Xg=Zg;function Qg(e){const[t,r]=n.useState(void 0);return bp(()=>{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,o;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;r({width:a,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}function eb(e){const t=n.useRef({value:e,previous:e});return n.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var tb="Radio",[rb,nb]=Kp(tb),[ab,ob]=rb(tb),ib=n.forwardRef((r,a)=>{const{__scopeRadio:o,name:i,checked:s=!1,required:l,disabled:c,value:d="on",onCheck:u,form:f,...p}=r,[m,h]=n.useState(null),g=bd(a,e=>h(e)),b=n.useRef(!1),y=!m||(f||!!m.closest("form"));return e(ab,{scope:o,checked:s,disabled:c,children:[t(rm.button,{type:"button",role:"radio","aria-checked":s,"data-state":db(s),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:g,onClick:Gp(r.onClick,e=>{s||u?.(),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&t(cb,{control:m,bubbles:!b.current,name:i,value:d,checked:s,required:l,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});ib.displayName=tb;var sb="RadioIndicator",lb=n.forwardRef((e,r)=>{const{__scopeRadio:n,forceMount:a,...o}=e,i=ob(sb,n);return t(Sm,{present:a||i.checked,children:t(rm.span,{"data-state":db(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r})})});lb.displayName=sb;var cb=n.forwardRef(({__scopeRadio:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const l=n.useRef(null),c=bd(l,s),d=eb(a),u=Qg(r);return n.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t(rm.input,{type:"radio","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:c,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function db(e){return e?"checked":"unchecked"}cb.displayName="RadioBubbleInput";var ub=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],fb="RadioGroup",[pb]=Kp(fb,[Vg,nb]),mb=Vg(),hb=nb(),[gb,bb]=pb(fb),yb=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,name:a,defaultValue:o,value:i,required:s=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:f,...p}=e,m=mb(n),h=Dg(d),[g,b]=Xp({prop:i,defaultProp:o??null,onChange:f,caller:fb});return t(gb,{scope:n,name:a,required:s,disabled:l,value:g,onValueChange:b,children:t(Yg,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:t(rm.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:h,...p,ref:r})})})});yb.displayName=fb;var vb="RadioGroupItem",wb=n.forwardRef((e,r)=>{const{__scopeRadioGroup:a,disabled:o,...i}=e,s=bb(vb,a),l=s.disabled||o,c=mb(a),d=hb(a),u=n.useRef(null),f=bd(r,u),p=s.value===i.value,m=n.useRef(!1);return n.useEffect(()=>{const e=e=>{ub.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)}},[]),t(Xg,{asChild:!0,...c,focusable:!l,active:p,children:t(ib,{disabled:l,required:s.required,checked:p,...d,...i,name:s.name,ref:f,onCheck:()=>s.onValueChange(i.value),onKeyDown:Gp(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:Gp(i.onFocus,()=>{m.current&&u.current?.click()})})})});wb.displayName=vb;var xb=n.forwardRef((e,r)=>{const{__scopeRadioGroup:n,...a}=e,o=hb(n);return t(lb,{...o,...a,ref:r})});xb.displayName="RadioGroupIndicator";var Sb=yb,kb=wb,Nb=xb;const Eb=n.forwardRef(({className:e,...r},n)=>t(Sb,{className:je("grid gap-2",e),...r,ref:n}));Eb.displayName=Sb.displayName;const Cb=n.forwardRef(({className:e,...r},n)=>t(kb,{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",e),...r,children:t(Nb,{className:"flex items-center justify-center",children:t(hg,{className:"h-3.5 w-3.5 fill-primary"})})}));function Ab(e,[t,r]){return Math.min(r,Math.max(t,e))}Cb.displayName=kb.displayName;var _b="ScrollArea",[Tb]=Kp(_b),[Rb,Pb]=Tb(_b),Ob=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,type:o="hover",dir:i,scrollHideDelay:s=600,...l}=e,[c,d]=n.useState(null),[u,f]=n.useState(null),[p,m]=n.useState(null),[h,g]=n.useState(null),[b,y]=n.useState(null),[v,w]=n.useState(0),[x,S]=n.useState(0),[k,N]=n.useState(!1),[E,C]=n.useState(!1),A=bd(r,e=>d(e)),_=Dg(i);return t(Rb,{scope:a,type:o,dir:_,scrollHideDelay:s,scrollArea:c,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:k,onScrollbarXEnabledChange:N,scrollbarY:b,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:C,onCornerWidthChange:w,onCornerHeightChange:S,children:t(rm.div,{dir:_,...l,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});Ob.displayName=_b;var Ib="ScrollAreaViewport",Db=n.forwardRef((a,o)=>{const{__scopeScrollArea:i,children:s,nonce:l,...c}=a,d=Pb(Ib,i),u=bd(o,n.useRef(null),d.onViewportChange);return e(r,{children:[t("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:l}),t(rm.div,{"data-radix-scroll-area-viewport":"",...c,ref:u,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...a.style},children:t("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Db.displayName=Ib;var Ub="ScrollAreaScrollbar",Mb=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Pb(Ub,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=i,c="horizontal"===e.orientation;return n.useEffect(()=>(c?s(!0):l(!0),()=>{c?s(!1):l(!1)}),[c,s,l]),"hover"===i.type?t(Fb,{...o,ref:r,forceMount:a}):"scroll"===i.type?t(zb,{...o,ref:r,forceMount:a}):"auto"===i.type?t(Lb,{...o,ref:r,forceMount:a}):"always"===i.type?t(jb,{...o,ref:r}):null});Mb.displayName=Ub;var Fb=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Pb(Ub,e.__scopeScrollArea),[s,l]=n.useState(!1);return n.useEffect(()=>{const e=i.scrollArea;let t=0;if(e){const r=()=>{window.clearTimeout(t),l(!0)},n=()=>{t=window.setTimeout(()=>l(!1),i.scrollHideDelay)};return e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",n),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",n)}}},[i.scrollArea,i.scrollHideDelay]),t(Sm,{present:a||s,children:t(Lb,{"data-state":s?"visible":"hidden",...o,ref:r})})}),zb=n.forwardRef((e,r)=>{const{forceMount:a,...o}=e,i=Pb(Ub,e.__scopeScrollArea),s="horizontal"===e.orientation,l=oy(()=>d("SCROLL_END"),100),[c,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"}},n.useReducer((e,t)=>f[e][t]??e,u));var u,f;return n.useEffect(()=>{if("idle"===c){const e=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[c,i.scrollHideDelay,d]),n.useEffect(()=>{const e=i.viewport,t=s?"scrollLeft":"scrollTop";if(e){let r=e[t];const n=()=>{const n=e[t];r!==n&&(d("SCROLL"),l()),r=n};return e.addEventListener("scroll",n),()=>e.removeEventListener("scroll",n)}},[i.viewport,s,d,l]),t(Sm,{present:a||"hidden"!==c,children:t(jb,{"data-state":"hidden"===c?"hidden":"visible",...o,ref:r,onPointerEnter:Gp(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Gp(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Lb=n.forwardRef((e,r)=>{const a=Pb(Ub,e.__scopeScrollArea),{forceMount:o,...i}=e,[s,l]=n.useState(!1),c="horizontal"===e.orientation,d=oy(()=>{if(a.viewport){const e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;l(c?e:t)}},10);return iy(a.viewport,d),iy(a.content,d),t(Sm,{present:o||s,children:t(jb,{"data-state":s?"visible":"hidden",...i,ref:r})})}),jb=n.forwardRef((e,r)=>{const{orientation:a="vertical",...o}=e,i=Pb(Ub,e.__scopeScrollArea),s=n.useRef(null),l=n.useRef(0),[c,d]=n.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Qb(c.viewport,c.content),f={...o,sizes:c,onSizesChange:d,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,r,n="ltr"){const a=ey(r),o=a/2,i=t||o,s=a-i,l=r.scrollbar.paddingStart+i,c=r.scrollbar.size-r.scrollbar.paddingEnd-s,d=r.content-r.viewport,u="ltr"===n?[0,d]:[-1*d,0];return ry([l,c],u)(e)}(e,l.current,c,t)}return"horizontal"===a?t($b,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ty(i.viewport.scrollLeft,c,i.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):"vertical"===a?t(Vb,{...f,ref:r,onThumbPositionChange:()=>{if(i.viewport&&s.current){const e=ty(i.viewport.scrollTop,c);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),$b=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Pb(Ub,e.__scopeScrollArea),[l,c]=n.useState(),d=n.useRef(null),u=bd(r,d,s.onScrollbarXChange);return n.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),t(Gb,{"data-orientation":"horizontal",...i,ref:u,sizes:a,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ey(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollLeft+t.deltaX;e.onWheelScroll(n),ny(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Xb(l.paddingLeft),paddingEnd:Xb(l.paddingRight)}})}})}),Vb=n.forwardRef((e,r)=>{const{sizes:a,onSizesChange:o,...i}=e,s=Pb(Ub,e.__scopeScrollArea),[l,c]=n.useState(),d=n.useRef(null),u=bd(r,d,s.onScrollbarYChange);return n.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),t(Gb,{"data-orientation":"vertical",...i,ref:u,sizes:a,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ey(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,r)=>{if(s.viewport){const n=s.viewport.scrollTop+t.deltaY;e.onWheelScroll(n),ny(n,r)&&t.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Xb(l.paddingTop),paddingEnd:Xb(l.paddingBottom)}})}})}),[Wb,Bb]=Tb(Ub),Gb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,sizes:o,hasThumb:i,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=Pb(Ub,a),[g,b]=n.useState(null),y=bd(r,e=>b(e)),v=n.useRef(null),w=n.useRef(""),x=h.viewport,S=o.content-o.viewport,k=hp(f),N=hp(d),E=oy(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 n.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})},[x,g,S,k]),n.useEffect(N,[o,N]),iy(g,E),iy(h.content,E),t(Wb,{scope:a,scrollbar:g,hasThumb:i,onThumbChange:hp(s),onThumbPointerUp:hp(l),onThumbPositionChange:N,onThumbPointerDown:hp(c),children:t(rm.div,{...m,ref:y,style:{position:"absolute",...m.style},onPointerDown:Gp(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),C(e)}}),onPointerMove:Gp(e.onPointerMove,C),onPointerUp:Gp(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),Kb="ScrollAreaThumb",Hb=n.forwardRef((e,r)=>{const{forceMount:n,...a}=e,o=Bb(Kb,e.__scopeScrollArea);return t(Sm,{present:n||o.hasThumb,children:t(Zb,{ref:r,...a})})}),Zb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,style:o,...i}=e,s=Pb(Kb,a),l=Bb(Kb,a),{onThumbPositionChange:c}=l,d=bd(r,e=>l.onThumbChange(e)),u=n.useRef(void 0),f=oy(()=>{u.current&&(u.current(),u.current=void 0)},100);return n.useEffect(()=>{const e=s.viewport;if(e){const t=()=>{if(f(),!u.current){const t=ay(e,c);u.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[s.viewport,f,c]),t(rm.div,{"data-state":l.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Gp(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=e.clientY-t.top;l.onThumbPointerDown({x:r,y:n})}),onPointerUp:Gp(e.onPointerUp,l.onThumbPointerUp)})});Hb.displayName=Kb;var qb="ScrollAreaCorner",Jb=n.forwardRef((e,r)=>{const n=Pb(qb,e.__scopeScrollArea),a=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&a?t(Yb,{...e,ref:r}):null});Jb.displayName=qb;var Yb=n.forwardRef((e,r)=>{const{__scopeScrollArea:a,...o}=e,i=Pb(qb,a),[s,l]=n.useState(0),[c,d]=n.useState(0),u=Boolean(s&&c);return iy(i.scrollbarX,()=>{const e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),d(e)}),iy(i.scrollbarY,()=>{const e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),l(e)}),u?t(rm.div,{...o,ref:r,style:{width:s,height:c,position:"absolute",right:"ltr"===i.dir?0:void 0,left:"rtl"===i.dir?0:void 0,bottom:0,...e.style}}):null});function Xb(e){return e?parseInt(e,10):0}function Qb(e,t){const r=e/t;return isNaN(r)?0:r}function ey(e){const t=Qb(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function ty(e,t,r="ltr"){const n=ey(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,i=t.content-t.viewport,s=o-n,l=Ab(e,"ltr"===r?[0,i]:[-1*i,0]);return ry([0,i],[0,s])(l)}function ry(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 ny(e,t){return e>0&&e<t}var ay=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},i=r.left!==o.left,s=r.top!==o.top;(i||s)&&t(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function oy(e,t){const r=hp(e),a=n.useRef(0);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),n.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function iy(e,t){const r=hp(t);bp(()=>{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 sy=Ob,ly=Db,cy=Jb;const dy=n.forwardRef(({className:r,children:n,...a},o)=>e(sy,{ref:o,className:je("relative overflow-hidden",r),...a,children:[t(ly,{className:"h-full w-full rounded-[inherit]",children:n}),t(uy,{}),t(cy,{})]}));dy.displayName=sy.displayName;const uy=n.forwardRef(({className:e,orientation:r="vertical",...n},a)=>t(Mb,{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]",e),...n,children:t(Hb,{className:je("relative rounded-full bg-border","vertical"===r&&"flex-1")})}));uy.displayName=Mb.displayName;var fy=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{const a=xd(`Primitive.${r}`),o=n.forwardRef((e,n)=>{const{asChild:o,...i}=e,s=o?a:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t(s,{...i,ref:n})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),py="horizontal",my=["horizontal","vertical"],hy=n.forwardRef((e,r)=>{const{decorative:n,orientation:a=py,...o}=e,i=function(e){return my.includes(e)}(a)?a:py,s=n?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"};return t(fy.div,{"data-orientation":i,...s,...o,ref:r})});hy.displayName="Separator";var gy=hy;const by=n.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...a},o)=>t(gy,{ref:o,decorative:n,orientation:r,className:je("shrink-0 bg-border","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",e),...a}));by.displayName=gy.displayName;var yy=Symbol("radix.slottable");var vy="AlertDialog",[wy]=Kp(vy,[Ch]),xy=Ch(),Sy=e=>{const{__scopeAlertDialog:r,...n}=e,a=xy(r);return t(ng,{...a,...n,modal:!0})};Sy.displayName=vy;var ky=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=xy(n);return t(ag,{...o,...a,ref:r})});ky.displayName="AlertDialogTrigger";var Ny=e=>{const{__scopeAlertDialog:r,...n}=e,a=xy(r);return t(og,{...a,...n})};Ny.displayName="AlertDialogPortal";var Ey=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=xy(n);return t(ig,{...o,...a,ref:r})});Ey.displayName="AlertDialogOverlay";var Cy="AlertDialogContent",[Ay,_y]=wy(Cy),Ty=function(e){const n=({children:e})=>t(r,{children:e});return n.displayName=`${e}.Slottable`,n.__radixId=yy,n}("AlertDialogContent"),Ry=n.forwardRef((r,a)=>{const{__scopeAlertDialog:o,children:i,...s}=r,l=xy(o),c=n.useRef(null),d=bd(a,c),u=n.useRef(null);return t(Qh,{contentName:Cy,titleName:Py,docsSlug:"alert-dialog",children:t(Ay,{scope:o,cancelRef:u,children:e(sg,{role:"alertdialog",...l,...s,ref:d,onOpenAutoFocus:Gp(s.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[t(Ty,{children:i}),t(zy,{contentRef:c})]})})})});Ry.displayName=Cy;var Py="AlertDialogTitle",Oy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=xy(n);return t(lg,{...o,...a,ref:r})});Oy.displayName=Py;var Iy="AlertDialogDescription",Dy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=xy(n);return t(cg,{...o,...a,ref:r})});Dy.displayName=Iy;var Uy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,o=xy(n);return t(dg,{...o,...a,ref:r})});Uy.displayName="AlertDialogAction";var My="AlertDialogCancel",Fy=n.forwardRef((e,r)=>{const{__scopeAlertDialog:n,...a}=e,{cancelRef:o}=_y(My,n),i=xy(n),s=bd(r,o);return t(dg,{...i,...a,ref:s})});Fy.displayName=My;var zy=({contentRef:e})=>{const t=`\`${Cy}\` requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the \`${Cy}\` by passing a \`${Iy}\` 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 \`${Cy}\`. 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 n.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Ly=Ey,jy=Ry,$y=Uy,Vy=Fy,Wy=Oy,By=Dy;const Gy=Sy,Ky=ky,Hy=Ny,Zy=n.forwardRef(({className:e,...r},n)=>t(Ly,{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",e),...r,ref:n}));Zy.displayName=Ly.displayName;const qy=n.forwardRef(({className:r,...a},o)=>{const{container:i}=n.useContext(Eo);return e(Hy,{container:i,children:[t(Zy,{}),t(jy,{ref:o,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",r),...a})]})});qy.displayName=jy.displayName;const Jy=({className:e,...r})=>t("div",{className:je("flex flex-col space-y-2 text-center sm:text-left",e),...r});Jy.displayName="AlertDialogHeader";const Yy=({className:e,...r})=>t("div",{className:je("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...r});Yy.displayName="AlertDialogFooter";const Xy=n.forwardRef(({className:e,...r},n)=>t(Wy,{ref:n,className:je("text-lg font-semibold",e),...r}));Xy.displayName=Wy.displayName;const Qy=n.forwardRef(({className:e,...r},n)=>t(By,{ref:n,className:je("text-sm text-muted-foreground",e),...r}));Qy.displayName=By.displayName;const ev=n.forwardRef(({className:e,...r},n)=>t($y,{ref:n,className:je(ou(),e),...r}));ev.displayName=$y.displayName;const tv=n.forwardRef(({className:e,...r},n)=>t(Vy,{ref:n,className:je(ou({variant:"outline"}),"mt-2 sm:mt-0",e),...r}));function rv(){return e("div",{className:"space-y-3.5",children:[t(ku,{className:"h-10 w-full"}),t(ku,{className:"h-10 w-full"}),t(ku,{className:"h-10 w-full"})]})}tv.displayName=Vy.displayName;const nv=({workspace:n})=>{const[a,o]=f(!1),{deleteWorkspace:i}=Sr(),{user:s}=So();if(!n)return t(rv,{});const l=wr(n,s?.id??null);return"admin"===l?.toLowerCase()?e("div",{className:"space-y-4",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold text-destructive",children:"Delete Workspace"}),e("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 ",t("strong",{children:n.name})," and all of its data, including members, settings, and features."]})]}),e(Gy,{children:[t(Ky,{asChild:!0,children:e(iu,{variant:"destructive",disabled:a,progress:a,children:[t(eu,{className:"h-4 w-4 mr-2"}),"Delete Workspace"]})}),e(qy,{children:[e(Jy,{children:[t(Xy,{children:"Are you absolutely sure?"}),e(Qy,{children:["This action cannot be undone. This will permanently delete the workspace"," ",t("strong",{children:n.name})," and all of its data."]})]}),e(Yy,{children:[t(tv,{disabled:a,children:"Cancel"}),t(ev,{onClick:async()=>{o(!0);try{await i(n._id)}catch(e){Ye(e,{component:"WorkspaceSettingsDanger",action:"handleDeleteWorkspace",metadata:{workspaceId:n._id}}),alert(e instanceof Error?e.message:"Failed to delete workspace")}finally{o(!1)}},disabled:a,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:a?e(r,{children:[t(Kd,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):"Delete Workspace"})]})]})]})]}):t("div",{className:"space-y-4",children:t("div",{className:"text-red-500",children:"Only workspace admins can delete workspaces."})})};var av="Switch",[ov]=Kp(av),[iv,sv]=ov(av),lv=n.forwardRef((r,a)=>{const{__scopeSwitch:o,name:i,checked:s,defaultChecked:l,required:c,disabled:d,value:u="on",onCheckedChange:f,form:p,...m}=r,[h,g]=n.useState(null),b=bd(a,e=>g(e)),y=n.useRef(!1),v=!h||(p||!!h.closest("form")),[w,x]=Xp({prop:s,defaultProp:l??!1,onChange:f,caller:av});return e(iv,{scope:o,checked:w,disabled:d,children:[t(rm.button,{type:"button",role:"switch","aria-checked":w,"aria-required":c,"data-state":fv(w),"data-disabled":d?"":void 0,disabled:d,value:u,...m,ref:b,onClick:Gp(r.onClick,e=>{x(e=>!e),v&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),v&&t(uv,{control:h,bubbles:!y.current,name:i,value:u,checked:w,required:c,disabled:d,form:p,style:{transform:"translateX(-100%)"}})]})});lv.displayName=av;var cv="SwitchThumb",dv=n.forwardRef((e,r)=>{const{__scopeSwitch:n,...a}=e,o=sv(cv,n);return t(rm.span,{"data-state":fv(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})});dv.displayName=cv;var uv=n.forwardRef(({__scopeSwitch:e,control:r,checked:a,bubbles:o=!0,...i},s)=>{const l=n.useRef(null),c=bd(l,s),d=eb(a),u=Qg(r);return n.useEffect(()=>{const e=l.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(d!==a&&r){const t=new Event("click",{bubbles:o});r.call(e,a),e.dispatchEvent(t)}},[d,a,o]),t("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:c,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function fv(e){return e?"checked":"unchecked"}uv.displayName="SwitchBubbleInput";var pv=lv,mv=dv;const hv=n.forwardRef(({className:e,...r},n)=>t(pv,{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",e),...r,ref:n,children:t(mv,{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")})}));hv.displayName=pv.displayName;const gv=({workspaceId:r})=>{const[n,a]=f({}),[o,s]=f(null),l=i(null),{allFeatures:c,updateFeature:u,getWorkspace:p}=Sr();d(()=>()=>{l.current&&clearTimeout(l.current)},[]);const[m,h]=f(null),{user:g}=So();if(d(()=>{p(r).then(h)},[r]),!m)return t(rv,{});const b=vr(m,g?.id??null);return e("div",{children:[o&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:o})]}),e("div",{className:"flex flex-col gap-y-3.5 pr-4",children:[!b&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the features."}),!c.length&&t("div",{className:"text-muted-foreground",children:"Workspace has no features to manage."}),c.length>0&&t("div",{className:"flex flex-col gap-y-3.5",children:c.map(r=>{const o=m?.features?.[r.slug],i=null!==n[r.slug]&&void 0!==n[r.slug],d=n[r.slug],f=!0===d?"Enabling":!1===d?"Disabling":"";return e("div",{className:"flex items-center gap-x-2 justify-between w-full",children:[e("div",{className:"flex gap-x-2 flex-col",children:[t("h3",{className:"font-medium text-ellipsis",children:r.name}),t("p",{className:"text-muted-foreground",children:r.description})]}),i?e("div",{className:"flex items-center gap-x-1",children:[t(Kd,{className:"h-4 w-4 animate-spin text-gray-500"}),e("span",{className:"text-sm text-gray-600",children:[f,"..."]})]}):t(hv,{disabled:!b,checked:o??r.defaultValue,onCheckedChange:e=>async function(e,t){if(m){a(r=>({...r,[e]:t})),s(null);try{const r=await u(m._id,e,t);h(r);const n=c.find(t=>t.slug===e);s(`${n?.name||"Feature"} ${t?"enabled":"disabled"} successfully`),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(null)},5e3)}catch(t){Ye(t,{component:"WorkspaceSettingsFeatures",action:"updateFeature",metadata:{workspaceId:m._id,featureKey:e}})}finally{a(t=>({...t,[e]:null}))}}}(r.slug,e)})]},r._id)})})]})]})},bv={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:"เธฟ"},yv={usd:"๐Ÿ‡บ๐Ÿ‡ธ",eur:"๐Ÿ‡ช๐Ÿ‡บ",gbp:"๐Ÿ‡ฌ๐Ÿ‡ง",jpy:"๐Ÿ‡ฏ๐Ÿ‡ต",cad:"๐Ÿ‡จ๐Ÿ‡ฆ",aud:"๐Ÿ‡ฆ๐Ÿ‡บ",chf:"๐Ÿ‡จ๐Ÿ‡ญ",cny:"๐Ÿ‡จ๐Ÿ‡ณ",hkd:"๐Ÿ‡ญ๐Ÿ‡ฐ",sgd:"๐Ÿ‡ธ๐Ÿ‡ฌ",inr:"๐Ÿ‡ฎ๐Ÿ‡ณ",mxn:"๐Ÿ‡ฒ๐Ÿ‡ฝ",brl:"๐Ÿ‡ง๐Ÿ‡ท",nzd:"๐Ÿ‡ณ๐Ÿ‡ฟ",sek:"๐Ÿ‡ธ๐Ÿ‡ช",nok:"๐Ÿ‡ณ๐Ÿ‡ด",dkk:"๐Ÿ‡ฉ๐Ÿ‡ฐ",pln:"๐Ÿ‡ต๐Ÿ‡ฑ",thb:"๐Ÿ‡น๐Ÿ‡ญ"};function vv(e){return e&&e.trim()?yv[e.trim().toLowerCase()]??"":""}function wv(e){if(!e||!e.trim())return"";const t=e.trim().toLowerCase();return bv[t]??t.toUpperCase()}const xv=["usd","eur","gbp","jpy","cad","aud","chf","cny","hkd","sgd","inr","mxn","brl","nzd","sek","nok","dkk","pln","thb"],Sv=xv.map(e=>({value:e,label:`${e.toUpperCase()} (${wv(e)})`}));function kv(e,t){return wv(t)+(e/100).toFixed(2)}function Nv(e,t,r){if(null==e||e<0)return null;const n=null!=t&&t>=1?t:1,a=wv(r),o=(e/100).toFixed(2);return 1===n?`${a}${o}/unit`:`${a}${o}/${n.toLocaleString()} units`}function Ev(e,t,r,n){if(null==e||e<0)return null;const a=null!=t&&t>=1?t:1,o=wv(n),i=(e/100).toFixed(2);if(r){const e=r.endsWith("s")?r:`${r}s`;return a>=2?`${o}${i}/${a.toLocaleString()} ${e}`:`${o}${i}/${r}`}return 1===a?`${o}${i}/unit`:`${o}${i}/${a.toLocaleString()} units`}function Cv(e){const t=(e||"").trim().toLowerCase();if(!t)return"unit";const r=t.split(/\s+/)[0]??t;return new Set(["series","species","status","analysis","basis","bus","campus","corpus","axis"]).has(r)?r:r.endsWith("ies")&&r.length>3?r.slice(0,-3)+"y":r.endsWith("ses")||r.endsWith("xes")||r.endsWith("zes")||r.endsWith("ches")||r.endsWith("shes")?r.slice(0,-2):r.endsWith("s")&&!r.endsWith("ss")&&r.length>1?r.slice(0,-1):r||"unit"}function Av(e,t,r,n,a){const o=r.endsWith("s")?r:`${r}s`,i=null!=a&&a>=2?`${a.toLocaleString()} ${o}`:r;return null!=e&&null!=t?`Included: ${e.toLocaleString()}, after that ${kv(t,n)}/${i}`:null!=e?`Included: ${e.toLocaleString()}`:null!=t?`After included: ${kv(t,n)}/${i}`:"โ€”"}function _v(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.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}</text></svg>`}const Tv=["๐Ÿข","๐Ÿฌ","๐Ÿฃ","๐Ÿค","๐Ÿฆ","๐Ÿ›๏ธ","๐Ÿ ","๐Ÿก","๐Ÿญ","๐Ÿ—๏ธ","๐Ÿช","๐Ÿจ","๐Ÿซ","๐Ÿฅ","๐Ÿ’ผ","๐Ÿ“Š","๐Ÿ“ˆ","๐Ÿ“‰","๐Ÿ“‹","๐Ÿ“","๐Ÿ“‚","๐Ÿ—‚๏ธ","๐Ÿ—ƒ๏ธ","๐Ÿ—„๏ธ","๐Ÿ“…","๐Ÿ—“๏ธ","๐Ÿ“","๐Ÿ–‹๏ธ","โœ๏ธ","๐Ÿ–Š๏ธ","๐Ÿ–Œ๏ธ","๐Ÿ–๏ธ","๐Ÿ“‡","๐Ÿ“Œ","๐Ÿ“","๐Ÿ“Ž","๐Ÿ–‡๏ธ","๐Ÿ’ป","๐Ÿ–ฅ๏ธ","๐Ÿ–จ๏ธ","๐Ÿ–ฑ๏ธ","โŒจ๏ธ","๐Ÿ“ฑ","๐Ÿ“ฒ","๐Ÿ“ก","๐ŸŒ","๐Ÿ”—","๐Ÿ”’","๐Ÿ”“","โš™๏ธ","๐Ÿ”ง","๐Ÿ› ๏ธ","๐Ÿง‘โ€๐Ÿ’ป","๐Ÿ‘จโ€๐Ÿ’ป","๐Ÿ‘ฉโ€๐Ÿ’ป","๐Ÿ•น๏ธ","๐Ÿ’พ","๐Ÿ“Ÿ","๐Ÿ–ฅ๏ธ","๐Ÿ–ฒ๏ธ","๐Ÿš€","๐Ÿ’ก","๐ŸŽจ","๐Ÿ–ผ๏ธ","๐Ÿงช","๐Ÿ”ฌ","๐Ÿงฌ","๐ŸŽฏ","โšก","๐ŸŽฒ","๐ŸŽฎ","๐Ÿงฉ","๐Ÿ“ท","๐ŸŽฅ","โœ‰๏ธ","๐Ÿ“จ","๐Ÿ“ฉ","๐Ÿ“ง","๐Ÿ“ž","โ˜Ž๏ธ","๐Ÿ“ ","๐Ÿ—ฃ๏ธ","๐Ÿ’ฌ","๐Ÿ—จ๏ธ","๐Ÿ“ข","๐Ÿ“ฃ","๐Ÿ””","๐Ÿ›Ž๏ธ","๐Ÿ’ฐ","๐Ÿ’ธ","๐Ÿ’ณ","๐Ÿฆ","๐Ÿ“ˆ","๐Ÿ“‰","โš–๏ธ","๐Ÿงพ","๐Ÿช™","๐Ÿ›๏ธ","โš—๏ธ","๐Ÿงช","๐Ÿ”ญ","๐Ÿ”ฌ","๐Ÿฉบ","๐Ÿงฌ","๐Ÿฉป","๐Ÿฅ","๐ŸŒฑ","๐ŸŒ","๐ŸŒ","๐ŸŒŽ","๐ŸŒก๏ธ","๐Ÿ‘จโ€๐Ÿ’ผ","๐Ÿ‘ฉโ€๐Ÿ’ผ","๐Ÿ‘จโ€๐Ÿซ","๐Ÿ‘ฉโ€๐Ÿซ","๐Ÿ‘จโ€๐Ÿ”ฌ","๐Ÿ‘ฉโ€๐Ÿ”ฌ","๐Ÿ‘จโ€๐ŸŽจ","๐Ÿ‘ฉโ€๐ŸŽจ","๐Ÿ‘จโ€๐Ÿ”ง","๐Ÿ‘ฉโ€๐Ÿ”ง","๐Ÿ‘จโ€๐Ÿš€","๐Ÿ‘ฉโ€๐Ÿš€","๐Ÿ‘จโ€โš–๏ธ","๐Ÿ‘ฉโ€โš–๏ธ","๐Ÿ…","๐ŸŽ–๏ธ","๐Ÿฅ‡","๐Ÿฅˆ","๐Ÿฅ‰","๐Ÿ†","๐ŸŽ—๏ธ","๐Ÿ”‘","๐Ÿ—๏ธ","๐Ÿงญ","๐Ÿ›ก๏ธ","๐Ÿšฉ","๐Ÿณ๏ธโ€๐ŸŒˆ","๐ŸŽŸ๏ธ","๐ŸŽซ"],Rv=({workspace:r})=>{const[n,a]=f(!1),[o,s]=f("emoji"),[l,c]=f(),[u,p]=f(null),m=i(null),{updateWorkspace:h}=Sr();d(()=>()=>{m.current&&clearTimeout(m.current)},[]);const{user:g}=So(),b=is({resolver:md(Nf({name:Ju().min(2,{message:"Workspace name must be at least 2 characters."}),image:Ju().optional()})),defaultValues:{name:r.name||"",image:r.image||""}});if(!r)return t(rv,{});const y=vr(r,g?.id??null);return e("div",{children:[u&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:u})]}),!y&&t("div",{className:"text-red-500",children:"Only the workspace owner can change the workspace settings."}),t(fu,{...b,children:e("form",{onSubmit:b.handleSubmit(async function(e){a(!0),p(null);try{await h(r,e),p("Workspace settings saved successfully"),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{p(null)},5e3)}catch(e){Ye(e,{component:"WorkspaceSettingsGeneral",action:"updateWorkspace",metadata:{workspaceId:r._id}})}finally{a(!1)}}),className:"space-y-6",children:[t(mu,{control:b.control,name:"name",render:({field:r})=>e(bu,{children:[t(yu,{children:"Name"}),t(vu,{children:t(Su,{placeholder:"My Awesome Workspace",...r,disabled:!y})}),t(xu,{})]})}),r.billingCurrency?.trim()&&e("div",{className:"space-y-1.5",children:[t(uu,{className:"text-sm font-medium text-muted-foreground",children:"Billing currency"}),e("div",{className:"flex items-center gap-2 text-sm",children:[vv(r.billingCurrency)&&t("span",{className:"text-base",children:vv(r.billingCurrency)}),t("span",{children:r.billingCurrency.trim().toUpperCase()})]})]}),e("div",{className:"space-y-4",children:[e("div",{children:[t(uu,{className:"text-sm font-medium",children:"Icon"}),t(wu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(Eb,{value:o,disabled:!y,onValueChange:e=>s(e),className:"flex flex-col space-y-3",children:[e("div",{className:"flex items-center space-x-2",children:[t(Cb,{value:"emoji",id:"emoji"}),e(uu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Xd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center space-x-2",children:[t(Cb,{value:"url",id:"url"}),e(uu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Gd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===o&&e("div",{className:"space-y-3",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),e("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:[l&&t("span",{className:"text-2xl",children:l}),!l&&b.watch("image")?.trim()&&t("img",{src:b.watch("image")||void 0,alt:"Workspace preview"})]})]}),y&&t(dy,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:Tv.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{c(e),b.setValue("image",_v(e))})(e),disabled:!y,className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(l===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===o&&e("div",{className:"space-y-3",children:[t(mu,{control:b.control,name:"image",render:({field:r})=>e(bu,{children:[t(yu,{children:"Image URL"}),t(vu,{children:t(Su,{placeholder:"https://example.com/image.png",...r,disabled:!y})}),t(wu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(xu,{})]})}),b.watch("image")&&b.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:b.watch("image")||void 0,className:"w-full h-full object-cover",alt:"Workspace preview"})})]})]})]}),t("div",{className:"flex justify-end gap-3 pt-4",children:y&&t(iu,{type:"submit",disabled:n,progress:n,children:"Update Workspace"})})]})})]})};var Pv=.999,Ov=/[\\\/_+.#"@\[\(\{&]/,Iv=/[\\\/_+.#"@\[\(\{&]/g,Dv=/[\s-]/,Uv=/[\s-]/g;function Mv(e,t,r,n,a,o,i){if(o===t.length)return a===e.length?1:.99;var s=`${a},${o}`;if(void 0!==i[s])return i[s];for(var l,c,d,u,f=n.charAt(o),p=r.indexOf(f,a),m=0;p>=0;)(l=Mv(e,t,r,n,p+1,o+1,i))>m&&(p===a?l*=1:Ov.test(e.charAt(p-1))?(l*=.8,(d=e.slice(a,p-1).match(Iv))&&a>0&&(l*=Math.pow(Pv,d.length))):Dv.test(e.charAt(p-1))?(l*=.9,(u=e.slice(a,p-1).match(Uv))&&a>0&&(l*=Math.pow(Pv,u.length))):(l*=.17,a>0&&(l*=Math.pow(Pv,p-a))),e.charAt(p)!==t.charAt(o)&&(l*=.9999)),(l<.1&&r.charAt(p-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(p-1)!==n.charAt(o))&&(.1*(c=Mv(e,t,r,n,p+1,o+2,i))>l&&(l=.1*c)),l>m&&(m=l),p=r.indexOf(f,p+1);return i[s]=m,m}function Fv(e){return e.toLowerCase().replace(Uv," ")}function zv(e,t,r){return Mv(e=r&&r.length>0?""+(e+" "+r.join(" ")):e,t,Fv(e),Fv(t),0,0,{})}var Lv='[cmdk-group=""]',jv='[cmdk-group-items=""]',$v='[cmdk-item=""]',Vv=`${$v}:not([aria-disabled="true"])`,Wv="cmdk-item-select",Bv="data-value",Gv=(e,t,r)=>zv(e,t,r),Kv=n.createContext(void 0),Hv=()=>n.useContext(Kv),Zv=n.createContext(void 0),qv=()=>n.useContext(Zv),Jv=n.createContext(void 0),Yv=n.forwardRef((e,t)=>{let r=uw(()=>{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}}}),a=uw(()=>new Set),o=uw(()=>new Map),i=uw(()=>new Map),s=uw(()=>new Set),l=cw(e),{label:c,children:d,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:b=!0,...y}=e,v=Jp(),w=Jp(),x=Jp(),S=n.useRef(null),k=mw();dw(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,N.emit()}},[u]),dw(()=>{k(6,R)},[]);let N=n.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var a,o,i,s;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),A(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(x);e?e.focus():null==(a=document.getElementById(v))||a.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,N.emit()}),n||k(5,R),void 0!==(null==(o=l.current)?void 0:o.value)){let e=null!=t?t:"";return void(null==(s=(i=l.current).onValueChange)||s.call(i,e))}}N.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),E=n.useMemo(()=>({value:(e,t,n)=>{var a;t!==(null==(a=i.current.get(e))?void 0:a.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{A(),N.emit()}))},item:(e,t)=>(a.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),k(3,()=>{T(),A(),r.current.value||_(),N.emit()}),()=>{i.current.delete(e),a.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),N.emit()})}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{i.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:v,inputId:x,labelId:w,listInnerRef:S}),[]);function C(e,t){var n,a;let o=null!=(a=null==(n=l.current)?void 0:n.filter)?a:Gv;return e?o(e,r.current.search,t):0}function A(){if(!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=o.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;O().sort((t,r)=>{var n,a;let o=t.getAttribute("id"),i=r.getAttribute("id");return(null!=(n=e.get(i))?n:0)-(null!=(a=e.get(o))?a:0)}).forEach(e=>{let t=e.closest(jv);t?t.appendChild(e.parentElement===t?e:e.closest(`${jv} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${jv} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=S.current)?void 0:t.querySelector(`${Lv}[${Bv}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=O().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(Bv);N.setState("value",t||void 0)}function T(){var e,t,n,s;if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=a.current.size);r.current.filtered.groups=new Set;let c=0;for(let o of a.current){let a=C(null!=(t=null==(e=i.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(n=i.current.get(o))?void 0:n.keywords)?s:[]);r.current.filtered.items.set(o,a),a>0&&c++}for(let[e,t]of o.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=c}function R(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(Lv))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=S.current)?void 0:e.querySelector(`${$v}[aria-selected="true"]`)}function O(){var e;return Array.from((null==(e=S.current)?void 0:e.querySelectorAll(Vv))||[])}function I(e){let t=O()[e];t&&N.setState("value",t.getAttribute(Bv))}function D(e){var t;let r=P(),n=O(),a=n.findIndex(e=>e===r),o=n[a+e];null!=(t=l.current)&&t.loop&&(o=a+e<0?n[n.length-1]:a+e===n.length?n[0]:n[a+e]),o&&N.setState("value",o.getAttribute(Bv))}function U(e){let t,r=P(),n=null==r?void 0:r.closest(Lv);for(;n&&!t;)n=e>0?sw(n,Lv):lw(n,Lv),t=null==n?void 0:n.querySelector(Vv);t?N.setState("value",t.getAttribute(Bv)):D(e)}let M=()=>I(O().length-1),F=e=>{e.preventDefault(),e.metaKey?M():e.altKey?U(1):D(1)},z=e=>{e.preventDefault(),e.metaKey?I(0):e.altKey?U(-1):D(-1)};return n.createElement(rm.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&&z(e);break;case"ArrowUp":z(e);break;case"Home":e.preventDefault(),I(0);break;case"End":e.preventDefault(),M();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(Wv);t.dispatchEvent(e)}}}}},n.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:gw},c),hw(e,e=>n.createElement(Zv.Provider,{value:N},n.createElement(Kv.Provider,{value:E},e))))}),Xv=n.forwardRef((e,t)=>{var r,a;let o=Jp(),i=n.useRef(null),s=n.useContext(Jv),l=Hv(),c=cw(e),d=null!=(a=null==(r=c.current)?void 0:r.forceMount)?a:null==s?void 0:s.forceMount;dw(()=>{if(!d)return l.item(o,null==s?void 0:s.id)},[d]);let u=pw(o,i,[e.value,e.children,i],e.keywords),f=qv(),p=fw(e=>e.value&&e.value===u.current),m=fw(e=>!(!d&&!1!==l.filter())||(!e.search||e.filtered.items.get(o)>0));function h(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,u.current)}function g(){f.setState("value",u.current,!0)}if(n.useEffect(()=>{let t=i.current;if(t&&!e.disabled)return t.addEventListener(Wv,h),()=>t.removeEventListener(Wv,h)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:b,value:y,onSelect:v,forceMount:w,keywords:x,...S}=e;return n.createElement(rm.div,{ref:gd(i,t),...S,id:o,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!p,"data-disabled":!!b,"data-selected":!!p,onPointerMove:b||l.getDisablePointerSelection()?void 0:g,onClick:b?void 0:h},e.children)}),Qv=n.forwardRef((e,t)=>{let{heading:r,children:a,forceMount:o,...i}=e,s=Jp(),l=n.useRef(null),c=n.useRef(null),d=Jp(),u=Hv(),f=fw(e=>!(!o&&!1!==u.filter())||(!e.search||e.filtered.groups.has(s)));dw(()=>u.group(s),[]),pw(s,l,[e.value,e.heading,c]);let p=n.useMemo(()=>({id:s,forceMount:o}),[o]);return n.createElement(rm.div,{ref:gd(l,t),...i,"cmdk-group":"",role:"presentation",hidden:!f||void 0},r&&n.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),hw(e,e=>n.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},n.createElement(Jv.Provider,{value:p},e))))}),ew=n.forwardRef((e,t)=>{let{alwaysRender:r,...a}=e,o=n.useRef(null),i=fw(e=>!e.search);return r||i?n.createElement(rm.div,{ref:gd(o,t),...a,"cmdk-separator":"",role:"separator"}):null}),tw=n.forwardRef((e,t)=>{let{onValueChange:r,...a}=e,o=null!=e.value,i=qv(),s=fw(e=>e.search),l=fw(e=>e.selectedItemId),c=Hv();return n.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),n.createElement(rm.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),rw=n.forwardRef((e,t)=>{let{children:r,label:a="Suggestions",...o}=e,i=n.useRef(null),s=n.useRef(null),l=fw(e=>e.selectedItemId),c=Hv();return n.useEffect(()=>{if(s.current&&i.current){let e,t=s.current,r=i.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)}}},[]),n.createElement(rm.div,{ref:gd(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":a,id:c.listId},hw(e,e=>n.createElement("div",{ref:gd(s,c.listInnerRef),"cmdk-list-sizer":""},e)))}),nw=n.forwardRef((e,t)=>{let{open:r,onOpenChange:a,overlayClassName:o,contentClassName:i,container:s,...l}=e;return n.createElement(ng,{open:r,onOpenChange:a},n.createElement(og,{container:s},n.createElement(ig,{"cmdk-overlay":"",className:o}),n.createElement(sg,{"aria-label":e.label,"cmdk-dialog":"",className:i},n.createElement(Yv,{ref:t,...l}))))}),aw=n.forwardRef((e,t)=>fw(e=>0===e.filtered.count)?n.createElement(rm.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ow=n.forwardRef((e,t)=>{let{progress:r,children:a,label:o="Loading...",...i}=e;return n.createElement(rm.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},hw(e,e=>n.createElement("div",{"aria-hidden":!0},e)))}),iw=Object.assign(Yv,{List:rw,Item:Xv,Input:tw,Group:Qv,Separator:ew,Dialog:nw,Empty:aw,Loading:ow});function sw(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function lw(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function cw(e){let t=n.useRef(e);return dw(()=>{t.current=e}),t}var dw="undefined"==typeof window?n.useEffect:n.useLayoutEffect;function uw(e){let t=n.useRef();return void 0===t.current&&(t.current=e()),t}function fw(e){let t=qv(),r=()=>e(t.snapshot());return n.useSyncExternalStore(t.subscribe,r,r)}function pw(e,t,r,a=[]){let o=n.useRef(),i=Hv();return dw(()=>{var n;let s=(()=>{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():o.current}})(),l=a.map(e=>e.trim());i.value(e,s,l),null==(n=t.current)||n.setAttribute(Bv,s),o.current=s}),o}var mw=()=>{let[e,t]=n.useState(),r=uw(()=>new Map);return dw(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function hw({asChild:e,children:t},r){return e&&n.isValidElement(t)?n.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 gw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const bw=n.forwardRef(({className:e,...r},n)=>t(iw,{ref:n,className:je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...r}));bw.displayName=iw.displayName;const yw=n.forwardRef(({className:r,...n},a)=>e("div",{className:"flex items-center border-b px-3","data-cmdk-input-wrapper":"",children:[t(vg,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t(iw.Input,{ref:a,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",r),...n})]}));yw.displayName=iw.Input.displayName;const vw=n.forwardRef(({className:e,...r},n)=>t(iw.List,{ref:n,className:je("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...r}));vw.displayName=iw.List.displayName;n.forwardRef((e,r)=>t(iw.Empty,{ref:r,className:"py-6 text-center text-sm",...e})).displayName=iw.Empty.displayName;const ww=n.forwardRef(({className:e,...r},n)=>t(iw.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",e),...r}));ww.displayName=iw.Group.displayName;n.forwardRef(({className:e,...r},n)=>t(iw.Separator,{ref:n,className:je("-mx-1 h-px bg-border",e),...r})).displayName=iw.Separator.displayName;const xw=n.forwardRef(({className:e,...r},n)=>t(iw.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",e),...r}));xw.displayName=iw.Item.displayName;const Sw=["top","right","bottom","left"],kw=Math.min,Nw=Math.max,Ew=Math.round,Cw=Math.floor,Aw=e=>({x:e,y:e}),_w={left:"right",right:"left",bottom:"top",top:"bottom"},Tw={start:"end",end:"start"};function Rw(e,t,r){return Nw(e,kw(t,r))}function Pw(e,t){return"function"==typeof e?e(t):e}function Ow(e){return e.split("-")[0]}function Iw(e){return e.split("-")[1]}function Dw(e){return"x"===e?"y":"x"}function Uw(e){return"y"===e?"height":"width"}const Mw=new Set(["top","bottom"]);function Fw(e){return Mw.has(Ow(e))?"y":"x"}function zw(e){return Dw(Fw(e))}function Lw(e){return e.replace(/start|end/g,e=>Tw[e])}const jw=["left","right"],$w=["right","left"],Vw=["top","bottom"],Ww=["bottom","top"];function Bw(e,t,r,n){const a=Iw(e);let o=function(e,t,r){switch(e){case"top":case"bottom":return r?t?$w:jw:t?jw:$w;case"left":case"right":return t?Vw:Ww;default:return[]}}(Ow(e),"start"===r,n);return a&&(o=o.map(e=>e+"-"+a),t&&(o=o.concat(o.map(Lw)))),o}function Gw(e){return e.replace(/left|right|bottom|top/g,e=>_w[e])}function Kw(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 Hw(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 Zw(e,t,r){let{reference:n,floating:a}=e;const o=Fw(t),i=zw(t),s=Uw(i),l=Ow(t),c="y"===o,d=n.x+n.width/2-a.width/2,u=n.y+n.height/2-a.height/2,f=n[s]/2-a[s]/2;let p;switch(l){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(Iw(t)){case"start":p[i]-=f*(r&&c?-1:1);break;case"end":p[i]+=f*(r&&c?-1:1)}return p}async function qw(e,t){var r;void 0===t&&(t={});const{x:n,y:a,platform:o,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Pw(t,e),m=Kw(p),h=s[f?"floating"===u?"reference":"floating":u],g=Hw(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(h)))||r?h:h.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),v=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=Hw(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:y,strategy:l}):b);return{top:(g.top-w.top+m.top)/v.y,bottom:(w.bottom-g.bottom+m.bottom)/v.y,left:(g.left-w.left+m.left)/v.x,right:(w.right-g.right+m.right)/v.x}}function Jw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yw(e){return Sw.some(t=>e[t]>=0)}const Xw=new Set(["left","top"]);function Qw(){return"undefined"!=typeof window}function ex(e){return nx(e)?(e.nodeName||"").toLowerCase():"#document"}function tx(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rx(e){var t;return null==(t=(nx(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function nx(e){return!!Qw()&&(e instanceof Node||e instanceof tx(e).Node)}function ax(e){return!!Qw()&&(e instanceof Element||e instanceof tx(e).Element)}function ox(e){return!!Qw()&&(e instanceof HTMLElement||e instanceof tx(e).HTMLElement)}function ix(e){return!(!Qw()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof tx(e).ShadowRoot)}const sx=new Set(["inline","contents"]);function lx(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=wx(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!sx.has(a)}const cx=new Set(["table","td","th"]);function dx(e){return cx.has(ex(e))}const ux=[":popover-open",":modal"];function fx(e){return ux.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const px=["transform","translate","scale","rotate","perspective"],mx=["transform","translate","scale","rotate","perspective","filter"],hx=["paint","layout","strict","content"];function gx(e){const t=bx(),r=ax(e)?wx(e):e;return px.some(e=>!!r[e]&&"none"!==r[e])||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||mx.some(e=>(r.willChange||"").includes(e))||hx.some(e=>(r.contain||"").includes(e))}function bx(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const yx=new Set(["html","body","#document"]);function vx(e){return yx.has(ex(e))}function wx(e){return tx(e).getComputedStyle(e)}function xx(e){return ax(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Sx(e){if("html"===ex(e))return e;const t=e.assignedSlot||e.parentNode||ix(e)&&e.host||rx(e);return ix(t)?t.host:t}function kx(e){const t=Sx(e);return vx(t)?e.ownerDocument?e.ownerDocument.body:e.body:ox(t)&&lx(t)?t:kx(t)}function Nx(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const a=kx(e),o=a===(null==(n=e.ownerDocument)?void 0:n.body),i=tx(a);if(o){const e=Ex(i);return t.concat(i,i.visualViewport||[],lx(a)?a:[],e&&r?Nx(e):[])}return t.concat(a,Nx(a,[],r))}function Ex(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cx(e){const t=wx(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=ox(e),o=a?e.offsetWidth:r,i=a?e.offsetHeight:n,s=Ew(r)!==o||Ew(n)!==i;return s&&(r=o,n=i),{width:r,height:n,$:s}}function Ax(e){return ax(e)?e:e.contextElement}function _x(e){const t=Ax(e);if(!ox(t))return Aw(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:o}=Cx(t);let i=(o?Ew(r.width):r.width)/n,s=(o?Ew(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),s&&Number.isFinite(s)||(s=1),{x:i,y:s}}const Tx=Aw(0);function Rx(e){const t=tx(e);return bx()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Tx}function Px(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const a=e.getBoundingClientRect(),o=Ax(e);let i=Aw(1);t&&(n?ax(n)&&(i=_x(n)):i=_x(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==tx(e))&&t}(o,r,n)?Rx(o):Aw(0);let l=(a.left+s.x)/i.x,c=(a.top+s.y)/i.y,d=a.width/i.x,u=a.height/i.y;if(o){const e=tx(o),t=n&&ax(n)?tx(n):n;let r=e,a=Ex(r);for(;a&&n&&t!==r;){const e=_x(a),t=a.getBoundingClientRect(),n=wx(a),o=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=o,c+=i,r=tx(a),a=Ex(r)}}return Hw({width:d,height:u,x:l,y:c})}function Ox(e,t){const r=xx(e).scrollLeft;return t?t.left+r:Px(rx(e)).left+r}function Ix(e,t){const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-Ox(e,r),y:r.top+t.scrollTop}}const Dx=new Set(["absolute","fixed"]);function Ux(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=tx(e),n=rx(e),a=r.visualViewport;let o=n.clientWidth,i=n.clientHeight,s=0,l=0;if(a){o=a.width,i=a.height;const e=bx();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}const c=Ox(n);if(c<=0){const e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(o-=i)}else c<=25&&(o+=c);return{width:o,height:i,x:s,y:l}}(e,r);else if("document"===t)n=function(e){const t=rx(e),r=xx(e),n=e.ownerDocument.body,a=Nw(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Nw(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Ox(e);const s=-r.scrollTop;return"rtl"===wx(n).direction&&(i+=Nw(t.clientWidth,n.clientWidth)-a),{width:a,height:o,x:i,y:s}}(rx(e));else if(ax(t))n=function(e,t){const r=Px(e,!0,"fixed"===t),n=r.top+e.clientTop,a=r.left+e.clientLeft,o=ox(e)?_x(e):Aw(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:n*o.y}}(t,r);else{const r=Rx(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Hw(n)}function Mx(e,t){const r=Sx(e);return!(r===t||!ax(r)||vx(r))&&("fixed"===wx(r).position||Mx(r,t))}function Fx(e,t,r){const n=ox(t),a=rx(t),o="fixed"===r,i=Px(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=Aw(0);function c(){l.x=Ox(a)}if(n||!n&&!o)if(("body"!==ex(t)||lx(a))&&(s=xx(t)),n){const e=Px(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&c();o&&!n&&a&&c();const d=!a||n||o?Aw(0):Ix(a,s);return{x:i.left+s.scrollLeft-l.x-d.x,y:i.top+s.scrollTop-l.y-d.y,width:i.width,height:i.height}}function zx(e){return"static"===wx(e).position}function Lx(e,t){if(!ox(e)||"fixed"===wx(e).position)return null;if(t)return t(e);let r=e.offsetParent;return rx(e)===r&&(r=r.ownerDocument.body),r}function jx(e,t){const r=tx(e);if(fx(e))return r;if(!ox(e)){let t=Sx(e);for(;t&&!vx(t);){if(ax(t)&&!zx(t))return t;t=Sx(t)}return r}let n=Lx(e,t);for(;n&&dx(n)&&zx(n);)n=Lx(n,t);return n&&vx(n)&&zx(n)&&!gx(n)?r:n||function(e){let t=Sx(e);for(;ox(t)&&!vx(t);){if(gx(t))return t;if(fx(t))return null;t=Sx(t)}return null}(e)||r}const $x={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const o="fixed"===a,i=rx(n),s=!!t&&fx(t.floating);if(n===i||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=Aw(1);const d=Aw(0),u=ox(n);if((u||!u&&!o)&&(("body"!==ex(n)||lx(i))&&(l=xx(n)),ox(n))){const e=Px(n);c=_x(n),d.x=e.x+n.clientLeft,d.y=e.y+n.clientTop}const f=!i||u||o?Aw(0):Ix(i,l);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:r.y*c.y-l.scrollTop*c.y+d.y+f.y}},getDocumentElement:rx,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o="clippingAncestors"===r?fx(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Nx(e,[],!1).filter(e=>ax(e)&&"body"!==ex(e)),a=null;const o="fixed"===wx(e).position;let i=o?Sx(e):e;for(;ax(i)&&!vx(i);){const t=wx(i),r=gx(i);r||"fixed"!==t.position||(a=null),(o?!r&&!a:!r&&"static"===t.position&&a&&Dx.has(a.position)||lx(i)&&!r&&Mx(e,i))?n=n.filter(e=>e!==i):a=t,i=Sx(i)}return t.set(e,n),n}(t,this._c):[].concat(r),i=[...o,n],s=i[0],l=i.reduce((e,r)=>{const n=Ux(t,r,a);return e.top=Nw(n.top,e.top),e.right=kw(n.right,e.right),e.bottom=kw(n.bottom,e.bottom),e.left=Nw(n.left,e.left),e},Ux(t,s,a));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:jx,getElementRects:async function(e){const t=this.getOffsetParent||jx,r=this.getDimensions,n=await r(e.floating);return{reference:Fx(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}=Cx(e);return{width:t,height:r}},getScale:_x,isElement:ax,isRTL:function(e){return"rtl"===wx(e).direction}};function Vx(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wx(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Ax(e),d=a||o?[...c?Nx(c):[],...Nx(t)]:[];d.forEach(e=>{a&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const u=c&&s?function(e,t){let r,n=null;const a=rx(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function i(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();const c=e.getBoundingClientRect(),{left:d,top:u,width:f,height:p}=c;if(s||t(),!f||!p)return;const m={rootMargin:-Cw(u)+"px "+-Cw(a.clientWidth-(d+f))+"px "+-Cw(a.clientHeight-(u+p))+"px "+-Cw(d)+"px",threshold:Nw(0,kw(1,l))||1};let h=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!h)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||Vx(c,e.getBoundingClientRect())||i(),h=!1}try{n=new IntersectionObserver(g,{...m,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),o}(c,r):null;let f,p=-1,m=null;i&&(m=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),r()}),c&&!l&&m.observe(c),m.observe(t));let h=l?Px(e):null;return l&&function t(){const n=Px(e);h&&!Vx(h,n)&&r();h=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const Bx=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:o,placement:i,middlewareData:s}=t,l=await async function(e,t){const{placement:r,platform:n,elements:a}=e,o=await(null==n.isRTL?void 0:n.isRTL(a.floating)),i=Ow(r),s=Iw(r),l="y"===Fw(r),c=Xw.has(i)?-1:1,d=o&&l?-1:1,u=Pw(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 s&&"number"==typeof m&&(p="end"===s?-1*m:m),l?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return i===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:a+l.x,y:o+l.y,data:{...l,placement:i}}}}},Gx=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=Pw(e,t),d={x:r,y:n},u=await o.detectOverflow(t,c),f=Fw(Ow(a)),p=Dw(f);let m=d[p],h=d[f];if(i){const e="y"===p?"bottom":"right";m=Rw(m+u["y"===p?"top":"left"],m,m-u[e])}if(s){const e="y"===f?"bottom":"right";h=Rw(h+u["y"===f?"top":"left"],h,h-u[e])}const g=l.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[p]:i,[f]:s}}}}}},Kx=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:o,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=Pw(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const b=Ow(a),y=Fw(s),v=Ow(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(v||!h?[Gw(s)]:function(e){const t=Gw(e);return[Lw(e),t,Lw(t)]}(s)),S="none"!==m;!f&&S&&x.push(...Bw(s,h,m,w));const k=[s,...x],N=await l.detectOverflow(t,g),E=[];let C=(null==(n=o.flip)?void 0:n.overflows)||[];if(d&&E.push(N[b]),u){const e=function(e,t,r){void 0===r&&(r=!1);const n=Iw(e),a=zw(e),o=Uw(a);let i="x"===a?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Gw(i)),[i,Gw(i)]}(a,i,w);E.push(N[e[0]],N[e[1]])}if(C=[...C,{placement:a,overflows:E}],!E.every(e=>e<=0)){var A,_;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=k[e];if(t){if(!("alignment"===u&&y!==Fw(t))||C.every(e=>Fw(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:C},reset:{placement:t}}}let r=null==(_=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:_.placement;if(!r)switch(p){case"bestFit":{var T;const e=null==(T=C.filter(e=>{if(S){const t=Fw(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:T[0];e&&(r=e);break}case"initialPlacement":r=s}if(a!==r)return{reset:{placement:r}}}return{}}}},Hx=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:o,platform:i,elements:s}=t,{apply:l=()=>{},...c}=Pw(e,t),d=await i.detectOverflow(t,c),u=Ow(a),f=Iw(a),p="y"===Fw(a),{width:m,height:h}=o.floating;let g,b;"top"===u||"bottom"===u?(g=u,b=f===(await(null==i.isRTL?void 0:i.isRTL(s.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,w=kw(h-d[g],y),x=kw(m-d[b],v),S=!t.middlewareData.shift;let k=w,N=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(N=v),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=y),S&&!f){const e=Nw(d.left,0),t=Nw(d.right,0),r=Nw(d.top,0),n=Nw(d.bottom,0);p?N=m-2*(0!==e||0!==t?e+t:Nw(d.left,d.right)):k=h-2*(0!==r||0!==n?r+n:Nw(d.top,d.bottom))}await l({...t,availableWidth:N,availableHeight:k});const E=await i.getDimensions(s.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},Zx=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...o}=Pw(e,t);switch(a){case"referenceHidden":{const e=Jw(await n.detectOverflow(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Yw(e)}}}case"escaped":{const e=Jw(await n.detectOverflow(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Yw(e)}}}default:return{}}}}},qx=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:o,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=Pw(e,t)||{};if(null==c)return{};const u=Kw(d),f={x:r,y:n},p=zw(a),m=Uw(p),h=await i.getDimensions(c),g="y"===p,b=g?"top":"left",y=g?"bottom":"right",v=g?"clientHeight":"clientWidth",w=o.reference[m]+o.reference[p]-f[p]-o.floating[m],x=f[p]-o.reference[p],S=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c));let k=S?S[v]:0;k&&await(null==i.isElement?void 0:i.isElement(S))||(k=s.floating[v]||o.floating[m]);const N=w/2-x/2,E=k/2-h[m]/2-1,C=kw(u[b],E),A=kw(u[y],E),_=C,T=k-h[m]-A,R=k/2-h[m]/2+N,P=Rw(_,R,T),O=!l.arrow&&null!=Iw(a)&&R!==P&&o.reference[m]/2-(R<_?C:A)-h[m]/2<0,I=O?R<_?R-_:R-T:0;return{[p]:f[p]+I,data:{[p]:P,centerOffset:R-P-I,...O&&{alignmentOffset:I}},reset:O}}}),Jx=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:o,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Pw(e,t),d={x:r,y:n},u=Fw(a),f=Dw(u);let p=d[f],m=d[u];const h=Pw(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=o.reference[f]-o.floating[e]+g.mainAxis,r=o.reference[f]+o.reference[e]-g.mainAxis;p<t?p=t:p>r&&(p=r)}if(c){var b,y;const e="y"===f?"width":"height",t=Xw.has(Ow(a)),r=o.reference[u]-o.floating[e]+(t&&(null==(b=i.offset)?void 0:b[u])||0)+(t?0:g.crossAxis),n=o.reference[u]+o.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[u])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:p,[u]:m}}}},Yx=(e,t,r)=>{const n=new Map,a={platform:$x,...r},o={...a.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:i}=r,s=o.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:u}=Zw(c,n,l),f=n,p={},m=0;for(let r=0;r<s.length;r++){var h;const{name:o,fn:g}=s[r],{x:b,y:y,data:v,reset:w}=await g({x:d,y:u,initialPlacement:n,placement:f,strategy:a,middlewareData:p,rects:c,platform:{...i,detectOverflow:null!=(h=i.detectOverflow)?h:qw},elements:{reference:e,floating:t}});d=null!=b?b:d,u=null!=y?y:u,p={...p,[o]:{...p[o],...v}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(c=!0===w.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):w.rects),({x:d,y:u}=Zw(c,f,l))),r=-1)}return{x:d,y:u,placement:f,strategy:a,middlewareData:p}})(e,t,{...a,platform:o})};var Xx="undefined"!=typeof document?y:function(){};function Qx(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(!Qx(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)&&!Qx(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function eS(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tS(e,t){const r=eS(e);return Math.round(t*r)/r}function rS(e){const t=n.useRef(e);return Xx(()=>{t.current=e}),t}const nS=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?qx({element:r.current,padding:n}).fn(t):{}:r?qx({element:r,padding:n}).fn(t):{};var a}}),aS=(e,t)=>({...Bx(e),options:[e,t]}),oS=(e,t)=>({...Gx(e),options:[e,t]}),iS=(e,t)=>({...Jx(e),options:[e,t]}),sS=(e,t)=>({...Kx(e),options:[e,t]}),lS=(e,t)=>({...Hx(e),options:[e,t]}),cS=(e,t)=>({...Zx(e),options:[e,t]}),dS=(e,t)=>({...nS(e),options:[e,t]});var uS=n.forwardRef((e,r)=>{const{children:n,width:a=10,height:o=5,...i}=e;return t(rm.svg,{...i,ref:r,width:a,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t("polygon",{points:"0,0 30,0 15,10"})})});uS.displayName="Arrow";var fS=uS,pS="Popper",[mS,hS]=Kp(pS),[gS,bS]=mS(pS),yS=e=>{const{__scopePopper:r,children:a}=e,[o,i]=n.useState(null);return t(gS,{scope:r,anchor:o,onAnchorChange:i,children:a})};yS.displayName=pS;var vS="PopperAnchor",wS=n.forwardRef((e,r)=>{const{__scopePopper:a,virtualRef:o,...i}=e,s=bS(vS,a),l=n.useRef(null),c=bd(r,l),d=n.useRef(null);return n.useEffect(()=>{const e=d.current;d.current=o?.current||l.current,e!==d.current&&s.onAnchorChange(d.current)}),o?null:t(rm.div,{...i,ref:c})});wS.displayName=vS;var xS="PopperContent",[SS,kS]=mS(xS),NS=n.forwardRef((e,r)=>{const{__scopePopper:a,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=bS(xS,a),[w,x]=n.useState(null),S=bd(r,e=>x(e)),[k,N]=n.useState(null),E=Qg(k),C=E?.width??0,A=E?.height??0,_=o+("center"!==s?"-"+s:""),T="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(u)?u:[u],P=R.length>0,O={padding:T,boundary:R.filter(_S),altBoundary:P},{refs:I,floatingStyles:D,placement:U,isPositioned:M,middlewareData:F}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=n.useState(a);Qx(p,a)||m(a);const[h,g]=n.useState(null),[b,y]=n.useState(null),w=n.useCallback(e=>{e!==N.current&&(N.current=e,g(e))},[]),x=n.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),S=i||h,k=s||b,N=n.useRef(null),E=n.useRef(null),C=n.useRef(u),A=null!=c,_=rS(c),T=rS(o),R=rS(d),P=n.useCallback(()=>{if(!N.current||!E.current)return;const e={placement:t,strategy:r,middleware:p};T.current&&(e.platform=T.current),Yx(N.current,E.current,e).then(e=>{const t={...e,isPositioned:!1!==R.current};O.current&&!Qx(C.current,t)&&(C.current=t,v.flushSync(()=>{f(t)}))})},[p,t,r,T,R]);Xx(()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[d]);const O=n.useRef(!1);Xx(()=>(O.current=!0,()=>{O.current=!1}),[]),Xx(()=>{if(S&&(N.current=S),k&&(E.current=k),S&&k){if(_.current)return _.current(S,k,P);P()}},[S,k,P,_,A]);const I=n.useMemo(()=>({reference:N,floating:E,setReference:w,setFloating:x}),[w,x]),D=n.useMemo(()=>({reference:S,floating:k}),[S,k]),U=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=tS(D.floating,u.x),n=tS(D.floating,u.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...eS(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,D.floating,u.x,u.y]);return n.useMemo(()=>({...u,update:P,refs:I,elements:D,floatingStyles:U}),[u,P,I,D,U])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>Wx(...e,{animationFrame:"always"===h}),elements:{reference:y.anchor},middleware:[aS({mainAxis:i+A,alignmentAxis:l}),d&&oS({mainAxis:!0,crossAxis:!1,limiter:"partial"===p?iS():void 0,...O}),d&&sS({...O}),lS({...O,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:a,height:o}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${o}px`)}}),k&&dS({element:k,padding:c}),TS({arrowWidth:C,arrowHeight:A}),m&&cS({strategy:"referenceHidden",...O})]}),[z,L]=RS(U),j=hp(g);bp(()=>{M&&j?.()},[M,j]);const $=F.arrow?.x,V=F.arrow?.y,W=0!==F.arrow?.centerOffset,[B,G]=n.useState();return bp(()=>{w&&G(window.getComputedStyle(w).zIndex)},[w]),t("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:M?D.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:e.dir,children:t(SS,{scope:a,placedSide:z,onArrowChange:N,arrowX:$,arrowY:V,shouldHideArrow:W,children:t(rm.div,{"data-side":z,"data-align":L,...b,ref:S,style:{...b.style,animation:M?void 0:"none"}})})})});NS.displayName=xS;var ES="PopperArrow",CS={top:"bottom",right:"left",bottom:"top",left:"right"},AS=n.forwardRef(function(e,r){const{__scopePopper:n,...a}=e,o=kS(ES,n),i=CS[o.placedSide];return t("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t(fS,{...a,ref:r,style:{...a.style,display:"block"}})})});function _S(e){return null!==e}AS.displayName=ES;var TS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:a}=t,o=0!==a.arrow?.centerOffset,i=o?0:e.arrowWidth,s=o?0:e.arrowHeight,[l,c]=RS(r),d={start:"0%",center:"50%",end:"100%"}[c],u=(a.arrow?.x??0)+i/2,f=(a.arrow?.y??0)+s/2;let p="",m="";return"bottom"===l?(p=o?d:`${u}px`,m=-s+"px"):"top"===l?(p=o?d:`${u}px`,m=`${n.floating.height+s}px`):"right"===l?(p=-s+"px",m=o?d:`${f}px`):"left"===l&&(p=`${n.floating.width+s}px`,m=o?d:`${f}px`),{data:{x:p,y:m}}}});function RS(e){const[t,r="center"]=e.split("-");return[t,r]}var PS=yS,OS=wS,IS=NS,DS=AS;function US(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var MS=Symbol("radix.slottable");function FS(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===MS}var zS="Popover",[LS]=Kp(zS,[hS]),jS=hS(),[$S,VS]=LS(zS),WS=e=>{const{__scopePopover:r,children:a,open:o,defaultOpen:i,onOpenChange:s,modal:l=!1}=e,c=jS(r),d=n.useRef(null),[u,f]=n.useState(!1),[p,m]=Xp({prop:o,defaultProp:i??!1,onChange:s,caller:zS});return t(PS,{...c,children:t($S,{scope:r,contentId:Jp(),triggerRef:d,open:p,onOpenChange:m,onOpenToggle:n.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:n.useCallback(()=>f(!0),[]),onCustomAnchorRemove:n.useCallback(()=>f(!1),[]),modal:l,children:a})})};WS.displayName=zS;var BS="PopoverAnchor";n.forwardRef((e,r)=>{const{__scopePopover:a,...o}=e,i=VS(BS,a),s=jS(a),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=i;return n.useEffect(()=>(l(),()=>c()),[l,c]),t(OS,{...s,...o,ref:r})}).displayName=BS;var GS="PopoverTrigger",KS=n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=VS(GS,n),i=jS(n),s=bd(r,o.triggerRef),l=t(rm.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ak(o.open),...a,ref:s,onClick:Gp(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:t(OS,{asChild:!0,...i,children:l})});KS.displayName=GS;var HS="PopoverPortal",[ZS,qS]=LS(HS,{forceMount:void 0}),JS=e=>{const{__scopePopover:r,forceMount:n,children:a,container:o}=e,i=VS(HS,r);return t(ZS,{scope:r,forceMount:n,children:t(Sm,{present:n||i.open,children:t(xm,{asChild:!0,container:o,children:a})})})};JS.displayName=HS;var YS="PopoverContent",XS=n.forwardRef((e,r)=>{const n=qS(YS,e.__scopePopover),{forceMount:a=n.forceMount,...o}=e,i=VS(YS,e.__scopePopover);return t(Sm,{present:a||i.open,children:i.modal?t(ek,{...o,ref:r}):t(tk,{...o,ref:r})})});XS.displayName=YS;var QS=function(e){const r=US(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),l=s.find(FS);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("PopoverContent.RemoveScroll"),ek=n.forwardRef((e,r)=>{const a=VS(YS,e.__scopePopover),o=n.useRef(null),i=bd(r,o),s=n.useRef(!1);return n.useEffect(()=>{const e=o.current;if(e)return wh(e)},[]),t(ph,{as:QS,allowPinchZoom:!0,children:t(rk,{...e,ref:i,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gp(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||a.triggerRef.current?.focus()}),onPointerDownOutside:Gp(e.onPointerDownOutside,e=>{const t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;s.current=n},{checkForDefaultPrevented:!1}),onFocusOutside:Gp(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),tk=n.forwardRef((e,r)=>{const a=VS(YS,e.__scopePopover),o=n.useRef(!1),i=n.useRef(!1);return t(rk,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||a.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(i.current=!0));const r=t.target,n=a.triggerRef.current?.contains(r);n&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),rk=n.forwardRef((e,r)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...f}=e,p=VS(YS,n),m=jS(n);return Em(),t(mm,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:i,children:t(lm,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:t(IS,{"data-state":ak(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)"}})})})}),nk="PopoverClose";n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=VS(nk,n);return t(rm.button,{type:"button",...a,ref:r,onClick:Gp(e.onClick,()=>o.onOpenChange(!1))})}).displayName=nk;function ak(e){return e?"open":"closed"}n.forwardRef((e,r)=>{const{__scopePopover:n,...a}=e,o=jS(n);return t(DS,{...o,...a,ref:r})}).displayName="PopoverArrow";var ok=JS,ik=XS;const sk=WS,lk=KS,ck=n.forwardRef(({className:e,align:r="center",sideOffset:a=4,...o},i)=>{const{container:s}=n.useContext(Eo);return t(ok,{container:s,children:t(ik,{ref:i,align:r,sideOffset:a,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",e),...o})})});function dk({options:r,value:n,onChange:a,placeholder:o="Search...",emptyLabel:i="Choose option"}){const[s,l]=f(n??""),[c,u]=f(!1);d(()=>{void 0!==n&&l(n)},[n]);const p=r.find(e=>e.value===s);return e(sk,{open:c,onOpenChange:u,children:[t(lk,{asChild:!0,children:e(iu,{variant:"outline",role:"combobox","aria-expanded":c,className:"justify-between overflow-hidden text-ellipsis",children:[p?e("div",{children:[String(p.label).trim(),p.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:p.icon})]}):t("span",{className:"text-muted-foreground",children:i}),t(jd,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t(ck,{className:"p-0 overflow-hidden text-ellipsis",children:e(bw,{children:[t(yw,{placeholder:o}),t(vw,{children:t(ww,{children:r.map(r=>e(xw,{className:je("whitespace-nowrap text-left",{"text-green-500":s===r.value}),value:r.value,defaultValue:r.value,onSelect:()=>{return e=r.value,l(e),a?.(e),void u(!1);var e},children:[s===r.value&&t(Ld,{className:je("mr-2 h-4 w-4 text-green-400",s===r.value?"opacity-100":"opacity-0")}),String(r.label).trim(),r.icon&&t("span",{className:"ml-2 text-xs text-muted-foreground",children:r.icon})]},r.value))})})]})})]})}ck.displayName=ik.displayName;const uk={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"},fk={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"},pk=[{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=fk[e.code]||"USD",r=uk[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 mk({value:e,onChange:r}){const n=pk.map(e=>({value:e.value,label:e.text,icon:e.flag}));return t(dk,{options:n,value:e,onChange:r,placeholder:"Choose country...",emptyLabel:"Choose country"})}const hk=pk.map(e=>({value:e.currencyCode,text:e.currencyCode,icon:e.currencyIcon??null})),gk=Array.from(new Set(hk.map(e=>e.value))).map(e=>hk.find(t=>t.value===e)).filter(e=>void 0!==e);function bk({value:e,onChange:r}){const n=gk.map(e=>({value:e.value,label:e.text,icon:e.icon??void 0}));return t(dk,{options:n,value:e,onChange:r,placeholder:"Choose currency...",emptyLabel:"Choose Currency"})}let yk=[{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:"๐Ÿ‡ฎ๐Ÿ‡ฑ"}];yk=yk.filter((e,t,r)=>t===r.findIndex(t=>t.code===e.code&&t.label===e.label)),yk.sort((e,t)=>e.label<t.label?-1:e.label>t.label?1:0);const vk=yk.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 wk({value:e,onChange:r}){const n=vk.map(e=>({value:e.value,label:e.label,icon:e.flag}));return t(dk,{options:n,value:e,onChange:r,placeholder:"Choose language...",emptyLabel:"Choose language"})}const xk=[{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],o=t.text;let i=o.substring(o.indexOf("(")+1,o.indexOf(")"));-1!==i.indexOf("UTC")&&e.push({value:a,abbr:t.abbr,offset:t.offset,isdst:t.isdst,text:`(${i}) ${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 Sk({value:e,onChange:r}){const n=xk.map(e=>({value:e.value,label:e.text}));return t(dk,{options:n,value:e,onChange:r,placeholder:"Choose timezone...",emptyLabel:"Choose timezone"})}const kk=({workspace:r})=>{const{updateUserProfile:n,getProfile:a}=Sr(),[o,s]=f(!1),[l,c]=f(),[u,p]=f(0),[m,h]=f(null),g=i(null);d(()=>()=>{g.current&&clearTimeout(g.current)},[]);const b=is({resolver:md(Nf({name:Ju().min(2,{message:"Name must be at least 2 characters."}),country:Ju().optional(),timezone:Ju().optional(),language:Ju().optional(),currency:Ju().optional()})),defaultValues:{name:l?.name||"",country:l?.country||"",timezone:l?.timezone||"",language:l?.language||"",currency:l?.currency||""}});return d(()=>{a().then(e=>{c(e),b.setValue("name",e.name),b.setValue("country",e.country),b.setValue("timezone",e.timezone),b.setValue("language",e.language),b.setValue("currency",e.currency)})},[u]),l?e("div",{children:[m&&e("div",{className:"bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded mb-4",children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm",children:m})]}),t("div",{className:"space-y-4",children:t(fu,{...b,children:e("form",{onSubmit:b.handleSubmit(async function(e){s(!0),h(null);try{await n({name:e.name,country:e.country,timezone:e.timezone,language:e.language,currency:e.currency}),h("Profile saved successfully"),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h(null)},5e3)}catch(e){Ye(e,{component:"WorkspaceSettingsProfile",action:"updateUserProfile",metadata:{workspaceId:r._id}})}finally{s(!1)}}),className:"space-y-4",children:[e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Email"}),t(Su,{disabled:!0,className:"w-full border rounded px-3 py-2 bg-gray-100",value:l?.email})]}),t(mu,{disabled:o,control:b.control,name:"name",render:({field:r})=>e(bu,{children:[t(yu,{children:"Name"}),t(vu,{children:t(Su,{...r})}),t(xu,{})]})}),e("div",{className:"flex gap-y-2 my-4 flex-col",children:[e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Language"}),t(wk,{value:b.watch("language"),onChange:e=>{b.setValue("language",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Country"}),t(mk,{value:b.watch("country"),onChange:e=>{b.setValue("country",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Currency"}),t(bk,{value:b.watch("currency"),onChange:e=>{b.setValue("currency",e)}})]}),e("div",{className:"flex flex-col gap-0.5",children:[t("div",{className:"text-sm font-medium",children:"Timezone"}),t(Sk,{value:b.watch("timezone"),onChange:e=>{b.setValue("timezone",e)}})]})]}),e("div",{className:"flex justify-end gap-x-2",children:[t(iu,{type:"submit",progress:o,disabled:o,children:"Save"}),t(iu,{type:"button",variant:"outline",onClick:()=>{p(e=>e+1)},disabled:o,children:"Reset"})]})]})})}),l?.image&&e("div",{children:[t("label",{className:"block text-sm font-medium mb-1",children:"Profile Image"}),t("div",{className:"w-16 h-16 rounded-full overflow-hidden",children:t("img",{src:l.image,alt:l.name,className:"w-full h-full object-cover"})})]})]}):t(rv,{})};function Nk(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 Ek(e,t,r){const n=Nk(e,t);if(!n?.basePricing)return null;const a=n.basePricing[r];return null!=a?a:null}function Ck(e,t,r){const n=Nk(e,t);if(!n?.stripePrices)return null;const a="monthly"===r?"monthlyPriceId":"yearly"===r?"yearlyPriceId":"quarterlyPriceId",o="monthly"===r?"monthly":"yearly"===r?"yearly":void 0;return n.stripePrices[a]??(o?n.stripePrices[o]:void 0)??null}function Ak(e,t,r,n){const a=Nk(e,t),o=a?.quotaOverages?.[r];if(o)return o[n]}function _k(e,t){const r=Nk(e,t);return r?r.currency:e.plan?.currency??""}function Tk(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 Rk(e,t,r,n){const a=e.quotas?.[r];if(null==a)return null;const o=a[n];if(!o)return null;const i=Ak(e,t,r,n);return{included:o.included,...void 0!==o.unitSize&&{unitSize:o.unitSize},...void 0!==i&&{overage:i}}}function Pk(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 Ok(e,t){const r=Nk(e,t);return r?.seatPricing?.enabled?r.seatPricing:null}function Ik(e,t,r){const n=Ok(e,t);return n?.perSeat?n.perSeat[r]??null:null}function Dk(e,t){return Math.max(0,e-(t||0))}function Uk(e,t,r,n){const a=Ok(e,t);if(!a)return null;return Dk(n,a.includedSeats)*(Ik(e,t,r)??0)}function Mk(e,t,r,n){const a=Ek(e,t,r);if(null===a)return null;if(void 0===n)return a;return a+(Uk(e,t,r,n)??0)}function Fk(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 zk(e,t,r={}){const{overageInCents:n=!0,currency:a}=r,o=r.currencySymbol??wv(a??"");if(null==e)return"โ€”";const{included:i,overage:s}=e,l=`${i} included`;if(null==s)return l;const c=n?s/100:s;return`${l}, then ${o}${"number"==typeof c&&Number.isFinite(c)?c.toFixed(2):String(s)}${t&&"unitSize"in e&&null!=e.unitSize&&e.unitSize>0?` / ${e.unitSize.toLocaleString()} ${t}`:t?` / ${t}`:""}`}const Lk=(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)},jk=e=>e?new Date(1e3*e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A",$k=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"}},Vk=({workspaceId:n,hasActiveSubscription:a=!1,onViewPricingPlans:o,limit:i=20})=>{const{invoices:s,loading:l,error:c,refetch:d}=Ir(n,i),u=s.length>0;return e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[e("div",{children:[t("h3",{className:"text-lg font-semibold",children:"Billing History"}),t("p",{className:"text-sm text-gray-600",children:"View and download your invoices"})]}),t(iu,{variant:"ghost",size:"sm",progress:l,onClick:d,disabled:l,children:l?"Refreshing...":"Refresh"})]}),c&&e("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("div",{children:[t("p",{className:"font-medium",children:"Error loading invoices"}),t("p",{className:"text-sm mt-1",children:c})]}),t(iu,{variant:"outline",size:"sm",onClick:d,disabled:l,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:l?"Retrying...":"Retry"})]}),l&&!u?t("div",{className:"border rounded-lg p-6",children:t(rv,{})}):u?t("div",{className:"space-y-2",children:s.map(n=>{const a=(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"}}})(n);return t("div",{className:"border rounded-lg bg-white hover:shadow-sm transition-shadow p-3",children:e("div",{className:"flex items-center justify-between gap-4",children:[e("div",{className:"flex-1 min-w-0",children:[e("div",{className:"flex items-center gap-2 mb-1.5",children:[t("span",{className:"text-sm font-medium text-gray-900",children:n.description||n.number||`Invoice ${n.id.slice(-8)}`}),t("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${$k(n.status)}`,children:n.status.charAt(0).toUpperCase()+n.status.slice(1)})]}),e("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("span",{className:"font-medium text-gray-900",children:Lk(n.amount_due,n.currency)}),n.created&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{children:["Created: ",jk(n.created)]})]}),n.due_date&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{children:["Due: ",jk(n.due_date)]})]}),n.amount_paid>0&&n.amount_due>0&&e(r,{children:[t("span",{className:"text-gray-300",children:"โ€ข"}),e("span",{className:"text-xs text-gray-500",children:["Paid: ",Lk(n.amount_paid,n.currency)]})]})]})]}),e("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e(iu,{size:"sm",disabled:!n.hosted_invoice_url,onClick:()=>n.hosted_invoice_url&&window.open(n.hosted_invoice_url,"_blank","noopener,noreferrer"),className:a.color,children:[a.text,t(Wd,{className:"h-3 w-3 ml-1.5"})]}),n.invoice_pdf&&e(iu,{size:"sm",variant:"outline",onClick:()=>window.open(n.invoice_pdf,"_blank","noopener,noreferrer"),children:[t(Vd,{className:"h-3 w-3 mr-1.5"}),"PDF"]})]})]})},n.id)})}):e("div",{className:"border rounded-lg p-6 text-center",children:[t(Bd,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-sm text-gray-500",children:a?"No invoices with download option found":"No invoices yet. Subscribe to a plan to receive invoices."}),!a&&o&&t(iu,{size:"sm",className:"mt-4",onClick:o,children:"View Pricing Plans"})]})]})},Wk=h(()=>Promise.resolve().then(function(){return PE}).then(e=>({default:e.default}))),Bk=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""}},Gk=({workspace:n})=>{const a=n._id?.toString(),{subscription:o,loading:l,error:c,updateSubscription:u,refetch:p}=Or(a),{createCheckoutSession:h}=Rr(a),{cancelSubscription:g,loading:b}=Ur(a),{resumeSubscription:y,loading:v}=Mr(a),{versions:w,loading:x,error:S,refetch:k}=Tr(a),N=l||x,E=c||S,{currentVersion:C,latestVersion:A,isDeprecated:_,whatsNew:T,plansToShow:R}=s(()=>{const e=w?.currentVersion,t=w?.availableVersions||[],r=null!=o?.subscription;let n=null;t.length>0?n=t.reduce((e,t)=>t.version>e.version?t:e):e&&(n=e);const a=!!(r&&n&&e)&&n.version>e.version,i=n?.plans&&n.plans.length>0?n.plans:[];return{currentVersion:e,latestVersion:n,hasNewerVersion:a,isDeprecated:a&&r,whatsNew:n?.whatsNew,plansToShow:i}},[w,o?.subscription]),[P,O]=f(!1),[I,D]=f(null),[U,M]=f(null),F=i(null),[z,L]=f(!1),[j,$]=f(!1);d(()=>()=>{F.current&&clearTimeout(F.current)},[]);const[V,W]=f(!1),[B,G]=f("subscription"),K=async()=>{await Promise.all([p(),k()])},H=s(()=>Pk(o?.subscription?.stripePriceId,R??[]),[o?.subscription?.stripePriceId,R]);if(N&&!o&&!w)return t(rv,{});const Z=o?.planVersion?._id||null;return a?e("div",{className:"space-y-6",children:[E&&e("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("div",{children:[t("p",{className:"font-medium",children:"Error loading subscription data"}),t("p",{className:"text-sm mt-1",children:E}),t("p",{className:"text-xs mt-2 text-red-600",children:"Please check your connection and try again."})]}),t(iu,{variant:"outline",size:"sm",onClick:K,disabled:N,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:N?"Retrying...":"Retry"})]}),I&&e("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("div",{children:[t("p",{className:"font-medium",children:"Update failed"}),t("p",{className:"text-sm mt-1",children:I})]}),t(iu,{variant:"outline",size:"sm",onClick:()=>D(null),className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:"Dismiss"})]}),U&&e("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("div",{children:[t("p",{className:"font-medium",children:"Success!"}),t("p",{className:"text-sm mt-1",children:U})]}),t(iu,{variant:"outline",size:"sm",onClick:()=>M(null),className:"flex-shrink-0 border-green-200 text-green-700 hover:bg-green-100",children:"Dismiss"})]}),t("div",{className:"border-b border-gray-200",children:e("nav",{className:"-mb-px flex gap-6","aria-label":"Subscription tabs",children:[t("button",{type:"button",onClick:()=>G("subscription"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("subscription"===B?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Plan"}),t("button",{type:"button",onClick:()=>G("invoices"),className:"border-b-2 py-3 text-sm font-medium transition-colors "+("invoices"===B?"border-primary text-primary":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700"),children:"Invoices"})]})}),"subscription"===B&&e(r,{children:[N&&e("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:[t(Kd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),t("span",{children:"Loading subscription and pricing plans..."})]}),_&&o?.subscription&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex-shrink-0",children:t(ru,{className:"h-5 w-5 text-amber-600"})}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Your Current Plan is Deprecated"}),t("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("div",{className:"flex items-center gap-2 text-xs text-amber-600 mb-3",children:[e("span",{children:["Current: Version ",C?.version||"N/A"]}),t("span",{children:"โ€ข"}),e("span",{children:["Latest: Version ",A?.version||"N/A"]})]}),T&&(T.newPlans.length>0||T.updatedPlans.length>0)&&e("div",{className:"mt-3 pt-3 border-t border-amber-200",children:[e("h4",{className:"text-xs font-semibold text-amber-800 mb-2",children:["What's New in Version ",A?.version,":"]}),e("div",{className:"space-y-1.5 text-xs text-amber-700",children:[T.newPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"New Plans: "}),t("span",{children:T.newPlans.map(e=>e.plan.name).join(", ")})]}),T.updatedPlans.length>0&&e("div",{children:[t("span",{className:"font-medium",children:"Updated Plans: "}),t("span",{children:T.updatedPlans.map(e=>e.plan.name).join(", ")})]})]})]})]})]})}),e("div",{className:"space-y-4",children:[e("div",{className:"flex items-center justify-between",children:[t("div",{children:t("p",{className:"text-sm text-gray-600",children:"Manage your plan and billing"})}),e("div",{className:"flex items-center gap-2",children:[o?.subscription?.cancelAtPeriodEnd||b?null:o?.subscription?t(iu,{variant:"outline",size:"sm",onClick:()=>L(!0),children:"Change Plan"}):!o?.subscription&&R&&R.length>0?t(iu,{size:"sm",onClick:()=>L(!0),children:"View Pricing Plans"}):null,t(iu,{variant:"ghost",size:"sm",progress:N,onClick:K,disabled:N||P,children:N?"Refreshing...":"Refresh"})]})]}),o?.subscription?(()=>{const a=Pk(o.subscription.stripePriceId,R??[]),i=a?.interval??null,s=a?.currency??o.plan?.currency??n?.billingCurrency??"",l=i&&o.planVersion?Ek(o.planVersion,s,i):null,c=s,d=o.planVersion?Ok(o.planVersion,s):null,u=d&&i?Ik(o.planVersion,s,i):null,f=Array.isArray(n?.users)?n.users.length:1,p=d?.includedSeats??0,m=f,h=null!=l?0===l?"Free":kv(l,c):null,g="monthly"===i?"/month":"quarterly"===i?"/quarter":"yearly"===i?"/year":"";return e("div",{className:"border rounded-lg overflow-hidden "+(_?"border-amber-300":"border-gray-200"),children:["trialing"===o.subscription.subscriptionStatus&&(()=>{const r=o.subscription.trialEnd||o.subscription.stripeCurrentPeriodEnd,n=r?new Date(r):null,a=n&&!isNaN(n.getTime())?n:null,i=a?Math.max(0,Math.ceil((a.getTime()-Date.now())/864e5)):null;return t("div",{className:"px-5 py-3 text-sm flex items-center justify-between "+(null!==i&&i<=3?"bg-amber-50 text-amber-800 border-b border-amber-200":"bg-blue-50 text-blue-800 border-b border-blue-200"),children:e("span",{children:[null!==i&&i<=0?"Your trial has ended.":null!==i?`Your trial ends in ${i} day${1===i?"":"s"}.`:"You are on a trial."," ","Upgrade to keep access after the trial."]})})})(),e("div",{className:"p-5 "+(_?"bg-amber-50/50":"bg-gray-50/50"),children:[e("div",{className:"flex items-start justify-between",children:[e("div",{className:"flex-1",children:[e("div",{className:"flex items-center gap-2 mb-2",children:[t("h3",{className:"text-lg font-semibold text-gray-900",children:o.plan?.name||"No plan assigned"}),e("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium "+("active"===o.subscription.subscriptionStatus?"bg-green-100 text-green-800":"trialing"===o.subscription.subscriptionStatus?"bg-blue-100 text-blue-800":"canceled"===o.subscription.subscriptionStatus?"bg-gray-100 text-gray-800":"bg-red-100 text-red-800"),children:["active"===o.subscription.subscriptionStatus&&"Active","trialing"===o.subscription.subscriptionStatus&&"Trial","canceled"===o.subscription.subscriptionStatus&&"Canceled","past_due"===o.subscription.subscriptionStatus&&"Past Due"]}),"trialing"===o.subscription.subscriptionStatus&&Bk(o.subscription.trialEnd||o.subscription.stripeCurrentPeriodEnd)&&e("span",{className:"text-xs text-gray-500",children:["(ends"," ",Bk(o.subscription.trialEnd||o.subscription.stripeCurrentPeriodEnd),")"]}),_&&e("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:[t(ru,{className:"h-3 w-3"}),"Deprecated"]})]}),o.plan?.description&&t("p",{className:"text-sm text-gray-600",children:o.plan.description})]}),e("div",{className:"text-right ml-4 shrink-0",children:[e("div",{className:"flex items-baseline justify-end gap-1",children:[t("span",{className:"text-2xl font-bold text-gray-900",children:h||"N/A"}),h&&"Free"!==h&&g&&t("span",{className:"text-sm text-gray-500",children:g})]}),d&&u&&u>0&&e("div",{className:"text-xs text-gray-500 mt-1",children:["+ ",kv(u,c),"/seat",g]}),("active"===o.subscription.subscriptionStatus||"trialing"===o.subscription.subscriptionStatus)&&!o.subscription.cancelAtPeriodEnd&&Bk(o.subscription.stripeCurrentPeriodEnd)&&e("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-gray-500",children:[t(Fd,{className:"h-3.5 w-3.5 flex-shrink-0"}),e("span",{children:["Next billing:"," ",t("span",{className:"font-medium text-gray-700",children:Bk(o.subscription.stripeCurrentPeriodEnd)})]})]})]})]}),_&&e("p",{className:"text-xs text-amber-600 mt-2",children:["Version ",C?.version||"N/A"," - A newer version is available"]}),("active"===o.subscription.subscriptionStatus||"trialing"===o.subscription.subscriptionStatus)&&t("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-gray-200",children:"active"===o.subscription.subscriptionStatus&&o.subscription.cancelAtPeriodEnd?t(iu,{variant:"outline",size:"sm",onClick:()=>W(!0),disabled:P||b||v,progress:v,children:"Resume Subscription"}):t(iu,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 border-red-200",onClick:()=>$(!0),disabled:P||b||v,progress:b||P,children:b||P?"Canceling...":"trialing"===o.subscription.subscriptionStatus?"Cancel Trial":"Cancel Subscription"})})]}),"past_due"===o.subscription.subscriptionStatus&&t("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e("div",{className:"flex items-start gap-3",children:[t(ru,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-red-800",children:"Payment past due"}),t("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."}),t(iu,{variant:"outline",size:"sm",className:"mt-2 border-red-200 text-red-700 hover:bg-red-100",onClick:()=>G("invoices"),children:"View Invoices"})]})]})}),"past_due"===o.subscription.subscriptionStatus&&o.subscription.dunningState&&"none"!==o.subscription.dunningState&&t("div",{className:"px-5 py-3 bg-red-50 border-t border-red-200",children:e("div",{className:"flex items-start gap-3",children:[t(ru,{className:"h-5 w-5 text-red-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-red-800",children:"final"===o.subscription.dunningState?"Final warning: Subscription will be suspended":"suspended"===o.subscription.dunningState?"Subscription suspended":"Payment recovery in progress"}),t("p",{className:"text-sm text-red-700 mt-0.5",children:"suspended"===o.subscription.dunningState?"Your subscription has been suspended due to repeated payment failures. Update your payment method to restore access.":"We were unable to process your payment. Please update your payment method to avoid losing access."})]})]})}),"paused"===o.subscription.subscriptionStatus&&t("div",{className:"px-5 py-3 bg-blue-50 border-t border-blue-200",children:e("div",{className:"flex items-start gap-3",children:[t(Fd,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-blue-800",children:"Subscription paused"}),t("p",{className:"text-sm text-blue-700 mt-0.5",children:"Your subscription is currently paused. Resume to restore full access."})]})]})}),o.subscription.cancelAtPeriodEnd&&t("div",{className:"px-5 py-3 bg-amber-50 border-t border-amber-200",children:e("div",{className:"flex items-start gap-3",children:[t(Fd,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),e("div",{children:[t("p",{className:"text-sm font-medium text-amber-800",children:"Subscription scheduled for cancellation"}),t("p",{className:"text-sm text-amber-700 mt-0.5",children:Bk(o.subscription.stripeCurrentPeriodEnd)?e(r,{children:["Your subscription will end on"," ",t("span",{className:"font-medium",children:Bk(o.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."})]})]})}),o.planVersion&&(()=>{const r=((e,t,r="monthly")=>{if(!e?.subscriptionItems)return{features:[],limits:[],quotas:[]};const n=[],a=[],o=[];return e.subscriptionItems.forEach(i=>{const s=i.slug;if("feature"===i.type){const t=e.features?.[s]??!1;n.push({item:i,enabled:t})}else if("limit"===i.type){const t=e.limits?.[s]??0;a.push({item:i,value:t})}else if("quota"===i.type){const n=t&&e.pricingVariants?.length?Rk(e,t,s,r):Fk(e.quotas?.[s],r);null!=n&&o.push({item:i,value:n})}}),{features:n,limits:a,quotas:o}})(o.planVersion,s,i??"monthly");return r.features.length>0||r.limits.length>0||r.quotas.length>0?t("div",{className:"p-5 border-t border-gray-100",children:e("div",{className:"space-y-6",children:[r.features.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Features"}),t("ul",{className:"space-y-2",children:r.features.sort(e=>e.enabled?-1:1).map(({item:r,enabled:n})=>e("li",{className:"flex items-start gap-2 text-sm",children:[t("span",{className:"mt-0.5 flex-shrink-0 "+(n?"text-green-500":"text-gray-300"),children:n?"โœ“":"โ€”"}),t("span",{className:n?"text-gray-700":"text-gray-400",children:r.name})]},r._id))})]}),r.limits.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Limits"}),t("ul",{className:"space-y-2",children:r.limits.map(({item:r,value:n})=>t("li",{className:"text-sm",children:e("div",{className:"flex items-center justify-between",children:[t("span",{className:"text-gray-600",children:r.name}),t("span",{className:"font-medium text-gray-900",children:n})]})},r._id))})]}),r.quotas.length>0&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Usage Quotas"}),t("ul",{className:"space-y-2",children:r.quotas.map(({item:r,value:n})=>{const a=zk(n,r.name.toLowerCase(),{currency:s});return t("li",{className:"text-sm",children:e("div",{className:"flex items-center justify-between",children:[t("span",{className:"text-gray-600",children:r.name}),t("span",{className:"font-medium text-gray-900",children:a})]})},r._id)})})]}),d&&e("div",{children:[t("h4",{className:"text-xs font-semibold text-gray-900 uppercase tracking-wider mb-3",children:"Seats"}),e("div",{className:"bg-gray-50 rounded-lg p-3 space-y-2",children:[e("div",{className:"flex items-center justify-between text-sm",children:[t("span",{className:"text-gray-600",children:"Current members"}),t("span",{className:"font-semibold text-gray-900",children:m})]}),e("div",{className:"flex items-center justify-between text-sm",children:[t("span",{className:"text-gray-600",children:"Included with plan"}),t("span",{className:"text-gray-900",children:p})]}),u&&u>0&&e("div",{className:"flex items-center justify-between text-sm",children:[t("span",{className:"text-gray-600",children:"Extra seat price"}),e("span",{className:"text-gray-900",children:[kv(u,s),g]})]}),d.maxSeats>0&&e("div",{className:"flex items-center justify-between text-sm",children:[t("span",{className:"text-gray-600",children:"Seat limit"}),t("span",{className:"text-gray-900",children:d.maxSeats})]})]})]})]})}):null})()]})})():n.pendingOnboarding?e("div",{className:"border rounded-lg p-6 text-center",children:[e("div",{className:"mb-4",children:[t($d,{className:"h-12 w-12 mx-auto mb-3 text-blue-400"}),t("p",{className:"text-lg font-medium text-gray-700",children:"Start your free trial"}),t("p",{className:"text-sm text-gray-500 mt-1",children:"Try the full plan with no commitment. You can upgrade or cancel anytime."})]}),t(iu,{size:"sm",progress:P,onClick:async()=>{try{O(!0);const e=await h({planVersionId:n.pendingOnboarding?.planVersionId??""});e&&"checkoutUrl"in e&&e.checkoutUrl&&(window.location.href=e.checkoutUrl)}catch(e){}finally{O(!1)}},children:"Start Free Trial"}),R&&R.length>0&&t(iu,{variant:"ghost",size:"sm",className:"ml-2",onClick:()=>L(!0),children:"View All Plans"})]}):e("div",{className:"border rounded-lg p-6 text-center",children:[e("div",{className:"mb-4",children:[t($d,{className:"h-12 w-12 mx-auto text-gray-400 mb-3"}),t("p",{className:"text-lg font-medium text-gray-700",children:"You don't have an active subscription"}),t("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a plan to get started with your workspace"})]}),R&&R.length>0&&t(iu,{size:"sm",onClick:()=>L(!0),children:"View Pricing Plans"})]})]}),!w&&!N&&e("div",{className:"border rounded-lg p-4 text-center",children:[e("div",{className:"text-gray-500 mb-2",children:[t("p",{className:"font-medium",children:"Unable to load plan information"}),E&&e("p",{className:"text-sm mt-2 text-red-600",children:["Error: ",E]}),!E&&t("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."})]}),t(iu,{variant:"outline",size:"sm",progress:N,onClick:K,disabled:N,className:"mt-4",children:N?"Refreshing...":"Refresh"})]})]}),"invoices"===B&&e(r,{children:[N&&e("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:[t(Kd,{className:"h-4 w-4 animate-spin flex-shrink-0"}),t("span",{children:"Loading invoices..."})]}),t(Vk,{workspaceId:a,hasActiveSubscription:null!==o?.subscription,onViewPricingPlans:()=>G("subscription"),limit:20})]}),R&&R.length>0&&t(m,{fallback:z?t("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:e("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t(Kd,{className:"h-5 w-5 animate-spin"}),t("span",{children:"Loading plans..."})]})}):null,children:t(Wk,{open:z,onOpenChange:L,planVersions:R,currentPlanVersionId:Z||null,currentStripePriceId:o?.subscription?.stripePriceId,billingCurrency:n.billingCurrency,onSelectPlan:async(e,t="monthly",r)=>{if(!a)return;const i=R?.find(t=>t._id===e),s=r??H?.currency??o?.plan?.currency??n?.billingCurrency??"",l=i?Ck(i,s,t):null,c=o?.subscription?.stripePriceId;if(!l||!c||l!==c){O(!0),D(null),M(null);try{let r,n,a;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(a=o?.subscription?await u(e,{billingInterval:t,successUrl:r,cancelUrl:n}):await h({planVersionId:e,billingInterval:t,currency:s||void 0,successUrl:r,cancelUrl:n}),a&&"checkoutUrl"in a&&a.checkoutUrl)return void(window.location.href=a.checkoutUrl);M("Subscription updated successfully!"),await K()}catch(e){const t=e instanceof Error?e.message:"Failed to process subscription";D(t)}finally{O(!1),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{D(null),M(null)},5e3)}}},loading:P||N})}),t(Gy,{open:V,onOpenChange:W,children:e(qy,{children:[e(Jy,{children:[t(Xy,{children:"Resume Subscription"}),t(Qy,{asChild:!0,children:e("div",{className:"space-y-3",children:[t("p",{children:"Are you sure you want to resume your subscription?"}),e("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4 space-y-2 text-sm",children:[e("div",{className:"flex items-start gap-2",children:[t(ru,{className:"h-4 w-4 text-amber-600 mt-0.5 flex-shrink-0"}),e("span",{children:["You will be charged again on"," ",o?.subscription?.stripeCurrentPeriodEnd&&Bk(o.subscription.stripeCurrentPeriodEnd)?t("span",{className:"font-medium",children:Bk(o.subscription.stripeCurrentPeriodEnd)}):"the next billing date"]})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-amber-600 mt-0.5",children:"โ€ข"}),t("span",{children:"Your subscription will continue automatically and you'll be billed according to your plan"})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),t("span",{children:"You can cancel anytime before the next billing date if you change your mind"})]})]})]})})]}),e(Yy,{children:[t(tv,{disabled:v,children:"Keep Canceled"}),t(ev,{onClick:async()=>{if(a){W(!1),O(!0),D(null),M(null);try{await y(),M("Subscription has been resumed."),await K()}catch(e){const t=e instanceof Error?e.message:"Failed to resume subscription";D(t)}finally{O(!1),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{D(null),M(null)},5e3)}}},disabled:v,children:v?"Resuming...":"Yes, Resume Subscription"})]})]})}),t(Gy,{open:j,onOpenChange:$,children:e(qy,{children:[e(Jy,{children:[t(Xy,{children:"Cancel Subscription"}),t(Qy,{asChild:!0,children:e("div",{className:"space-y-3",children:[t("p",{children:"Are you sure you want to cancel your subscription?"}),e("div",{className:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm",children:[e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),e("span",{children:["You'll retain full access to this plan until"," ",o?.subscription?.stripeCurrentPeriodEnd&&Bk(o.subscription.stripeCurrentPeriodEnd)?t("span",{className:"font-medium",children:Bk(o.subscription.stripeCurrentPeriodEnd)}):"the end of your current billing period"]})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-green-600 mt-0.5",children:"โœ“"}),t("span",{children:"You won't be charged again after cancellation"})]}),e("div",{className:"flex items-start gap-2",children:[t("span",{className:"text-blue-600 mt-0.5",children:"โ„น"}),t("span",{children:"You can resume your subscription anytime before it ends"})]})]})]})})]}),e(Yy,{children:[t(tv,{disabled:b,children:"Keep Subscription"}),t(ev,{onClick:async()=>{if(a){$(!1),O(!0),D(null),M(null);try{await g(),M("Subscription will be canceled at the end of the billing period."),await K()}catch(e){const t=e instanceof Error?e.message:"Failed to cancel subscription";D(t)}finally{O(!1),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{D(null),M(null)},5e3)}}},disabled:b,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:b?"Canceling...":"Yes, Cancel Subscription"})]})]})})]}):t("div",{className:"border rounded-lg p-4 text-center text-gray-500",children:t("p",{children:"Invalid workspace ID"})})};function Kk(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"K":e.toLocaleString()}function Hk(e){return e.replace(/[_-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Zk(e,t){return t+e.toFixed(2)}function qk(e){try{const t=new Date(e);if(isNaN(t.getTime()))return null;const r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}catch{return null}}const Jk=()=>{const{quotas:r,loading:n,error:a,refetch:o}=Zr(),{response:i}=Wr(),[l,c]=f(!1),d=s(()=>{const e={};if(!i?.planVersion||!i?.subscription)return e;const t=i.planVersion,n=i.subscription,a=n.billingInterval??"monthly",o=n.plan?.currency??"usd",s=wv(o);if(!r)return e;for(const n of Object.keys(r)){const i=Ak(t,o,n,a);if(null==i||i<=0)continue;const l=t.quotas?.[n],c=l?.[a],d=c?.unitSize??1,u=r[n].overage,f=(d>1?Math.ceil(u/d):u)*i/100;e[n]={overageCents:i,unitSize:d,currency:o,currencySymbol:s,estimatedCost:f}}return e},[i,r]),u=s(()=>{const e=i?.subscription?.stripeCurrentPeriodEnd;if(!e)return null;const t=function(e){try{const t=new Date(e);return isNaN(t.getTime())?"":new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}catch{return""}}(e);return t?{endDate:t,daysRemaining:qk(e)}:null},[i]),p=async()=>{c(!0);try{await o()}finally{c(!1)}};if(n&&!r)return t(rv,{});if(a)return e("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("div",{children:[t("p",{className:"font-medium",children:"Failed to load usage data"}),t("p",{className:"text-sm mt-1",children:a})]}),t(iu,{variant:"outline",size:"sm",onClick:p,disabled:l,className:"flex-shrink-0 border-red-200 text-red-700 hover:bg-red-100",children:l?"Retrying...":"Retry"})]});const m=function(e){return[...e].sort(([,e],[,t])=>{if(e.hasOverage&&!t.hasOverage)return-1;if(!e.hasOverage&&t.hasOverage)return 1;const r=e.included>0?e.consumed/e.included:e.consumed>0?1:0;return(t.included>0?t.consumed/t.included:t.consumed>0?1:0)-r})}(r?Object.entries(r):[]);if(0===m.length)return e("div",{className:"border rounded-lg p-8 text-center",children:[t(zd,{className:"h-10 w-10 text-gray-300 mx-auto mb-3"}),t("p",{className:"text-sm text-gray-600",children:"No quota usage data available for this workspace."}),t("p",{className:"text-xs text-gray-500 mt-1",children:"Quotas will appear here once your plan includes metered resources."})]});const h=m.filter(([,e])=>e.hasOverage).length,g=m.length>0?Math.round(m.reduce((e,[,t])=>e+(t.included>0?t.consumed/t.included*100:0),0)/m.length):0,b=Object.values(d).reduce((e,t)=>e+t.estimatedCost,0),y=Object.values(d)[0]?.currencySymbol??"$";return e("div",{className:"space-y-6",children:[e("div",{className:"flex items-center justify-between",children:[t("p",{className:"text-sm text-gray-600",children:"Monitor your resource consumption and quotas"}),e(iu,{variant:"ghost",size:"sm",onClick:p,disabled:l,children:[t(qd,{className:je("h-3.5 w-3.5 mr-1.5",l&&"animate-spin")}),l?"Refreshing...":"Refresh"]})]}),u&&e("div",{className:"flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50/50 px-4 py-3 text-sm text-gray-600",children:[t(Fd,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),e("span",{children:["Usage resets on ",t("span",{className:"font-medium text-gray-900",children:u.endDate}),null!==u.daysRemaining&&u.daysRemaining>0&&e("span",{className:"text-gray-500",children:[" (",u.daysRemaining," ",1===u.daysRemaining?"day":"days"," remaining)"]}),null!==u.daysRemaining&&u.daysRemaining<=0&&t("span",{className:"text-amber-600 font-medium",children:" (renewing soon)"})]})]}),e("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:[e("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Total Resources"}),t("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:m.length})]}),e("div",{className:"border border-gray-200 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Overall Usage"}),t("p",{className:"text-lg sm:text-xl font-semibold text-gray-900 mt-1",children:g+"%"})]}),e("div",{className:je("border rounded-lg p-3 sm:p-4",h>0?"border-red-200 bg-red-50":"border-gray-200"),children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"In Overage"}),t("p",{className:je("text-lg sm:text-xl font-semibold mt-1",h>0?"text-red-600":"text-gray-900"),children:h})]}),h>0&&b>0&&e("div",{className:"border border-red-200 bg-red-50 rounded-lg p-3 sm:p-4",children:[t("p",{className:"text-xs text-gray-500 font-medium",children:"Est. Overage Cost"}),t("p",{className:"text-lg sm:text-xl font-semibold mt-1 text-red-600",children:Zk(b,y)})]})]}),h>0&&t("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-4",children:e("div",{className:"flex items-start gap-3",children:[t(ru,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5 hidden sm:block"}),e("div",{className:"flex-1",children:[t("h3",{className:"text-sm font-semibold text-amber-800 mb-1",children:"Overage Detected"}),e("p",{className:"text-sm text-amber-700",children:[h," ",1===h?"resource has":"resources have"," exceeded the included quota. Additional usage will be billed as overage on your next invoice."]}),b>0&&e("p",{className:"text-sm text-amber-700 font-medium mt-1",children:["Estimated overage charges this period: ",Zk(b,y)]})]})]})}),t("div",{className:"space-y-3",children:m.map(([e,r])=>{const n=(a=r.consumed,(o=r.included)<=0?a>0?100:0:Math.min(a/o*100,100));var a,o;const i=function(e,t){return t?{bar:"bg-red-500",bg:"bg-red-100",badge:"bg-red-100",badgeText:"text-red-800"}:e>=90?{bar:"bg-amber-500",bg:"bg-amber-100",badge:"bg-amber-100",badgeText:"text-amber-800"}:e>=75?{bar:"bg-yellow-500",bg:"bg-yellow-100",badge:"bg-yellow-100",badgeText:"text-yellow-800"}:{bar:"bg-blue-500",bg:"bg-blue-100",badge:"bg-blue-100",badgeText:"text-blue-800"}}(n,r.hasOverage),s=d[e];return t(Yk,{slug:e,quota:r,percent:n,colors:i,pricing:s},e)})})]})};function Yk({slug:r,quota:n,percent:a,colors:o,pricing:i}){return e("div",{className:"border border-gray-200 rounded-lg p-4 sm:p-5",children:[e("div",{className:"flex flex-wrap items-center justify-between gap-y-1 mb-3",children:[e("div",{className:"flex items-center gap-2 min-w-0",children:[t("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:Hk(r)}),n.hasOverage&&t("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o.badge,o.badgeText),children:"Overage"}),!n.hasOverage&&a>=90&&t("span",{className:je("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o.badge,o.badgeText),children:"Almost full"})]}),e("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:[Kk(n.consumed)," / ",Kk(n.included)]})]}),t("div",{className:je("h-2 rounded-full w-full",o.bg),children:t("div",{className:je("h-2 rounded-full transition-all duration-500",o.bar),style:{width:`${a}%`}})}),e("div",{className:"flex items-center justify-between mt-2 text-xs text-gray-500",children:[e("span",{children:[Math.round(a),"% used"]}),t("span",{children:n.available>0?`${Kk(n.available)} remaining`:n.hasOverage?`${Kk(n.overage)} over limit`:"Fully used"})]}),n.hasOverage&&i&&e("div",{className:"mt-3 pt-3 border-t border-gray-200 space-y-2",children:[e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Overage units"}),t("span",{className:"font-medium text-gray-900",children:Kk(n.overage)})]}),e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Rate"}),e("span",{className:"font-medium text-gray-900",children:[i.currencySymbol,(i.overageCents/100).toFixed(2),i.unitSize>1?` / ${i.unitSize.toLocaleString()} units`:" / unit"]})]}),i.unitSize>1&&e("div",{className:"flex items-center justify-between text-xs",children:[t("span",{className:"text-gray-500",children:"Billable blocks"}),t("span",{className:"font-medium text-gray-900",children:Math.ceil(n.overage/i.unitSize).toLocaleString()})]}),e("div",{className:"flex items-center justify-between text-xs pt-2 border-t border-gray-200",children:[t("span",{className:"font-medium text-red-600",children:"Estimated charge"}),t("span",{className:"font-semibold text-red-600",children:Zk(i.estimatedCost,i.currencySymbol)})]})]}),!n.hasOverage&&i&&e("div",{className:"mt-2 text-xs text-gray-500",children:["Overage rate: ",i.currencySymbol,(i.overageCents/100).toFixed(2),i.unitSize>1?` / ${i.unitSize.toLocaleString()} units`:" / unit"]})]})}function Xk(e){const t=n.forwardRef((e,t)=>{const{children:r,...a}=e;if(n.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),o=function(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{const t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==n.Fragment&&(o.ref=t?gd(t,e):e),n.cloneElement(r,o)}return n.Children.count(r)>1?n.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Qk=Symbol("radix.slottable");function eN(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Qk}var tN=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"});n.forwardRef((e,r)=>t(rm.span,{...e,ref:r,style:{...tN,...e.style}})).displayName="VisuallyHidden";var rN=[" ","Enter","ArrowUp","ArrowDown"],nN=[" ","Enter"],aN="Select",[oN,iN,sN]=Og(aN),[lN]=Kp(aN,[sN,hS]),cN=hS(),[dN,uN]=lN(aN),[fN,pN]=lN(aN),mN=r=>{const{__scopeSelect:a,children:o,open:i,defaultOpen:s,onOpenChange:l,value:c,defaultValue:d,onValueChange:u,dir:f,name:p,autoComplete:m,disabled:h,required:g,form:b}=r,y=cN(a),[v,w]=n.useState(null),[x,S]=n.useState(null),[k,N]=n.useState(!1),E=Dg(f),[C,A]=Xp({prop:i,defaultProp:s??!1,onChange:l,caller:aN}),[_,T]=Xp({prop:c,defaultProp:d,onChange:u,caller:aN}),R=n.useRef(null),P=!v||(b||!!v.closest("form")),[O,I]=n.useState(new Set),D=Array.from(O).map(e=>e.props.value).join(";");return t(PS,{...y,children:e(dN,{required:g,scope:a,trigger:v,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:N,contentId:Jp(),value:_,onValueChange:T,open:C,onOpenChange:A,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t(oN.Provider,{scope:a,children:t(fN,{scope:r.__scopeSelect,onNativeOptionAdd:n.useCallback(e=>{I(t=>new Set(t).add(e))},[]),onNativeOptionRemove:n.useCallback(e=>{I(t=>{const r=new Set(t);return r.delete(e),r})},[]),children:o})}),P?e(XN,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:m,value:_,onChange:e=>T(e.target.value),disabled:h,form:b,children:[void 0===_?t("option",{value:""}):null,Array.from(O)]},D):null]})})};mN.displayName=aN;var hN="SelectTrigger",gN=n.forwardRef((e,r)=>{const{__scopeSelect:a,disabled:o=!1,...i}=e,s=cN(a),l=uN(hN,a),c=l.disabled||o,d=bd(r,l.onTriggerChange),u=iN(a),f=n.useRef("touch"),[p,m,h]=eE(e=>{const t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===l.value),n=tE(t,e,r);void 0!==n&&l.onValueChange(n.value)}),g=e=>{c||(l.onOpenChange(!0),h()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t(OS,{asChild:!0,...s,children:t(rm.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":QN(l.value)?"":void 0,...i,ref:d,onClick:Gp(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==f.current&&g(e)}),onPointerDown:Gp(i.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:Gp(i.onKeyDown,e=>{const t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||m(e.key),t&&" "===e.key||rN.includes(e.key)&&(g(),e.preventDefault())})})})});gN.displayName=hN;var bN="SelectValue",yN=n.forwardRef((e,n)=>{const{__scopeSelect:a,className:o,style:i,children:s,placeholder:l="",...c}=e,d=uN(bN,a),{onValueNodeHasChildrenChange:u}=d,f=void 0!==s,p=bd(n,d.onValueNodeChange);return bp(()=>{u(f)},[u,f]),t(rm.span,{...c,ref:p,style:{pointerEvents:"none"},children:QN(d.value)?t(r,{children:l}):s})});yN.displayName=bN;var vN=n.forwardRef((e,r)=>{const{__scopeSelect:n,children:a,...o}=e;return t(rm.span,{"aria-hidden":!0,...o,ref:r,children:a||"โ–ผ"})});vN.displayName="SelectIcon";var wN=e=>t(xm,{asChild:!0,...e});wN.displayName="SelectPortal";var xN="SelectContent",SN=n.forwardRef((e,r)=>{const a=uN(xN,e.__scopeSelect),[o,i]=n.useState();if(bp(()=>{i(new DocumentFragment)},[]),!a.open){const r=o;return r?v.createPortal(t(NN,{scope:e.__scopeSelect,children:t(oN.Slot,{scope:e.__scopeSelect,children:t("div",{children:e.children})})}),r):null}return t(AN,{...e,ref:r})});SN.displayName=xN;var kN=10,[NN,EN]=lN(xN),CN=function(e){const r=Xk(e),a=n.forwardRef((e,a)=>{const{children:o,...i}=e,s=n.Children.toArray(o),l=s.find(eN);if(l){const e=l.props.children,o=s.map(t=>t===l?n.Children.count(e)>1?n.Children.only(null):n.isValidElement(e)?e.props.children:null:t);return t(r,{...i,ref:a,children:n.isValidElement(e)?n.cloneElement(e,void 0,o):null})}return t(r,{...i,ref:a,children:o})});return a.displayName=`${e}.Slot`,a}("SelectContent.RemoveScroll"),AN=n.forwardRef((e,r)=>{const{__scopeSelect:a,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y,...v}=e,w=uN(xN,a),[x,S]=n.useState(null),[k,N]=n.useState(null),E=bd(r,e=>S(e)),[C,A]=n.useState(null),[_,T]=n.useState(null),R=iN(a),[P,O]=n.useState(!1),I=n.useRef(!1);n.useEffect(()=>{if(x)return wh(x)},[x]),Em();const D=n.useCallback(e=>{const[t,...r]=R().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}},[R,k]),U=n.useCallback(()=>D([C,x]),[D,C,x]);n.useEffect(()=>{P&&U()},[P,U]);const{onOpenChange:M,triggerPointerDownPosRef:F}=w;n.useEffect(()=>{if(x){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():x.contains(r.target)||M(!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})}}},[x,M,F]),n.useEffect(()=>{const e=()=>M(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[M]);const[z,L]=eE(e=>{const t=R().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=tE(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),j=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&(A(e),n&&(I.current=!0))},[w.value]),$=n.useCallback(()=>x?.focus(),[x]),V=n.useCallback((e,t,r)=>{const n=!I.current&&!r;(void 0!==w.value&&w.value===t||n)&&T(e)},[w.value]),W="popper"===o?TN:_N,B=W===TN?{side:c,sideOffset:d,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:b,avoidCollisions:y}:{};return t(NN,{scope:a,content:x,viewport:k,onViewportChange:N,itemRefCallback:j,selectedItem:C,onItemLeave:$,itemTextRefCallback:V,focusSelectedItem:U,selectedItemText:_,position:o,isPositioned:P,searchRef:z,children:t(ph,{as:CN,allowPinchZoom:!0,children:t(mm,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Gp(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:t(lm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>O(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Gp(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||L(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().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(()=>D(t)),e.preventDefault()}})})})})})})});AN.displayName="SelectContentImpl";var _N=n.forwardRef((e,r)=>{const{__scopeSelect:a,onPlaced:o,...i}=e,s=uN(xN,a),l=EN(xN,a),[c,d]=n.useState(null),[u,f]=n.useState(null),p=bd(r,e=>f(e)),m=iN(a),h=n.useRef(!1),g=n.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:v,focusSelectedItem:w}=l,x=n.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&b&&y&&v){const e=s.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),n=v.getBoundingClientRect();if("rtl"!==s.dir){const a=n.left-t.left,o=r.left-a,i=e.left-o,s=e.width+i,l=Math.max(s,t.width),d=window.innerWidth-kN,u=Ab(o,[kN,Math.max(kN,d-l)]);c.style.minWidth=s+"px",c.style.left=u+"px"}else{const a=t.right-n.right,o=window.innerWidth-r.right-a,i=window.innerWidth-e.right-o,s=e.width+i,l=Math.max(s,t.width),d=window.innerWidth-kN,u=Ab(o,[kN,Math.max(kN,d-l)]);c.style.minWidth=s+"px",c.style.right=u+"px"}const a=m(),i=window.innerHeight-2*kN,l=b.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),w=f+p+l+parseInt(d.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),S=window.getComputedStyle(b),k=parseInt(S.paddingTop,10),N=parseInt(S.paddingBottom,10),E=e.top+e.height/2-kN,C=i-E,A=y.offsetHeight/2,_=f+p+(y.offsetTop+A),T=w-_;if(_<=E){const e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom="0px";const t=u.clientHeight-b.offsetTop-b.offsetHeight,r=_+Math.max(C,A+(e?N:0)+t+g);c.style.height=r+"px"}else{const e=a.length>0&&y===a[0].ref.current;c.style.top="0px";const t=Math.max(E,f+b.offsetTop+(e?k:0)+A)+T;c.style.height=t+"px",b.scrollTop=_-E+b.offsetTop}c.style.margin=`${kN}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=i+"px",o?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,c,u,b,y,v,s.dir,o]);bp(()=>x(),[x]);const[S,k]=n.useState();bp(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const N=n.useCallback(e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)},[x,w]);return t(RN,{scope:a,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:t("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:t(rm.div,{...i,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});_N.displayName="SelectItemAlignedPosition";var TN=n.forwardRef((e,r)=>{const{__scopeSelect:n,align:a="start",collisionPadding:o=kN,...i}=e,s=cN(n);return t(IS,{...s,...i,ref:r,align:a,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}})});TN.displayName="SelectPopperPosition";var[RN,PN]=lN(xN,{}),ON="SelectViewport",IN=n.forwardRef((a,o)=>{const{__scopeSelect:i,nonce:s,...l}=a,c=EN(ON,i),d=PN(ON,i),u=bd(o,c.onViewportChange),f=n.useRef(0);return e(r,{children:[t("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}),t(oN.Slot,{scope:i,children:t(rm.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:Gp(l.onScroll,e=>{const t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=d;if(n?.current&&r){const e=Math.abs(f.current-t.scrollTop);if(e>0){const n=window.innerHeight-2*kN,a=parseFloat(r.style.minHeight),o=parseFloat(r.style.height),i=Math.max(a,o);if(i<n){const a=i+e,o=Math.min(n,a),s=a-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}f.current=t.scrollTop})})})]})});IN.displayName=ON;var DN="SelectGroup",[UN,MN]=lN(DN);n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=Jp();return t(UN,{scope:n,id:o,children:t(rm.div,{role:"group","aria-labelledby":o,...a,ref:r})})}).displayName=DN;var FN="SelectLabel",zN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=MN(FN,n);return t(rm.div,{id:o.id,...a,ref:r})});zN.displayName=FN;var LN="SelectItem",[jN,$N]=lN(LN),VN=n.forwardRef((e,r)=>{const{__scopeSelect:a,value:o,disabled:i=!1,textValue:s,...l}=e,c=uN(LN,a),d=EN(LN,a),u=c.value===o,[f,p]=n.useState(s??""),[m,h]=n.useState(!1),g=bd(r,e=>d.itemRefCallback?.(e,o,i)),b=Jp(),y=n.useRef("touch"),v=()=>{i||(c.onValueChange(o),c.onOpenChange(!1))};if(""===o)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 t(jN,{scope:a,value:o,disabled:i,textId:b,isSelected:u,onItemTextChange:n.useCallback(e=>{p(t=>t||(e?.textContent??"").trim())},[]),children:t(oN.ItemSlot,{scope:a,value:o,disabled:i,textValue:f,children:t(rm.div,{role:"option","aria-labelledby":b,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:g,onFocus:Gp(l.onFocus,()=>h(!0)),onBlur:Gp(l.onBlur,()=>h(!1)),onClick:Gp(l.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:Gp(l.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:Gp(l.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:Gp(l.onPointerMove,e=>{y.current=e.pointerType,i?d.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Gp(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Gp(l.onKeyDown,e=>{""!==d.searchRef?.current&&" "===e.key||(nN.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});VN.displayName=LN;var WN="SelectItemText",BN=n.forwardRef((a,o)=>{const{__scopeSelect:i,className:s,style:l,...c}=a,d=uN(WN,i),u=EN(WN,i),f=$N(WN,i),p=pN(WN,i),[m,h]=n.useState(null),g=bd(o,e=>h(e),f.onItemTextChange,e=>u.itemTextRefCallback?.(e,f.value,f.disabled)),b=m?.textContent,y=n.useMemo(()=>t("option",{value:f.value,disabled:f.disabled,children:b},f.value),[f.disabled,f.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:x}=p;return bp(()=>(w(y),()=>x(y)),[w,x,y]),e(r,{children:[t(rm.span,{id:f.textId,...c,ref:g}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?v.createPortal(c.children,d.valueNode):null]})});BN.displayName=WN;var GN="SelectItemIndicator",KN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return $N(GN,n).isSelected?t(rm.span,{"aria-hidden":!0,...a,ref:r}):null});KN.displayName=GN;var HN="SelectScrollUpButton";n.forwardRef((e,r)=>{const a=EN(HN,e.__scopeSelect),o=PN(HN,e.__scopeSelect),[i,s]=n.useState(!1),l=bd(r,o.onScrollButtonChange);return bp(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollTop>0;s(e)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(qN,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=HN;var ZN="SelectScrollDownButton";n.forwardRef((e,r)=>{const a=EN(ZN,e.__scopeSelect),o=PN(ZN,e.__scopeSelect),[i,s]=n.useState(!1),l=bd(r,o.onScrollButtonChange);return bp(()=>{if(a.viewport&&a.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,r=Math.ceil(t.scrollTop)<e;s(r)};const t=a.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[a.viewport,a.isPositioned]),i?t(qN,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=a;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=ZN;var qN=n.forwardRef((e,r)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,s=EN("SelectScrollButton",a),l=n.useRef(null),c=iN(a),d=n.useCallback(()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)},[]);return n.useEffect(()=>()=>d(),[d]),bp(()=>{const e=c().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[c]),t(rm.div,{"aria-hidden":!0,...i,ref:r,style:{flexShrink:0,...i.style},onPointerDown:Gp(i.onPointerDown,()=>{null===l.current&&(l.current=window.setInterval(o,50))}),onPointerMove:Gp(i.onPointerMove,()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))}),onPointerLeave:Gp(i.onPointerLeave,()=>{d()})})}),JN=n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e;return t(rm.div,{"aria-hidden":!0,...a,ref:r})});JN.displayName="SelectSeparator";var YN="SelectArrow";n.forwardRef((e,r)=>{const{__scopeSelect:n,...a}=e,o=cN(n),i=uN(YN,n),s=EN(YN,n);return i.open&&"popper"===s.position?t(DS,{...o,...a,ref:r}):null}).displayName=YN;var XN=n.forwardRef(({__scopeSelect:e,value:r,...a},o)=>{const i=n.useRef(null),s=bd(o,i),l=eb(r);return n.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==r&&n){const t=new Event("change",{bubbles:!0});n.call(e,r),e.dispatchEvent(t)}},[l,r]),t(rm.select,{...a,style:{...tN,...a.style},ref:s,defaultValue:r})});function QN(e){return""===e||void 0===e}function eE(e){const t=hp(e),r=n.useRef(""),a=n.useRef(0),o=n.useCallback(e=>{const n=r.current+e;t(n),function e(t){r.current=t,window.clearTimeout(a.current),""!==t&&(a.current=window.setTimeout(()=>e(""),1e3))}(n)},[t]),i=n.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,o,i]}function tE(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 o=function(e,t){return e.map((r,n)=>e[(t+n)%e.length])}(e,Math.max(a,0));1===n.length&&(o=o.filter(e=>e!==r));const i=o.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}XN.displayName="SelectBubbleInput";var rE=gN,nE=vN,aE=wN,oE=SN,iE=IN,sE=zN,lE=VN,cE=BN,dE=KN,uE=JN;const fE=mN,pE=n.forwardRef(({className:r,children:n,...a},o)=>e(rE,{ref:o,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",r),...a,children:[n,t(nE,{asChild:!0,children:t(pg,{className:"h-4 w-4 opacity-50"})})]}));pE.displayName=rE.displayName;const mE=n.forwardRef(({className:e,children:r,position:a="popper",...o},i)=>{const{container:s}=n.useContext(Eo);return t(aE,{container:s,children:t(oE,{ref:i,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"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:a,...o,children:t(iE,{className:je("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});mE.displayName=oE.displayName;n.forwardRef(({className:e,...r},n)=>t(sE,{ref:n,className:je("px-2 py-1.5 text-sm font-semibold",e),...r})).displayName=sE.displayName;const hE=n.forwardRef(({className:r,children:n,...a},o)=>e(lE,{ref:o,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",r),...a,children:[t("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t(dE,{children:t(hg,{className:"h-4 w-4"})})}),t(cE,{children:n})]}));hE.displayName=lE.displayName;n.forwardRef(({className:e,...r},n)=>t(uE,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",e),...r})).displayName=uE.displayName;const gE=({workspace:r})=>{const{user:n}=So(),[a,o]=f(0),[i,s]=f(!1),[l,c]=f([]),[u,p]=f(null),{getUsers:m,removeUser:h,updateUser:g}=Sr(),{settings:b}=pr(),{response:y}=Wr();d(()=>{r&&(s(!0),m(r._id).then(e=>{c(e)}).catch(e=>{Ye(e,{component:"WorkspaceSettingsUsers",action:"getUsers",metadata:{workspaceId:r._id}})}).finally(()=>{s(!1)}))},[r,a]);const v=()=>{o(e=>e+1)};if(i||!r)return t(rv,{});const w=e=>"string"==typeof e?{name:"Unknown User",email:e,id:e,role:"-"}:{name:e.name,email:e.email,id:e._id},x=l.map(e=>({...e,...w(e.user)})),S=l.find(e=>("string"==typeof e.user?e.user:e.user._id)===n?.id)?.role,k="admin"===S,N=y?.subscription,E=y?.planVersion,C=N?.seatPricingEnabled,A=r?.billingCurrency||"usd",_=E?Ok(E,A):null,T=_?.includedSeats??0,R=_?.maxSeats??0,P=l.length,O=C&&R>0&&P>=R,I=b?.workspace.maxWorkspaceUsers??Number.MAX_VALUE,D=C?!O:I>P,U=N?.billingInterval??"monthly",M=E?Ik(E,A,U):null,F=C&&P>=T;return e("div",{children:[!k&&t("div",{className:"text-red-500",children:"Only workspace admin can manage users and roles."}),k&&t("div",{className:"mb-4",children:D?e("div",{children:[t(bE,{onInvite:v,workspaceId:r._id}),F&&M&&M>0&&t("div",{className:"flex items-center gap-1.5 mt-2 text-xs text-amber-600 bg-amber-50 px-3 py-1.5 rounded-md",children:e("span",{children:["Each additional member adds ",e("span",{className:"font-medium",children:[kv(M,A),"/","yearly"===U?"yr":"quarterly"===U?"qtr":"mo"]})," to your subscription"]})})]}):t("div",{className:"flex items-center justify-between p-3 bg-red-50 border border-red-100 rounded-md",children:e("div",{children:[t("p",{className:"text-sm font-medium text-red-700",children:O?"Seat limit reached":"Member limit reached"}),t("p",{className:"text-xs text-red-600 mt-0.5",children:O?`Your plan allows up to ${R} members. Upgrade for more seats.`:"Contact your admin to increase the workspace member limit."})]})})}),C&&_&&e("div",{className:"mb-4 rounded-lg border bg-gray-50 p-4",children:[e("div",{className:"flex items-center justify-between mb-2",children:[t("h4",{className:"text-sm font-semibold text-gray-900",children:"Seats"}),R>0&&e("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full "+(P>=R?"bg-red-100 text-red-700":P>=.8*R?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700"),children:[P," / ",R]})]}),R>0&&t("div",{className:"w-full h-1.5 bg-gray-200 rounded-full mb-3",children:t("div",{className:"h-1.5 rounded-full transition-all "+(P>=R?"bg-red-500":P>=.8*R?"bg-amber-500":"bg-emerald-500"),style:{width:`${Math.min(100,P/R*100)}%`}})}),e("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[e("div",{children:[t("span",{className:"text-gray-900 font-medium",children:T})," included",M&&M>0&&e("span",{className:"text-gray-400",children:[" ยท ",kv(M,A),"/extra seat"]})]}),R>0?e("span",{children:[Math.max(0,R-P)," available"]}):t("span",{className:"text-gray-400",children:"No seat limit"})]})]}),e("div",{className:"mb-4 flex items-center justify-between",children:[t("div",{children:e("div",{className:"text-sm text-gray-600",children:[P," member",1!==P?"s":""]})}),t("div",{children:t(iu,{variant:"ghost",size:"sm",onClick:v,progress:i,children:i?"Refreshing...":"Refresh"})})]}),t("ul",{className:"space-y-2",children:x.map((a,o)=>{const i=a.id===n?.id,s=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===a.id;return e("li",{className:"flex items-center justify-between border rounded p-3",children:[e("div",{className:"flex items-center space-x-3",children:[t("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center text-sm font-medium",children:a.name.charAt(0).toUpperCase()}),e("div",{children:[t("div",{className:"font-medium",children:a.name}),t("div",{className:"text-xs text-gray-500",children:a.email})]})]}),e("div",{className:"flex items-center gap-x-1",children:[e("div",{className:"relative",children:[e(fE,{disabled:i||!k||s||u===a.id,value:a.role,onValueChange:e=>{return t=r._id,n=a.id,o=e,void(vr(r,n)?Ye(new Error("Cannot change the role of the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}}):(p(n),g(t,n,{role:o}).then(()=>{v()}).catch(e=>{Ye(e,{component:"WorkspaceSettingsUsers",action:"handleUpdateRole",metadata:{workspaceId:t,userId:n,role:o}})}).finally(()=>{p(null)})));var t,n,o},children:[t(pE,{children:t(yN,{placeholder:"Select a role"})}),t(mE,{children:r?.roles.map(e=>t(hE,{value:e,children:e},e))})]}),u===a.id&&t("div",{className:"absolute right-8 top-1/2 -translate-y-1/2 pointer-events-none",children:t(Kd,{className:"h-4 w-4 animate-spin text-gray-500"})})]}),i&&t("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:"You"}),s&&t("span",{className:"text-xs bg-purple-100 text-purple-800 px-2 py-1 rounded",children:"Owner"}),!i&&!s&&k&&t(iu,{variant:"destructive",size:"sm",startIcon:t(tu,{}),onClick:()=>{var e;e=a.id,vr(r,e)?Ye(new Error("Cannot remove the workspace owner"),{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}}):h(r._id,e).then(()=>{v()}).catch(t=>{Ye(t,{component:"WorkspaceSettingsUsers",action:"handleRemoveUser",metadata:{workspaceId:r._id,userId:e}})})}})]})]},o)})}),0===l.length&&t("div",{className:"text-center py-8 text-gray-500",children:"No members found in this workspace."})]})};function bE({onInvite:r,workspaceId:n}){const[a,o]=f(""),[s,l]=f("admin"),[c,u]=f(!1),[p,m]=f(null),[h,g]=f(null),b=i(null),{addUser:y,getWorkspace:v}=Sr();d(()=>()=>{b.current&&clearTimeout(b.current)},[]);const[w,x]=f(null),{settings:S}=pr(),k=S?.workspace.roles??w?.roles??[];d(()=>{n&&v(n).then(x)},[n]);const N=()=>{m(null),g(null),o(""),l("admin")};return e("div",{className:"flex gap-2 flex-col gap-y-2",children:[p&&t("div",{className:"text-red-500 capitalize",children:p}),h&&t("div",{className:"text-green-500 capitalize",children:h}),e("div",{children:[t(uu,{children:"Invite member by email"}),t(Su,{type:"email",value:a,onChange:e=>o(e.target.value),placeholder:"example@example.com"})]}),e("div",{children:[t(uu,{children:"Role"}),e(fE,{value:s,onValueChange:l,children:[t(pE,{children:t(yN,{placeholder:"Select a role"})}),t(mE,{children:k.map(e=>t(hE,{value:e,children:e},e))})]})]}),t("div",{children:t(iu,{progress:c,onClick:async()=>{const e=a.trim();if(!e)return void m("Email is required");/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?(u(!0),await y(n,e,s).then(()=>{g("User invited successfully"),r?.()}).catch(t=>{Ye(t,{component:"InviteMember",action:"addUser",metadata:{workspaceId:n,email:e,role:s}}),m(t instanceof Error?t.message:"Failed to invite member")}).finally(()=>{u(!1),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{N()},6e3)})):m("Invalid email address format")},disabled:c||!a||!s,children:c?"Inviting...":`Invite as ${s}`})})]})}const yE=({workspace:r,section:n,setSection:a})=>{const{user:o}=So(),i=("object"==typeof r.createdBy&&null!==r.createdBy?r.createdBy._id:r.createdBy)===o?.id,s=wr(r,o?.id??null),l=i||"admin"===s?.toLowerCase();return e("div",{className:"w-44 sm:w-56 h-full flex flex-col space-y-4 sm:space-y-6 shrink-0",children:[r&&t("div",{className:"border-b p-2 py-4",children:e("div",{className:"flex items-center gap-x-2",children:[r.image&&r.image.trim()&&t("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:t("img",{src:r.image,className:"w-full h-full object-contain",style:{width:"36px",height:"36px",maxWidth:"36px",maxHeight:"36px",objectFit:"contain"},alt:r.name})}),e("div",{className:je("flex-1 min-w-0",r.image?"":"pl-2"),children:[t("div",{className:"font-medium text-sm line-clamp-1 text-ellipsis overflow-hidden",children:r.name}),t("div",{className:"text-xs text-gray-500",children:r.workspaceId})]})]})}),t(vE,{title:"Account",children:t(wE,{activeSection:n,icon:t(nu,{className:"h-3.5 w-3.5"}),label:"Profile",section:"profile",onClick:()=>a("profile")})}),e(vE,{title:"Workspace",children:[t(wE,{activeSection:n,icon:t(Yd,{className:"h-3.5 w-3.5"}),label:"General",section:"general",onClick:()=>a("general")}),t(wE,{activeSection:n,icon:t(au,{className:"h-3.5 w-3.5"}),label:"Users",section:"users",onClick:()=>a("users")}),t(wE,{activeSection:n,icon:t($d,{className:"h-3.5 w-3.5"}),label:"Plan & Billing",section:"subscription",onClick:()=>a("subscription")}),t(wE,{activeSection:n,icon:t(zd,{className:"h-3.5 w-3.5"}),label:"Usage",section:"usage",onClick:()=>a("usage")}),t(wE,{activeSection:n,icon:t(Qd,{className:"h-3.5 w-3.5"}),label:"Features",section:"features",onClick:()=>a("features")}),l&&t(wE,{activeSection:n,icon:t(ru,{className:"h-3.5 w-3.5"}),label:"Danger Zone",section:"danger",onClick:()=>a("danger")})]})]})};function vE({title:r,children:n}){return e("div",{className:"px-2 flex flex-col space-y-1",children:[t("div",{className:"text-xs font-bold mb-2 text-gray-500 uppercase tracking-wide px-2",children:r}),n]})}function wE({icon:t,label:r,section:n,onClick:a,activeSection:o}){return e("button",{className:je("flex w-full text-left px-2 py-1 rounded text-sm items-center gap-x-1",n===o?"bg-blue-100 text-blue-700 font-medium":"hover:bg-gray-200 hover:text-gray-700"),onClick:()=>a(n),children:[t,r]})}const xE=({workspace:r,onClose:n,open:a,onOpenChange:o,defaultSection:i="profile",section:s,onSectionChange:l,showTrigger:c=!0,trigger:d})=>{const[u,p]=f(!1),[m,h]=f(i),g=void 0!==a?a:u,b=o||p,y=void 0!==s?s:m,v=l||h;if(!r)return null;const w=t(iu,{variant:"outline",size:"icon",children:t(Yd,{className:"h-4 w-4"})});return e(wg,{open:g,onOpenChange:e=>{b(e),!e&&n&&n()},children:[c&&t(xg,{asChild:!0,children:d||w}),e(Ng,{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:[t(Ag,{className:"sr-only",children:"Workspace settings dialog"}),t(yE,{workspace:r,section:y,setSection:v}),e("div",{className:"flex-1 p-6 overflow-auto flex flex-col bg-background",children:[e(Cg,{className:"text-xl font-bold mb-4 capitalize",children:["profile"===y&&"Account","general"===y&&"Workspace Settings","users"===y&&"Workspace Members","subscription"===y&&"Plan & Billing","usage"===y&&"Usage","features"===y&&"Workspace Features","danger"===y&&"Danger Zone"]}),e("div",{className:"max-h-[500px] overflow-y-auto",children:["profile"===y&&t(kk,{workspace:r}),"general"===y&&t(Rv,{workspace:r}),"users"===y&&t(gE,{workspace:r}),"subscription"===y&&t(Gk,{workspace:r}),"usage"===y&&t(Jk,{}),"features"===y&&t(gv,{workspaceId:r._id?.toString()}),"danger"===y&&t(nv,{workspace:r})]})]})]})]})};var SE=Object.freeze({__proto__:null,WorkspaceSettingsDialog:xE,default:xE});function kE(n){const{isAuthenticated:a,user:o}=So(),i=S(fr()),{workspaces:s,currentWorkspace:l,loading:c,refreshing:u,switchingToId:p,fetchWorkspaces:m,getFeatures:h,refreshWorkspaces:g,setCurrentWorkspace:b,switchToWorkspace:y}=Sr(),{settings:v}=pr(),[w,x]=f(!1),[k,N]=f(0),[E,C]=f(""),A=c||u;d(()=>{a&&i&&(0===s.length?(m(),h()):h())},[a,i]),d(()=>{a&&i&&k>0&&g()},[k,a,i]);const _=s,T=_.filter(e=>e._id!==l?._id).filter(e=>e.name.toLowerCase().includes(E.toLowerCase())),R=v?.workspace.maxWorkspaces??Number.MAX_VALUE,P=_?.filter(e=>("object"==typeof e.createdBy?e.createdBy._id?.toString():e.createdBy?.toString())===o?.id?.toString()).length,O=R>(P??0);return e(wg,{open:w,onOpenChange:x,children:[t(xg,{children:n.trigger?.(A,l)}),e(Ng,{className:"max-w-2xl min-w-full sm:min-w-[800px]",children:[e(Eg,{children:[e(Cg,{className:"flex items-center gap-2",children:[t(Md,{className:"h-5 w-5"}),"Switch Workspace"]}),t(Ag,{children:"Select a workspace to switch to or create a new one."})]}),!o&&t("div",{className:"flex flex-col items-center justify-center h-full py-4 sm:py-8",children:t("div",{className:"text-sm font-medium text-muted-foreground",children:"Looks like you are not logged in. Please login to continue."})}),o&&e("div",{className:"flex flex-col gap-4",children:[l&&t(NE,{workspace:l,isCurrentWorkspace:!0,switchToWorkspace:y,switchingToId:p,onClose:()=>x(!1),setCurrentWorkspace:b,setOpen:x,workspacesToUse:_}),t(by,{}),e("div",{children:[e("div",{className:"flex items-center justify-between",children:[e("div",{className:"text-sm font-medium text-muted-foreground",children:["Available Workspaces (",T.length,")"]}),t("div",{children:t(iu,{progress:u,disabled:u,variant:"ghost",onClick:function(){a&&i&&N(e=>e+1)},startIcon:t(Zd,{}),children:u?"Refreshing...":"Refresh"})})]}),e("div",{className:"relative",children:[t(Jd,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t(Su,{placeholder:"Search workspaces...",value:E,onChange:e=>C(e.target.value),className:"pl-10"})]}),c?e("div",{className:"flex items-center justify-center py-8",children:[t(Kd,{className:"h-6 w-6 animate-spin text-muted-foreground"}),t("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading workspaces..."})]}):0===T.length?e("div",{className:"text-center py-8",children:[t(Md,{className:"mx-auto h-12 w-12 text-muted-foreground"}),t("p",{className:"mt-2 text-sm text-muted-foreground",children:E?"No workspaces found":"No workspaces available"})]}):t(dy,{className:"h-64",children:t("div",{className:"flex flex-col gap-2 my-2.5",children:T.map(e=>{const r=e._id===l?._id;return t(NE,{workspace:e,isCurrentWorkspace:r,switchToWorkspace:y,switchingToId:p,onClose:()=>x(!1),setCurrentWorkspace:b,setOpen:x,workspacesToUse:_},e._id)})})})]}),O&&e(r,{children:[t(by,{}),t(EE,{onCreated:()=>{m()}})]})]})]})]})}function NE(r){const{workspace:n,setCurrentWorkspace:a,setOpen:o,workspacesToUse:i,switchingToId:s}=r,l=r.isCurrentWorkspace??!1,c=s===n._id,d=n.subscription??null,u=null!=d&&"object"==typeof d?d.plan??null:null,f=u?.name??"";return e("div",{className:je("flex items-center gap-3 rounded-lg border-2 p-3 border-border",{"bg-muted text-muted-foreground":l}),children:[e(Vp,{className:"h-8 w-8 flex items-center justify-center",children:[t("div",{children:t(Wp,{src:n.image&&n.image.trim()?n.image:void 0})}),t(Bp,{children:(p=n.name,p.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2))})]}),e("div",{className:"flex-1 min-w-0 max-w-full",children:[t("div",{className:"flex items-center gap-2",children:t("span",{className:"font-medium line-clamp-1 text-ellipsis overflow-hidden max-w-full",children:n.name})}),e("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[t(au,{className:"h-3 w-3"}),e("span",{children:[n.users?.length||0," members"]})]}),f&&t("div",{className:"max-w-fit",children:t("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:t("span",{className:"text-xs",children:f})})})]}),e("div",{className:"flex items-center gap-2",children:[l?null:t(iu,{size:"sm",disabled:null!==s||c,progress:c,onClick:()=>{r.switchToWorkspace(n).then(()=>o(!1)).catch(e=>{Ye(e,{component:"WorkspaceItem",action:"switchToWorkspace",metadata:{workspaceId:n._id}})})},children:"Switch to"}),t(xE,{workspace:n,onClose:()=>{if(l){const e=i.findIndex(e=>e._id?.toString()===n._id?.toString());-1!==e&&a(i[e])}}})]})]});var p}function EE(n){const{switching:a}=Sr(),[o,i]=f(!1),[s,l]=f("emoji"),[c,d]=f("๐Ÿข"),[u,p]=f(!1),{createWorkspace:m}=Sr(),h=is({resolver:md(Nf({name:Ju().min(2,{message:"Workspace name must be at least 2 characters."}),image:Ju().optional()})),defaultValues:{name:"",image:""}});return e(wg,{open:o,onOpenChange:i,children:[t(xg,{asChild:!0,children:e(iu,{className:"w-full rounded-none",disabled:a,children:[t(Hd,{className:"h-4 w-4 mr-2"}),"Create New Workspace"]})}),e(Ng,{className:"max-w-xl min-w-full sm:min-w-[600px]",children:[e(Eg,{children:[t(Cg,{children:"Create New Workspace"}),t(Ag,{children:"Create a new workspace to get started."})]}),t(fu,{...h,children:e("form",{onSubmit:h.handleSubmit(async function(e){let t="";if("emoji"===s)t=_v(c);else if("url"===s&&e.image)try{new URL(e.image),t=e.image}catch{return void h.setError("image",{message:"Please enter a valid URL"})}p(!0);try{await m(e.name,t),i(!1),h.reset(),d("๐Ÿข"),l("emoji"),n?.onCreated?.()}catch(t){Ye(t,{component:"WorkspaceProvider",action:"createWorkspace",metadata:{name:e.name}})}finally{p(!1)}}),children:[t(mu,{control:h.control,name:"name",render:({field:r})=>e(bu,{children:[t(yu,{children:"Workspace Name"}),t(vu,{children:t(Su,{placeholder:"My Awesome Workspace",...r})}),t(xu,{})]})}),e("div",{className:"flex flex-col gap-y-2 my-2",children:[e("div",{children:[t(uu,{className:"text-sm font-medium",children:"Workspace Icon"}),t(wu,{children:"Choose an emoji or upload a custom image for your workspace."})]}),e(Eb,{value:s,onValueChange:e=>l(e),className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Cb,{value:"emoji",id:"emoji"}),e(uu,{htmlFor:"emoji",className:"flex items-center gap-2",children:[t(Xd,{className:"h-4 w-4"}),"Choose Emoji"]})]}),e("div",{className:"flex items-center gap-x-2 my-1",children:[t(Cb,{value:"url",id:"url"}),e(uu,{htmlFor:"url",className:"flex items-center gap-2",children:[t(Gd,{className:"h-4 w-4"}),"Custom Image URL"]})]})]}),"emoji"===s&&e("div",{className:"flex flex-col gap-y-2",children:[e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border flex items-center justify-center text-2xl bg-muted",children:c})]}),t(dy,{className:"h-32 w-full rounded-md border",children:t("div",{className:"p-4 grid grid-cols-8 gap-2",children:Tv.map((e,r)=>t("button",{type:"button",onClick:()=>(e=>{d(e),h.setValue("image",_v(e))})(e),className:"w-8 h-8 rounded flex items-center justify-center text-lg hover:bg-muted transition-colors "+(c===e?"bg-primary text-primary-foreground":""),children:e},r))})})]}),"url"===s&&e("div",{className:"flex flex-col gap-y-2",children:[t(mu,{control:h.control,name:"image",render:({field:r})=>e(bu,{children:[t(yu,{children:"Image URL"}),t(vu,{children:t(Su,{placeholder:"https://example.com/image.png",...r})}),t(wu,{children:"Enter a valid URL for your workspace image. Supports PNG, JPG, and SVG formats."}),t(xu,{})]})}),h.watch("image")&&h.watch("image")?.trim()&&e("div",{className:"flex items-center gap-3",children:[t("span",{className:"text-sm font-medium",children:"Preview:"}),t("div",{className:"w-12 h-12 rounded-lg border-2 border-border overflow-hidden bg-muted",children:t("img",{src:h.watch("image")||void 0,alt:"Workspace preview",className:"w-full h-full object-cover",onError:e=>{e.currentTarget.style.display="none"}})})]})]})]}),e("div",{className:"flex justify-end gap-3 pt-4",children:[t(iu,{type:"button",variant:"outline",onClick:()=>{i(!1),h.reset(),d("๐Ÿข"),l("emoji")},disabled:u,children:"Cancel"}),t(iu,{type:"submit",disabled:u,children:u?e(r,{children:[t(Kd,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Workspace"})]})]})})]})]})}function CE(e){if(!e)return null;const t=new Date(e);return isNaN(t.getTime())?null:t}function AE(){const{response:e}=Wr();return s(()=>{const t=e?.subscription;if(!t||"trialing"!==t.subscriptionStatus)return{isTrialing:!1,daysRemaining:0,trialEndsAt:null,trialStartedAt:null,isTrialEnding:!1};const r=CE(t.trialEnd)??CE(t.stripeCurrentPeriodEnd),n=CE(t.trialStart),a=r?Math.max(0,Math.ceil((r.getTime()-Date.now())/864e5)):0;return{isTrialing:!0,daysRemaining:a,trialEndsAt:r,trialStartedAt:n,isTrialEnding:a<=3}},[e])}function _E(e){const{response:t}=Wr();return s(()=>{const r={hasSeatPricing:!1,memberCount:0,includedSeats:0,maxSeats:0,billableSeats:0,availableSeats:1/0,isAtMax:!1,isNearMax:!1,perSeatPriceCents:null,currency:""};if(!t?.subscription||!e)return r;const n=t.subscription;if(!n.seatPricingEnabled)return{...r,memberCount:e.users?.length??0};const a=t.planVersion,o=e.billingCurrency||"usd",i=a?Ok(a,o):null;if(!i)return{...r,hasSeatPricing:!0,memberCount:e.users?.length??0};const s=e.users?.length??0,l=i.includedSeats??0,c=i.maxSeats??0,d=Math.max(0,s-l),u=c>0?Math.max(0,c-s):1/0,f=c>0&&s>=c,p=c>0&&s>=.8*c&&!f,m=n.billingInterval??"monthly";return{hasSeatPricing:!0,memberCount:s,includedSeats:l,maxSeats:c,billableSeats:d,availableSeats:u,isAtMax:f,isNearMax:p,perSeatPriceCents:a?Ik(a,o,m):null,currency:o}},[t,e])}const TE=(e,t)=>null==e||0===e?"Free":kv(e,t),RE=e=>{switch(e){case"monthly":default:return"/mo";case"quarterly":return"/qtr";case"yearly":return"/yr"}};var PE=Object.freeze({__proto__:null,default:({open:n,onOpenChange:o,planVersions:i,currentPlanVersionId:l,currentStripePriceId:c,billingCurrency:u,onSelectPlan:p,loading:m=!1})=>{const[h,g]=f(!1),[b,y]=f(null),v=a.useRef(!1),w=s(()=>Pk(c,i),[c,i]),x=w?.interval??null,S=w?.currency??null,k=s(()=>Tk(i),[i]),N=s(()=>{const e=u?.trim().toLowerCase();return e?k.includes(e)?[e]:[]:k},[u,k]),[E,C]=f(x||"monthly"),[A,_]=f(()=>S&&N.includes(S)?S:N.length>0?N[0]:""),T=u?.trim()||A;d(()=>{n&&(C(x||"monthly"),S&&N.includes(S)?_(S):N.length>0&&!N.includes(A)&&_(N[0]))},[n,x,S,N]);const R=s(()=>[...i].sort((e,t)=>e.version-t.version),[i]),P=(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())})(R),O=P.filter(e=>"feature"===e.type),I=P.filter(e=>"limit"===e.type),D=P.filter(e=>"quota"===e.type),U=m||h,M=e=>{switch(e){case"monthly":default:return"Monthly";case"quarterly":return"Quarterly";case"yearly":return"Yearly"}},F=(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=Rk(e,T,t.slug,r);return n||Fk(e.quotas?.[t.slug],r)}return null},z=(e,t,r)=>{if("feature"===t.type)return!0===e?"โœ“":"โ€”";if("limit"===t.type)return null!=e?String(e):"โ€”";if("quota"===t.type){return zk("object"==typeof e&&null!==e&&"included"in e?e:null,t.name.toLowerCase(),{currency:r})}return"โ€”"};return t(wg,{open:n,onOpenChange:o,children:e(Ng,{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("div",{className:"flex-shrink-0 p-6 border-b space-y-4",children:[e("div",{children:[t(Cg,{className:"text-2xl font-bold",children:"Choose Your Plan"}),t(Ag,{className:"mt-1",children:"Compare plans and select the one that fits your needs"})]}),e("div",{className:"flex items-center justify-between gap-4",children:[t("div",{className:"flex items-center gap-2",children:!u?.trim()&&N.length>1&&e(r,{children:[t("span",{className:"text-sm text-slate-600",children:"Currency"}),t("select",{"aria-label":"Select billing currency",value:A,onChange:e=>_(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:N.map(e=>{const r=vv(e);return t("option",{value:e,children:r?`${r} ${e.toUpperCase()}`:e.toUpperCase()},e)})})]})}),t("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(r=>{const n=x===r;return t("button",{onClick:()=>C(r),className:"px-4 py-2 text-sm font-medium rounded-md transition-all relative "+(E===r?"bg-white text-slate-900 shadow-sm":"text-slate-600 hover:text-slate-900"),children:e("span",{className:"flex items-center gap-1.5",children:["monthly"===r&&"Monthly","quarterly"===r&&"Quarterly","yearly"===r&&"Yearly","yearly"===r&&t("span",{className:"text-xs px-1.5 py-0.5 bg-emerald-100 text-emerald-700 rounded-full font-semibold",children:"Save"}),n&&l&&t("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold",children:"Current"})]})},r)})})]})]}),t("div",{className:"flex-1 min-h-0 flex flex-col",children:u?.trim()&&0===N.length?e("div",{className:"text-center py-12 px-4",children:[t("p",{className:"text-slate-600 font-medium",children:"No plans available for your billing currency."}),t("p",{className:"text-slate-500 text-sm mt-2",children:"Something went wrong. Please contact support."})]}):0===R.length?t("div",{className:"text-center py-12 text-gray-500",children:t("p",{children:"No plans available"})}):t("div",{className:"flex-1 min-h-0 overflow-hidden bg-white",children:t("div",{className:"overflow-auto h-full",style:{maxHeight:"calc(100vh - 12rem)"},children:e("table",{className:"w-full border-separate border-spacing-0",style:{minWidth:280+200*R.length+"px",borderCollapse:"separate"},children:[e("colgroup",{children:[t("col",{style:{width:280,minWidth:280}}),R.map(e=>t("col",{style:{width:200,minWidth:200}},e._id))]}),t("thead",{children:e("tr",{className:"align-top",children:[t("th",{className:"sticky top-0 left-0 z-30 p-0 bg-white text-left"}),R.map(r=>{const n=r._id===l,a=(e=>{const t=e._id===l,r=x===E;if(t&&r)return{label:"Current Plan",variant:"outline",disabled:!0};if(t&&!r)return{label:`Switch to ${M(E)}`,variant:"default",disabled:!1};if(!l)return{label:"Subscribe",variant:"default",disabled:!1};const n=R.findIndex(e=>e._id===l),a=R.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}})(r),i=U&&r._id===b,s=(e=>Ek(e,T,E))(r),c=Ek(r,T,"monthly")??0,d="monthly"!==E&&null!==s?((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})(c,s,E):null,u=(e=>!!e.pricingVariants?.some(e=>e.currency?.toLowerCase()===T.toLowerCase()))(r),f=r.pricingVariants?.length&&r.pricingVariants.some(e=>e.currency?.toLowerCase()===T.toLowerCase())?T:r.plan?.currency??T??"";return t("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)] "+(r._id===l?"bg-blue-50/80":"bg-white"),children:e("div",{className:"flex h-full flex-col gap-3",children:[e("div",{className:"flex items-start justify-between gap-2",children:[t("h3",{className:"text-lg font-bold text-slate-900 truncate",children:r.plan.name}),n&&t("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("div",{className:"flex flex-col items-start",children:[e("div",{className:"flex items-baseline gap-1",children:[t("span",{className:"text-2xl font-bold text-slate-900",children:u&&null!==s||u?TE(s,f):"โ€”"}),null!==s&&s>0&&u&&t("span",{className:"text-sm text-slate-500",children:RE(E)})]}),null!==d&&d>0&&u&&e("span",{className:"text-xs text-emerald-600 font-medium mt-0.5",children:["Save ",d,"% vs monthly"]}),(()=>{const t=Ok(r,T);if(!t)return null;const n=Ik(r,T,E);return!n||n<=0?null:e("div",{className:"text-xs text-slate-500 mt-1 border-t border-slate-100 pt-1",children:[e("span",{children:["+ ",kv(n,f),"/seat",RE(E)]}),t.includedSeats>0&&e("span",{className:"text-slate-400",children:[" (",t.includedSeats," included)"]})]})})()]}),r.plan.description&&t("p",{className:"text-xs text-slate-500 line-clamp-2 leading-relaxed text-left",children:r.plan.description}),t(iu,{className:"mt-auto w-full",variant:a.variant,disabled:a.disabled||U||!u,progress:i,onClick:()=>(async e=>{if(!(e===l&&x===E||m||h||v.current)){v.current=!0,g(!0),y(e);try{await p(e,E,T),o(!1)}catch(e){}finally{v.current=!1,g(!1),y(null)}}})(r._id),children:i?"Processing...":u?a.label:"Unavailable"})]})},r._id)})]})}),e("tbody",{children:[O.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:R.length,className:"border-t border-slate-200 bg-slate-100"})]}),O.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),R.map(e=>{const n=F(e,r,E),a=e.pricingVariants?.length?T:e.plan?.currency??T??"",o=z(n,r,a),i="feature"===r.type&&!0===n;return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+(i?"text-emerald-600":"โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]}),I.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:R.length,className:"border-t border-slate-200 bg-slate-100"})]}),I.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),R.map(e=>{const n=F(e,r,E),a=e.pricingVariants?.length?T:e.plan?.currency??T??"",o=z(n,r,a);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]}),D.length>0&&e(r,{children:[e("tr",{children:[t("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"}),t("td",{colSpan:R.length,className:"border-t border-slate-200 bg-slate-100"})]}),D.map(r=>e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:r.name}),r.description&&t("div",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),R.map(e=>{const n=F(e,r,E),a=e.pricingVariants?.length?T:e.plan?.currency??T??"",o=z(n,r,a);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium "+("โ€”"===o?"text-slate-400":"text-slate-700"),children:o})},e._id)})]},r._id))]}),R.some(e=>{const t=Ok(e,T);return t?.enabled})&&e(r,{children:[e("tr",{children:[t("td",{className:"sticky left-0 z-10 border-t border-emerald-200 bg-emerald-50 px-4 py-2.5 font-semibold text-xs uppercase tracking-wider text-emerald-700 shadow-[2px_0_4px_-2px_rgba(0,0,0,0.06)]",children:"Seats"}),t("td",{colSpan:R.length,className:"border-t border-emerald-200 bg-emerald-50"})]}),e("tr",{className:"group hover:bg-slate-50/50",children:[e("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:[t("div",{className:"font-medium text-sm text-slate-900",children:"Included seats"}),t("div",{className:"text-xs text-slate-500 mt-0.5",children:"Free with base price"})]}),R.map(e=>{const r=Ok(e,T);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.includedSeats||0:"โ€”"})},e._id)})]}),e("tr",{className:"group hover:bg-slate-50/50",children:[t("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:t("div",{className:"font-medium text-sm text-slate-900",children:"Max seats"})}),R.map(e=>{const r=Ok(e,T);return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium text-slate-700",children:r?.enabled?r.maxSeats>0?r.maxSeats:"Unlimited":"โ€”"})},e._id)})]}),e("tr",{className:"group hover:bg-slate-50/50",children:[t("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:t("div",{className:"font-medium text-sm text-slate-900",children:"Per extra seat"})}),R.map(e=>{const r=Ik(e,T,E),n=e.pricingVariants?.length?T:e.plan?.currency??T??"";return t("td",{className:"border-t border-slate-100 p-4 text-center align-middle "+(e._id===l?"bg-blue-50/50":"bg-white"),children:t("span",{className:"text-sm font-medium text-slate-700",children:r&&r>0?`${kv(r,n)}${RE(E)}`:"โ€”"})},e._id)})]})]})]})]})})})})]})})}});export{x as ApiVersion,st as AuthStatus,dr as BaseApi,Bf as BetaForm,bv as CURRENCY_DISPLAY,yv as CURRENCY_FLAG,xv as PLAN_CURRENCY_CODES,Sv as PLAN_CURRENCY_OPTIONS,Hf as PricingPage,Hr as QuotaUsageContextProvider,Do as SaaSOSProvider,ur as SettingsApi,Vr as SubscriptionContextProvider,Ao as UserApi,Zf as WhenAuthenticated,op as WhenNoSubscription,lp as WhenNotTrialing,dp as WhenQuotaAvailable,up as WhenQuotaExhausted,fp as WhenQuotaOverage,pp as WhenQuotaThreshold,Jf as WhenRoles,ap as WhenSubscription,ip as WhenSubscriptionToPlans,cp as WhenTrialEnding,sp as WhenTrialing,qf as WhenUnauthenticated,np as WhenUserFeatureDisabled,rp as WhenUserFeatureEnabled,tp as WhenWorkspaceFeatureDisabled,ep as WhenWorkspaceFeatureEnabled,Yf as WhenWorkspaceRoles,mr as WorkspaceApi,kE as WorkspaceSwitcher,Dk as calculateBillableSeats,Uk as calculateSeatOverageCents,Mk as calculateTotalSubscriptionCents,Zt as eventEmitter,kv as formatCents,Nv as formatOverageRate,Ev as formatOverageRateWithLabel,Av as formatQuotaIncludedOverage,zk as formatQuotaWithPrice,Tk as getAvailableCurrenciesFromPlans,Ek as getBasePriceCents,Pk as getBillingIntervalAndCurrencyFromPriceId,vv as getCurrencyFlag,wv as getCurrencySymbol,_k as getDisplayCurrency,Ik as getPerSeatPriceCents,Nk as getPricingVariant,Fk as getQuotaDisplayValue,Rk as getQuotaDisplayWithVariant,Ak as getQuotaOverageCents,Cv as getQuotaUnitLabelFromName,Ok as getSeatPricing,Ck as getStripePriceIdForInterval,Nr as invalidateQuotaUsage,Ht as invalidateSubscription,Lr as useAllQuotaUsage,Ur as useCancelSubscription,Rr as useCreateCheckoutSession,Dr as useInvoice,Ir as useInvoices,_r as usePlanGroup,Tr as usePlanGroupVersions,Cr as usePublicPlanGroupVersion,Er as usePublicPlans,Zr as useQuotaUsageContext,zr as useQuotaUsageStatus,Fr as useRecordUsage,Mr as useResumeSubscription,So as useSaaSAuth,fr as useSaaSOs,pr as useSaaSSettings,Sr as useSaaSWorkspaces,_E as useSeatStatus,Ar as useSubscription,Wr as useSubscriptionContext,Or as useSubscriptionManagement,AE as useTrialStatus,Pr as useUpdateSubscription,jr as useUsageLogs,Xf as useUserAttributes,Qf as useUserFeatures};
30
30
  //# sourceMappingURL=index.esm.js.map